re PR rtl-optimization/34490 (r128833 causes miscompilation of glibc clock_gettime.c)
PR rtl-optimization/34490 * simplify-rtx.c (simplify_const_relational_operation): If !sign, don't reduce mmin/mmax using num_sign_bit_copies. * gcc.c-torture/execute/20071216-1.c: New test. From-SVN: r131023
This commit is contained in:
parent
44f37984f4
commit
dc7c279e97
@ -1,3 +1,9 @@
|
||||
2007-12-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/34490
|
||||
* simplify-rtx.c (simplify_const_relational_operation): If !sign,
|
||||
don't reduce mmin/mmax using num_sign_bit_copies.
|
||||
|
||||
2007-12-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* doc/install.texi: Change recommended MPFR from 2.2.1 > 2.3.0.
|
||||
|
@ -4233,15 +4233,17 @@ simplify_const_relational_operation (enum rtx_code code,
|
||||
else
|
||||
{
|
||||
rtx mmin_rtx, mmax_rtx;
|
||||
unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
|
||||
get_mode_bounds (mode, sign, mode, &mmin_rtx, &mmax_rtx);
|
||||
|
||||
/* Since unsigned mmin will never be interpreted as negative, use
|
||||
INTVAL (and an arithmetic right shift). */
|
||||
mmin = INTVAL (mmin_rtx) >> (sign_copies - 1);
|
||||
/* Since signed mmax will always be positive, use UINTVAL (and
|
||||
a logical right shift). */
|
||||
mmax = UINTVAL (mmax_rtx) >> (sign_copies - 1);
|
||||
mmin = INTVAL (mmin_rtx);
|
||||
mmax = INTVAL (mmax_rtx);
|
||||
if (sign)
|
||||
{
|
||||
unsigned int sign_copies = num_sign_bit_copies (trueop0, mode);
|
||||
|
||||
mmin >>= (sign_copies - 1);
|
||||
mmax >>= (sign_copies - 1);
|
||||
}
|
||||
}
|
||||
|
||||
switch (code)
|
||||
|
@ -1,3 +1,8 @@
|
||||
2007-12-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/34490
|
||||
* gcc.c-torture/execute/20071216-1.c: New test.
|
||||
|
||||
2007-12-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* gcc.dg/torture/builtin-math-4.c: Remove XFAIL.
|
||||
|
38
gcc/testsuite/gcc.c-torture/execute/20071216-1.c
Normal file
38
gcc/testsuite/gcc.c-torture/execute/20071216-1.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* PR rtl-optimization/34490 */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
static int x;
|
||||
|
||||
int
|
||||
__attribute__((noinline))
|
||||
bar (void)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
foo (void)
|
||||
{
|
||||
long int b = bar ();
|
||||
if ((unsigned long) b < -4095L)
|
||||
return b;
|
||||
if (-b != 38)
|
||||
b = -2;
|
||||
return b + 1;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
x = 26;
|
||||
if (foo () != 26)
|
||||
abort ();
|
||||
x = -39;
|
||||
if (foo () != -1)
|
||||
abort ();
|
||||
x = -38;
|
||||
if (foo () != -37)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user