PR tree-optimization/33146
* fold-const.c (fold_binary): Use the original tree
for negating.
* tree.h (STRIP_SIGN_NOPS): Converting from or to pointer
also changes "sign".
* gcc.c-torture/compile/pr33146.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128666
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-09-22 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/33146
+ * fold-const.c (fold_binary): Use the original tree
+ for negating.
+ * tree.h (STRIP_SIGN_NOPS): Converting from or to pointer
+ also changes "sign".
+
2007-09-22 Eric Botcazou <ebotcazou@adacore.com>
PR target/32325
return omit_one_operand (type, arg1, arg0);
if (integer_onep (arg1))
return non_lvalue (fold_convert (type, arg0));
- /* Transform x * -1 into -x. */
+ /* Transform x * -1 into -x. Make sure to do the negation
+ on the original operand with conversions not stripped
+ because we can only strip non-sign-changing conversions. */
if (integer_all_onesp (arg1))
- return fold_convert (type, negate_expr (arg0));
+ return fold_convert (type, negate_expr (op0));
/* Transform x * -C into -x * C if x is easily negatable. */
if (TREE_CODE (arg1) == INTEGER_CST
&& tree_int_cst_sgn (arg1) == -1
+2007-09-22 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/33146
+ * gcc.c-torture/compile/pr33146.c: New testcase.
+
2007-09-22 Richard Sandiford <rsandifo@nildram.co.uk>
* lib/target-supports.exp (check_cached_effective_target): New
--- /dev/null
+typedef struct
+{
+ int end;
+ int term;
+}
+jpc_enc_pass_t;
+void foo(int numpasses, jpc_enc_pass_t *p)
+{
+ jpc_enc_pass_t *pass;
+ jpc_enc_pass_t *termpass;
+ for (pass = p; pass != termpass; ++pass)
+ if (!pass->term)
+ {
+ termpass = pass;
+ while (termpass - pass < numpasses && !termpass->term)
+ ++termpass;
+ pass->end = termpass->end;
+ }
+}
&& (TYPE_MODE (TREE_TYPE (EXP)) \
== TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
&& (TYPE_UNSIGNED (TREE_TYPE (EXP)) \
- == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
+ == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
+ && (POINTER_TYPE_P (TREE_TYPE (EXP)) \
+ == POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
(EXP) = TREE_OPERAND (EXP, 0)
/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */