public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6
@ 2011-01-30  2:03 howarth at nitro dot med.uc.edu
  2011-01-30  2:07 ` [Bug c/47538] " howarth at nitro dot med.uc.edu
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-30  2:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

           Summary: GNU Scientific Library miscompiled by gcc 4.6
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu


On x86_64-apple-darwin10, current gcc trunk miscompiles the gsl 1.14, GNU
Scientific Library, when built with the default -O2 optimization level. Running
make check on the gsl build shows the failures...

Making check in cheb
make  test
gcc-fsf-4.6 -DHAVE_CONFIG_H -I. -I.. -I..    -g -O2 -MT test.o -MD -MP -MF
.deps/test.Tpo -c -o test.o test.c
mv -f .deps/test.Tpo .deps/test.Po
/bin/sh ../libtool --tag=CC   --mode=link gcc-fsf-4.6  -g -O2   -o test test.o
libgslcheb.la ../ieee-utils/libgslieeeutils.la ../test/libgsltest.la
../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la -lm 
libtool: link: gcc-fsf-4.6 -g -O2 -o test test.o  ./.libs/libgslcheb.a
../ieee-utils/.libs/libgslieeeutils.a ../test/.libs/libgsltest.a
../sys/.libs/libgslsys.a ../err/.libs/libgslerr.a ../utils/.libs/libutils.a -lm
make  check-TESTS
FAIL: gsl_cheb_eval, integ sin(-3.11) (-5.67922629742973622e-19 observed vs
-0.000493439634268399985 expected) [1739]
FAIL: gsl_cheb_eval, integ sin(-3.08) (-1.24082632985168642e-17 observed vs
-0.00197327157172844103 expected) [1740]
FAIL: gsl_cheb_eval, integ sin(-3.05) (-2.12528683906205616e-17 observed vs
-0.00443803539692000371 expected) [1741]
...
FAIL: gsl_cheb_eval_n, integ sin(3.08) (4.05282184237974912e-16 observed vs
-0.00197327157172899614 expected) [2137]
FAIL: gsl_cheb_eval_n, integ sin(3.11) (4.07401622622149715e-16 observed vs
-0.000493439634268733052 expected) [2138]
FAIL: test
==================
1 of 1 test failed
==================

which are not present when building gsl 1.14 with FSF gcc 4.5.2 on
x86_64-apple-darwin10.

Using built-in specs.
COLLECT_GCC=gcc-4
COLLECT_LTO_WRAPPER=/sw/lib/gcc4.6/libexec/gcc/x86_64-apple-darwin10.7.0/4.6.0/lto-wrapper
Target: x86_64-apple-darwin10.7.0
Configured with: ../gcc-4.6-20110129/configure --prefix=/sw
--prefix=/sw/lib/gcc4.6 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.6/info
--with-build-config=bootstrap-lto --enable-stage1-languages=c,lto
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw
--with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
--program-suffix=-fsf-4.6 --enable-checking=yes --enable-cloog-backend=isl
Thread model: posix
gcc version 4.6.0 20110129 (experimental) (GCC)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
@ 2011-01-30  2:07 ` howarth at nitro dot med.uc.edu
  2011-01-30  2:48 ` howarth at nitro dot med.uc.edu
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-30  2:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

Jack Howarth <howarth at nitro dot med.uc.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-apple-darwin10
      Known to work|                            |4.5.2
               Host|                            |x86_64-apple-darwin10
      Known to fail|                            |4.6.0
              Build|                            |x86_64-apple-darwin10

--- Comment #1 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-01-30 01:21:31 UTC ---
When gsl is built with FSF gcc 4.6 at -O1, the failure in the gsl testsuite
becomes a segfault...

Making check in cheb
make  test
gcc-fsf-4.6 -DHAVE_CONFIG_H -I. -I.. -I..    -O1 -MT test.o -MD -MP -MF
.deps/test.Tpo -c -o test.o test.c
mv -f .deps/test.Tpo .deps/test.Po
/bin/sh ../libtool --tag=CC   --mode=link gcc-fsf-4.6  -O1   -o test test.o
libgslcheb.la ../ieee-utils/libgslieeeutils.la ../test/libgsltest.la
../sys/libgslsys.la ../err/libgslerr.la ../utils/libutils.la -lm 
libtool: link: gcc-fsf-4.6 -O1 -o test test.o  ./.libs/libgslcheb.a
../ieee-utils/.libs/libgslieeeutils.a ../test/.libs/libgsltest.a
../sys/.libs/libgslsys.a ../err/.libs/libgslerr.a ../utils/.libs/libutils.a -lm
make  check-TESTS
/bin/sh: line 1:  4837 Segmentation fault      ${dir}$tst
FAIL: test

whereas the gsl built with FSF gcc 4.5.2 at -O1 passes its make check fine.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
  2011-01-30  2:07 ` [Bug c/47538] " howarth at nitro dot med.uc.edu
@ 2011-01-30  2:48 ` howarth at nitro dot med.uc.edu
  2011-01-30  3:05 ` howarth at nitro dot med.uc.edu
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-30  2:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #2 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-01-30 01:49:49 UTC ---
Same wrong code generation seen with gcc trunk on x86_64 linux at -O2. On both
x86_64-apple-darwin10 and x86_64 linux, compiling gsl-1.14/cheb/integ.c at -O0
eliminates the make check failures in gsl.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
  2011-01-30  2:07 ` [Bug c/47538] " howarth at nitro dot med.uc.edu
  2011-01-30  2:48 ` howarth at nitro dot med.uc.edu
@ 2011-01-30  3:05 ` howarth at nitro dot med.uc.edu
  2011-01-30  3:10 ` howarth at nitro dot med.uc.edu
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-30  3:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #3 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-01-30 02:03:17 UTC ---
On x86_64 linux, gsl-1.14/eigen/herm.c is also miscompiled at optimizations
above -O0.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (2 preceding siblings ...)
  2011-01-30  3:05 ` howarth at nitro dot med.uc.edu
@ 2011-01-30  3:10 ` howarth at nitro dot med.uc.edu
  2011-01-30  9:39 ` howarth at nitro dot med.uc.edu
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-30  3:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #4 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-01-30 02:07:23 UTC ---
On x86_64-apple-darwin10, the cheb test fails when integ.c is compiled at -O1
at...

gdb ./test

Reason: KERN_INVALID_ADDRESS at address: 0x0000000100200000
0x0000000100002340 in gsl_cheb_calc_integ (integ=0x100100620, f=0x100100080) at
integ.c:55
55          integ->c[i] = con * (f->c[i-1] - f->c[i+1])/((double)i);
(gdb) bt
#0  0x0000000100002340 in gsl_cheb_calc_integ (integ=0x100100620,
f=0x100100080) at integ.c:55
#1  0x0000000100001888 in main () at test.c:181
(gdb) quit


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (3 preceding siblings ...)
  2011-01-30  3:10 ` howarth at nitro dot med.uc.edu
@ 2011-01-30  9:39 ` howarth at nitro dot med.uc.edu
  2011-01-30 18:20 ` [Bug c/47538] [4.6 Regression] " hjl.tools at gmail dot com
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-30  9:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #5 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-01-30 03:10:37 UTC ---
Interestingly adding all of the options enabled at -O1 to -O0...

-O0 -fcombine-stack-adjustments -fcompare-elim -fcprop-registers -fdefer-pop
-fforward-propagate -fguess-branch-probability -fif-conversion -fif-conversion2
-fipa-profile  -fipa-pure-const -fipa-reference  -fmerge-constants
-fsplit-wide-types  -ftree-bit-ccp -ftree-ccp  -ftree-ch  -ftree-copy-prop
-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse -ftree-fre
-ftree-sink -ftree-sra -ftree-ter 

doesn't trigger the miscompilation.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (4 preceding siblings ...)
  2011-01-30  9:39 ` howarth at nitro dot med.uc.edu
@ 2011-01-30 18:20 ` hjl.tools at gmail dot com
  2011-01-30 22:03 ` hjl.tools at gmail dot com
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-30 18:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|x86_64-apple-darwin10       |x86_64
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.01.30 18:10:12
                 CC|                            |jakub at redhat dot com
               Host|x86_64-apple-darwin10       |
   Target Milestone|---                         |4.6.0
            Summary|GNU Scientific Library      |[4.6 Regression] GNU
                   |miscompiled by gcc 4.6      |Scientific Library
                   |                            |miscompiled by gcc 4.6
     Ever Confirmed|0                           |1
              Build|x86_64-apple-darwin10       |

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-30 18:10:12 UTC ---
gsl-1.14/cheb/integ.c and gsl-1.14/eigen/herm.c are miscompiled
by revision 168440:

http://gcc.gnu.org/ml/gcc-cvs/2011-01/msg00057.html


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug c/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (5 preceding siblings ...)
  2011-01-30 18:20 ` [Bug c/47538] [4.6 Regression] " hjl.tools at gmail dot com
@ 2011-01-30 22:03 ` hjl.tools at gmail dot com
  2011-01-31 10:16 ` [Bug tree-optimization/47538] " jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: hjl.tools at gmail dot com @ 2011-01-30 22:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-30 19:24:16 UTC ---
Revision 168440 also miscompiled the test:

make[4]: Entering directory `/export/gnu/import/rrs/pr47538/bld/linalg'
  3[0]: 1.13399061720677903e-312                      1.5
  3[1]:    2.50000000000000044                     -0.5   
FAIL:   solve_TDN_cyc dim=2 A [233839]                 
  5[0]: 1.13399061436096091e-312    -0.227272727272727265
  5[1]:   -15.2579617834394945    -0.136363636363636354
  5[2]:   -29.8280254777070013      1.31818181818181812
  5[3]:  -0.216560509554140079    -0.409090909090909116
  5[4]:    1.73885350318471321      1.95454545454545459
FAIL:   solve_TDN_cyc dim=5 [233840]    
FAIL: Tridiagonal nonsymmetric cyclic solve [233841]
FAIL: test


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (6 preceding siblings ...)
  2011-01-30 22:03 ` hjl.tools at gmail dot com
@ 2011-01-31 10:16 ` jakub at gcc dot gnu.org
  2011-01-31 10:29 ` ebotcazou at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-31 10:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org
          Component|c                           |tree-optimization

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-31 09:30:30 UTC ---
Ugh.  The problem seems to be that the middle-end considers sizetype and size_t
to be compatible types, thus we have x = y + 1; and similar stmts where x and 1
has sizetype type, but y has size_t.  tree-ssa-ccp.c (but similarly other
places e.g. in tree.c) ignore TYPE_UNSIGNED on sizetype, assuming it is 0, so
my fix in tree-ssa-ccp.c results in different value of uns on such stmts.

--- gcc/tree-ssa.c.jj   2011-01-15 11:26:42.000000000 +0100
+++ gcc/tree-ssa.c      2011-01-31 10:16:30.319433380 +0100
@@ -1276,6 +1276,12 @@ useless_type_conversion_p (tree outer_ty
          || TYPE_PRECISION (inner_type) != TYPE_PRECISION (outer_type))
        return false;

+      if ((TREE_CODE (inner_type) == INTEGER_TYPE
+          && TYPE_IS_SIZETYPE (inner_type))
+         != (TREE_CODE (outer_type) == INTEGER_TYPE
+             && TYPE_IS_SIZETYPE (outer_type)))
+       return false;
+
       /* We don't need to preserve changes in the types minimum or
         maximum value in general as these do not generate code
         unless the types precisions are different.  */

seems to fix the miscompilation, but I'm afraid could have pretty substantial
result on IL size.  Why do we need something so ill-designed as sizetype?  Just
for Ada?


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (7 preceding siblings ...)
  2011-01-31 10:16 ` [Bug tree-optimization/47538] " jakub at gcc dot gnu.org
@ 2011-01-31 10:29 ` ebotcazou at gcc dot gnu.org
  2011-01-31 10:45 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2011-01-31 10:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org

--- Comment #9 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-01-31 10:13:07 UTC ---
> Why do we need something so ill-designed as sizetype?  Just for Ada?

Yes, they are useful for Ada, but the _original_ design; the POINTER_PLUS_EXPR
mistake is orthogonal to it and shouldn't be an excuse to eliminate them.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (8 preceding siblings ...)
  2011-01-31 10:29 ` ebotcazou at gcc dot gnu.org
@ 2011-01-31 10:45 ` jakub at gcc dot gnu.org
  2011-01-31 10:53 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-31 10:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-31 10:27:58 UTC ---
Self-contained testcase:

/* PR tree-optimization/47538 */

struct S
{
  double a, b, *c;
  unsigned long d;
};

__attribute__((noinline, noclone)) void
foo (struct S *x, const struct S *y)
{
  const unsigned long n = y->d + 1;
  const double m = 0.25 * (y->b - y->a);
  x->a = y->a;
  x->b = y->b;
  if (n == 1)
    {
      x->c[0] = 0.;
    }
  else if (n == 2)
    {
      x->c[1] = m * y->c[0];
      x->c[0] = 2.0 * x->c[1];
    }
  else
    {
      double o = 0.0, p = 1.0;
      unsigned long i;

      for (i = 1; i <= n - 2; i++)
        {
          x->c[i] = m * (y->c[i - 1] - y->c[i + 1]) / (double) i;
          o += p * x->c[i];
          p = -p;
        }
      x->c[n - 1] = m * y->c[n - 2] / (n - 1.0);
      o += p * x->c[n - 1];
      x->c[0] = 2.0 * o;
    }
}

int
main (void)
{
  struct S x, y;
  double c[4] = { 10, 20, 30, 40 }, d[4], e[4] = { 118, 118, 118, 118 };

  y.a = 10;
  y.b = 6;
  y.c = c;
  x.c = d;
  y.d = 3;
  __builtin_memcpy (d, e, sizeof d);
  foo (&x, &y);
  if (d[0] != 0 || d[1] != 20 || d[2] != 10 || d[3] != -10)
    __builtin_abort ();
  y.d = 2;
  __builtin_memcpy (d, e, sizeof d);
  foo (&x, &y);
  if (d[0] != 60 || d[1] != 20 || d[2] != -10 || d[3] != 118)
    __builtin_abort ();
  y.d = 1;
  __builtin_memcpy (d, e, sizeof d);
  foo (&x, &y);
  if (d[0] != -20 || d[1] != -10 || d[2] != 118 || d[3] != 118)
    __builtin_abort ();
  y.d = 0;
  __builtin_memcpy (d, e, sizeof d);
  foo (&x, &y);
  if (d[0] != 0 || d[1] != 118 || d[2] != 118 || d[3] != 118)
    __builtin_abort ();
  return 0;
}


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (9 preceding siblings ...)
  2011-01-31 10:45 ` jakub at gcc dot gnu.org
@ 2011-01-31 10:53 ` rguenth at gcc dot gnu.org
  2011-01-31 12:50 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-31 10:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-31 10:44:08 UTC ---
(In reply to comment #9)
> > Why do we need something so ill-designed as sizetype?  Just for Ada?
> 
> Yes, they are useful for Ada, but the _original_ design; the POINTER_PLUS_EXPR
> mistake is orthogonal to it and shouldn't be an excuse to eliminate them.

I agree with that POINTER_PLUS_EXPR shouldn't have used sizetype.

But - the problem with sizetype is not that they exist (and have that
special overflow behavior), but - that sizetypes are considered
always sign-extended despite TYPE_UNSIGNED saying "yes!".  That's a
very very very bad design mistake.  I tried to "fix" that mistake
at least two times IIRC but failed.

At the end -> no-undefined-overflow branch (no more sizetype).


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (10 preceding siblings ...)
  2011-01-31 10:53 ` rguenth at gcc dot gnu.org
@ 2011-01-31 12:50 ` jakub at gcc dot gnu.org
  2011-01-31 13:18 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-31 12:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-31 11:36:24 UTC ---
Created attachment 23177
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23177
gcc46-pr47538.patch

The #c8 patch doesn't bootstrap, agree with Richard this is not stage4ish.

Another alternative patch, which just reverts the patch that caused it and
limits it to comparisons (where lhs type is always unrelated to the comparison
type).


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (11 preceding siblings ...)
  2011-01-31 12:50 ` jakub at gcc dot gnu.org
@ 2011-01-31 13:18 ` rguenth at gcc dot gnu.org
  2011-01-31 13:24 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-31 13:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-31 11:55:03 UTC ---
Can we use sth like

Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c      (revision 169434)
+++ tree-ssa-ccp.c      (working copy)
@@ -1770,9 +1770,38 @@ bit_value_binop_1 (enum tree_code code,
 {
   bool uns = (TREE_CODE (r1type) == INTEGER_TYPE
              && TYPE_IS_SIZETYPE (r1type) ? 0 : TYPE_UNSIGNED (r1type));
+
   /* Assume we'll get a constant result.  Use an initial varying value,
      we fall back to varying in the end if necessary.  */
   *mask = double_int_minus_one;
+
+  /* We have some sizetype issues, drop to varying in case there are
+     mismatches.  */
+  switch (code)
+    {
+    case LSHIFT_EXPR:
+    case RSHIFT_EXPR:
+    case LROTATE_EXPR:
+    case RROTATE_EXPR:
+      if ((TREE_CODE (type) == INTEGER_TYPE
+          && TYPE_IS_SIZETYPE (type) ? 0 : TYPE_UNSIGNED (type)) != uns)
+       return;
+      break;
+
+    case EQ_EXPR:
+    case NE_EXPR:
+    case LT_EXPR:
+    case LE_EXPR:
+    case GE_EXPR:
+    case GT_EXPR:
+      if ((TREE_CODE (r2type) == INTEGER_TYPE
+          && TYPE_IS_SIZETYPE (r2type) ? 0 : TYPE_UNSIGNED (r2type)) != uns)
+       return;
+      break;
+
+    default:;
+    }
+

instead?  It makes it more obvious what happens (IMHO).


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (12 preceding siblings ...)
  2011-01-31 13:18 ` rguenth at gcc dot gnu.org
@ 2011-01-31 13:24 ` rguenth at gcc dot gnu.org
  2011-01-31 13:29 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-31 13:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-31 12:07:52 UTC ---
Created attachment 23178
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23178
patch


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (13 preceding siblings ...)
  2011-01-31 13:24 ` rguenth at gcc dot gnu.org
@ 2011-01-31 13:29 ` rguenth at gcc dot gnu.org
  2011-01-31 15:57 ` howarth at nitro dot med.uc.edu
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-01-31 13:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #23178|0                           |1
        is obsolete|                            |

--- Comment #15 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-01-31 12:30:17 UTC ---
Created attachment 23179
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23179
another update


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (14 preceding siblings ...)
  2011-01-31 13:29 ` rguenth at gcc dot gnu.org
@ 2011-01-31 15:57 ` howarth at nitro dot med.uc.edu
  2011-01-31 17:07 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2011-01-31 15:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #16 from Jack Howarth <howarth at nitro dot med.uc.edu> 2011-01-31 14:59:43 UTC ---
(In reply to comment #15)
> Created attachment 23179 [details]
> another update

This patch eliminates the testsuite failures in gsl-1.14 built at either -O2 or
-O3 under current gcc trunk on x86_64-apple-darwin10.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (15 preceding siblings ...)
  2011-01-31 15:57 ` howarth at nitro dot med.uc.edu
@ 2011-01-31 17:07 ` jakub at gcc dot gnu.org
  2011-01-31 17:23 ` jakub at gcc dot gnu.org
  2011-02-02 18:31 ` dnovillo at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-31 17:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-31 16:52:27 UTC ---
Author: jakub
Date: Mon Jan 31 16:52:22 2011
New Revision: 169441

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169441
Log:
    PR tree-optimization/47538
    * tree-ssa-ccp.c (bit_value_binop_1): For uns computation use
    type instead of r1type, except for comparisons.  For right
    shifts and comparisons punt if there are mismatches in
    sizetype vs. non-sizetype types.

    * gcc.c-torture/execute/pr47538.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr47538.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ccp.c


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (16 preceding siblings ...)
  2011-01-31 17:07 ` jakub at gcc dot gnu.org
@ 2011-01-31 17:23 ` jakub at gcc dot gnu.org
  2011-02-02 18:31 ` dnovillo at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-01-31 17:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-01-31 16:56:33 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug tree-optimization/47538] [4.6 Regression] GNU Scientific Library miscompiled by gcc 4.6
  2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
                   ` (17 preceding siblings ...)
  2011-01-31 17:23 ` jakub at gcc dot gnu.org
@ 2011-02-02 18:31 ` dnovillo at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2011-02-02 18:31 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47538

--- Comment #19 from Diego Novillo <dnovillo at gcc dot gnu.org> 2011-02-02 18:11:57 UTC ---
Author: dnovillo
Date: Wed Feb  2 18:11:45 2011
New Revision: 169721

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169721
Log:
    PR tree-optimization/47538
    * tree-ssa-ccp.c (bit_value_binop_1): For uns computation use
    type instead of r1type, except for comparisons.  For right
    shifts and comparisons punt if there are mismatches in
    sizetype vs. non-sizetype types.

    * gcc.c-torture/execute/pr47538.c: New test.

Added:
    branches/google/integration/gcc/testsuite/gcc.c-torture/execute/pr47538.c
Modified:
    branches/google/integration/gcc/ChangeLog
    branches/google/integration/gcc/testsuite/ChangeLog
    branches/google/integration/gcc/tree-ssa-ccp.c


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-02-02 18:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-30  2:03 [Bug c/47538] New: GNU Scientific Library miscompiled by gcc 4.6 howarth at nitro dot med.uc.edu
2011-01-30  2:07 ` [Bug c/47538] " howarth at nitro dot med.uc.edu
2011-01-30  2:48 ` howarth at nitro dot med.uc.edu
2011-01-30  3:05 ` howarth at nitro dot med.uc.edu
2011-01-30  3:10 ` howarth at nitro dot med.uc.edu
2011-01-30  9:39 ` howarth at nitro dot med.uc.edu
2011-01-30 18:20 ` [Bug c/47538] [4.6 Regression] " hjl.tools at gmail dot com
2011-01-30 22:03 ` hjl.tools at gmail dot com
2011-01-31 10:16 ` [Bug tree-optimization/47538] " jakub at gcc dot gnu.org
2011-01-31 10:29 ` ebotcazou at gcc dot gnu.org
2011-01-31 10:45 ` jakub at gcc dot gnu.org
2011-01-31 10:53 ` rguenth at gcc dot gnu.org
2011-01-31 12:50 ` jakub at gcc dot gnu.org
2011-01-31 13:18 ` rguenth at gcc dot gnu.org
2011-01-31 13:24 ` rguenth at gcc dot gnu.org
2011-01-31 13:29 ` rguenth at gcc dot gnu.org
2011-01-31 15:57 ` howarth at nitro dot med.uc.edu
2011-01-31 17:07 ` jakub at gcc dot gnu.org
2011-01-31 17:23 ` jakub at gcc dot gnu.org
2011-02-02 18:31 ` dnovillo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).