backport: re PR tree-optimization/55236 (gcc.c-torture/execute/pr22493-1.c FAILs with -fPIC)
Backported from mainline 2012-11-17 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/55236 * fold-const.c (make_range_step) <case NEGATE_EXPR>: For -fwrapv and signed ARG0_TYPE, force low and high to be non-NULL. * gcc.dg/pr55236.c: New test. From-SVN: r195649
This commit is contained in:
parent
b07db5d451
commit
369a5a74b7
|
@ -1,6 +1,12 @@
|
|||
2013-02-01 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
Backported from mainline
|
||||
2012-11-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/55236
|
||||
* fold-const.c (make_range_step) <case NEGATE_EXPR>: For -fwrapv
|
||||
and signed ARG0_TYPE, force low and high to be non-NULL.
|
||||
|
||||
2012-11-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/54127
|
||||
|
|
|
@ -3908,6 +3908,17 @@ make_range_step (location_t loc, enum tree_code code, tree arg0, tree arg1,
|
|||
return arg0;
|
||||
|
||||
case NEGATE_EXPR:
|
||||
/* If flag_wrapv and ARG0_TYPE is signed, make sure
|
||||
low and high are non-NULL, then normalize will DTRT. */
|
||||
if (!TYPE_UNSIGNED (arg0_type)
|
||||
&& !TYPE_OVERFLOW_UNDEFINED (arg0_type))
|
||||
{
|
||||
if (low == NULL_TREE)
|
||||
low = TYPE_MIN_VALUE (arg0_type);
|
||||
if (high == NULL_TREE)
|
||||
high = TYPE_MAX_VALUE (arg0_type);
|
||||
}
|
||||
|
||||
/* (-x) IN [a,b] -> x in [-b, -a] */
|
||||
n_low = range_binop (MINUS_EXPR, exp_type,
|
||||
build_int_cst (exp_type, 0),
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
2013-02-01 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
Backported from mainline
|
||||
2012-11-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/55236
|
||||
* gcc.dg/pr55236.c: New test.
|
||||
|
||||
2012-11-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/54127
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* PR tree-optimization/55236 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-O2 -fwrapv" } */
|
||||
|
||||
extern void abort ();
|
||||
|
||||
__attribute__((noinline, noclone)) void
|
||||
foo (int i)
|
||||
{
|
||||
if (i > 0)
|
||||
abort ();
|
||||
i = -i;
|
||||
if (i < 0)
|
||||
return;
|
||||
abort ();
|
||||
}
|
||||
|
||||
__attribute__((noinline, noclone)) void
|
||||
bar (int i)
|
||||
{
|
||||
if (i > 0 || (-i) >= 0)
|
||||
abort ();
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
foo (-__INT_MAX__ - 1);
|
||||
bar (-__INT_MAX__ - 1);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue