public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/27364]  New: Gcc 4.2 miscompiles binutils
@ 2006-04-30  7:13 hjl at lucon dot org
  2006-04-30  7:14 ` [Bug other/27364] " pinskia at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: hjl at lucon dot org @ 2006-04-30  7:13 UTC (permalink / raw)
  To: gcc-bugs

Gcc 4.2 miscompiles binutils on Linux/x86 and Linux/x86-64. When gcc 4.2
is used, "make check" in binutils from CVS will have one failure in gas. The
problem is

     more_than_enough_bits_for_digits
        = (number_of_digits_to_use * 3321928 / 1000000 + 1);

around line 347 in gas/atof-generic.c is computed as 4 when -O2 is used.


-- 
           Summary: Gcc 4.2 miscompiles binutils
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl at lucon dot org
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
@ 2006-04-30  7:14 ` pinskia at gcc dot gnu dot org
  2006-04-30  7:25 ` pinskia at gcc dot gnu dot org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30  7:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-30 07:14 -------
Testcase?  You know this is the nth bug you have filed without a testcase and
every time someone gets upset because you don't follow directions.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Gcc 4.2 miscompiles binutils|Gcc 4.2 miscompiles binutils
                   |on Linux/x86 and Linux/x86- |
                   |64                          |


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
  2006-04-30  7:14 ` [Bug other/27364] " pinskia at gcc dot gnu dot org
@ 2006-04-30  7:25 ` pinskia at gcc dot gnu dot org
  2006-04-30  7:35 ` pinskia at gcc dot gnu dot org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30  7:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-04-30 07:25 -------
You are wrong.

When number_of_digits_to_use is 1, we get:
3321928 / 1000000
Which is equal to 3
And then add 1.

Try again please.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
  2006-04-30  7:14 ` [Bug other/27364] " pinskia at gcc dot gnu dot org
  2006-04-30  7:25 ` pinskia at gcc dot gnu dot org
@ 2006-04-30  7:35 ` pinskia at gcc dot gnu dot org
  2006-04-30  9:59 ` dirtyepic dot sk at gmail dot com
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30  7:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-04-30 07:35 -------
http://gcc.gnu.org/ml/gcc/2006-04/msg00577.html

I don't even see how you can get 37 in general in this case.
I can see 34 but not 37.


-- 


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (2 preceding siblings ...)
  2006-04-30  7:35 ` pinskia at gcc dot gnu dot org
@ 2006-04-30  9:59 ` dirtyepic dot sk at gmail dot com
  2006-04-30 14:25 ` hjl at lucon dot org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: dirtyepic dot sk at gmail dot com @ 2006-04-30  9:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dirtyepic dot sk at gmail dot com  2006-04-30 09:59 -------
Here is the testcase:

dirtyepic ~ $ cat pr27364.S 
.tfloat 1.442695040888963407359924681002
dirtyepic ~ $ gcc pr27364.S 
pr27364.S: Assembler messages:
pr27364.S:1: Fatal error: failed sanity check

This is from sysdeps/x86_64/fpu/s_expm1l.S:40 in glibc.  It produces the error
when we attempt to compile glibc with a binutils-2.16.91.0.* or 2.16.92 built
with GCC trunk.

x86_64-pc-linux-gnu-gcc ../sysdeps/x86_64/fpu/s_expm1l.S -c -D__NO_MATH_INLINES 
-D__LIBC_INTERNAL_MATH_INLINES -I../include 
-I/var/tmp/portage/glibc-2.4-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl/math 
-I/var/tmp/portage/glibc-2.4-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl 
-I../sysdeps/x86_64/elf -I../nptl/sysdeps/unix/sysv/linux/x86_64 
-I../sysdeps/unix/sysv/linux/x86_64 -I../sysdeps/unix/sysv/linux/wordsize-64 
-I../ports/sysdeps/unix/sysv/linux -I../nptl/sysdeps/unix/sysv/linux 
-I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux 
-I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman 
-I../sysdeps/unix/inet -I../ports/sysdeps/unix/sysv -I../nptl/sysdeps/unix/sysv 
-I../sysdeps/unix/sysv -I../sysdeps/unix/x86_64 -I../ports/sysdeps/unix 
-I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix 
-I../sysdeps/x86_64/fpu -I../nptl/sysdeps/x86_64 -I../sysdeps/x86_64 
-I../sysdeps/wordsize-64 -I../sysdeps/ieee754/ldbl-96 
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 
-I../sysdeps/generic/elf -I../sysdeps/generic -I../ports -I../nptl  -I.. 
-I../libio -I. -nostdinc -isystem 
/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0-pre20060421/include -isystem
/usr/include 
-D_LIBC_REENTRANT -include ../include/libc-symbols.h   -DNOT_IN_libc=1 
-DIS_IN_libm=1    -DASSEMBLER   -Wa,--noexecstack -Wa,--noexecstack  -o 
/var/tmp/portage/glibc-2.4-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl/math/s_expm1l.o 
-MD -MP -MF 
/var/tmp/portage/glibc-2.4-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl/math/s_expm1l.o.dt 
-MT 
/var/tmp/portage/glibc-2.4-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl/math/s_expm1l.o
../sysdeps/x86_64/fpu/s_expm1l.S: Assembler messages:
../sysdeps/x86_64/fpu/s_expm1l.S:40: Fatal error: failed sanity check


Glibc is 2.4, configured with:

configure --disable-nls
     --disable-stackguard-randomization
     --enable-old-ssp-compat
     --enable-omitfp
     --with-tls
     --with-__thread
     --enable-add-ons=ports,nptl,c_stubs,libidn
     --enable-kernel=2.6.11
     --without-selinux
     --without-cvs
     --enable-bind-now
     --build=x86_64-pc-linux-gnu
     --host=x86_64-pc-linux-gnu
     --disable-profile
     --without-gd
     --with-headers=/usr/include
     --prefix=/usr
     --libdir=/usr/lib64
     --mandir=/usr/share/man
     --infodir=/usr/share/info
     --libexecdir=/usr/lib64/misc/glibc

Binutils is 2.16.92, configured with:

configure --prefix=/usr
     --host=x86_64-pc-linux-gnu
     --target=x86_64-pc-linux-gnu
     --datadir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.16.92
     --infodir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.16.92/info
     --mandir=/usr/share/binutils-data/x86_64-pc-linux-gnu/2.16.92/man
     --bindir=/usr/x86_64-pc-linux-gnu/binutils-bin/2.16.92
     --libdir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.16.92
     --libexecdir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.16.92
     --includedir=/usr/lib64/binutils/x86_64-pc-linux-gnu/2.16.92/include
     --enable-64-bit-bfd
     --enable-shared
     --disable-werror
     --disable-nls
     --build=x86_64-pc-linux-gnu

and GCC is 20060428 svn:

Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: 
/var/tmp/portage/gcc-4.2.0_pre20060428/work/gcc-4.2.0-20060428/configure 
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.2.0-pre20060428 
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0-pre20060428/include 
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.2.0-pre20060428 
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.2.0-pre20060428/man 
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.2.0-pre20060428/info 
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.2.0-pre20060428/include/g++-v4 
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec 
--disable-nls --with-system-zlib --disable-checking --disable-werror 
--disable-libunwind-exceptions --disable-multilib --disable-libmudflap 
--disable-libssp --disable-libgcj --enable-languages=c,c++ --enable-shared 
--enable-threads=posix --enable-bootstrap --enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 4.2.0-pre20060428  (experimental)

We're not the first to hit it.  See:
http://thread.gmane.org/gmane.comp.gnu.binutils/26989/

What other information will help?


-- 

dirtyepic dot sk at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dirtyepic dot sk at gmail
                   |                            |dot com


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (3 preceding siblings ...)
  2006-04-30  9:59 ` dirtyepic dot sk at gmail dot com
@ 2006-04-30 14:25 ` hjl at lucon dot org
  2006-04-30 15:33 ` hjl at lucon dot org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: hjl at lucon dot org @ 2006-04-30 14:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl at lucon dot org  2006-04-30 14:25 -------
Andrew, I tried my best to find a testcase. The best I can do so far is to
put a testcase in binutils so that when you build binutils with gcc 4.2 on
Linux/x86 and Linux/x86-64, you will get an "make check" failure in gas. I
don't think anyone should have serious problems to get binutils from CVS. If
you don't think I should open this bug, just let me know. I will close it and
open a new one when I find a small testcase.

BTW, there was a typo in my email, it is when number_of_digits_to_use == 11,
gcc 4.2 gets 4 for

(number_of_digits_to_use * 3321928 / 1000000 + 1)

when -O2 is used. From assembler code, it always gets 4 no matter what
number_of_digits_to_use is.


-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (4 preceding siblings ...)
  2006-04-30 14:25 ` hjl at lucon dot org
@ 2006-04-30 15:33 ` hjl at lucon dot org
  2006-04-30 15:57 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: hjl at lucon dot org @ 2006-04-30 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from hjl at lucon dot org  2006-04-30 15:33 -------
Hi Jeff,

It looks like your patch

http://gcc.gnu.org/ml/gcc-patches/2006-02/msg01386.html

causes gcc 4.2 miscompiles binutils on Linux/x86 and Linux/x86-64.


-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at redhat dot com


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (5 preceding siblings ...)
  2006-04-30 15:33 ` hjl at lucon dot org
@ 2006-04-30 15:57 ` pinskia at gcc dot gnu dot org
  2006-04-30 17:55 ` hjl at lucon dot org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 15:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2006-04-30 15:57 -------
Note I think Jeff's patch just exposed a bug.  

Now since we don't have a testcase this is going to put into WAITING until we
have one.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (6 preceding siblings ...)
  2006-04-30 15:57 ` pinskia at gcc dot gnu dot org
@ 2006-04-30 17:55 ` hjl at lucon dot org
  2006-04-30 18:11 ` hjl at lucon dot org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: hjl at lucon dot org @ 2006-04-30 17:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hjl at lucon dot org  2006-04-30 17:55 -------
Created an attachment (id=11350)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11350&action=view)
A testcase

[hjl@gnu-16 gas]$ /export/build/gnu/gcc-last/build-x86_64-linux/./prev-gcc/xgcc
-B/export/build/gnu/gcc-last/build-x86_64-linux/./prev-gcc/ -O2 foo.c
[hjl@gnu-16 gas]$ ./a.out
Aborted


-- 


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


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

* [Bug other/27364] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (7 preceding siblings ...)
  2006-04-30 17:55 ` hjl at lucon dot org
@ 2006-04-30 18:11 ` hjl at lucon dot org
  2006-04-30 18:17 ` [Bug tree-optimization/27364] [4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: hjl at lucon dot org @ 2006-04-30 18:11 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl at lucon dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|2006-04-30 18:11:21         |2006-04-30 18:11:39
               date|                            |


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


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

* [Bug tree-optimization/27364] [4.2 Regression] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (8 preceding siblings ...)
  2006-04-30 18:11 ` hjl at lucon dot org
@ 2006-04-30 18:17 ` pinskia at gcc dot gnu dot org
  2006-04-30 18:21 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 18:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pinskia at gcc dot gnu dot org  2006-04-30 18:17 -------
VRP is doing it:
 D.2691_73 = number_of_digits_to_use_32 * 3321928;
  D.2692_74 = D.2691_73 / 1000000;
  more_than_enough_bits_for_digits_75 = D.2692_74 + 1;
  D.2693_76 = more_than_enough_bits_for_digits_75 / 16;
  more_than_enough_littlenums_for_digits_77 = D.2693_76 + 2;
  size_of_digits_in_littlenums_78 = more_than_enough_littlenums_for_digits_77;
  size_of_digits_in_chars_79 = more_than_enough_littlenums_for_digits_77 * 2;

Into:
  D.2691_73 = number_of_digits_to_use_32 * 3321928;
  D.2692_74 = D.2691_73 / 1000000;
  more_than_enough_bits_for_digits_75 = D.2692_74 + 1;
  D.2693_76 = more_than_enough_bits_for_digits_75 >> 4;
  more_than_enough_littlenums_for_digits_77 = 2;
  size_of_digits_in_littlenums_78 = 2;
  size_of_digits_in_chars_79 = 4;


number_of_digits_to_use_32: [0, 1294]  EQUIVALENCES: { } (0 elements)


....

Note this should not be turned into new until someone reduces it to a smaller
testcase.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |normal
          Component|other                       |tree-optimization
  GCC build triplet|x86_64-unknown-linux-gnu    |
   GCC host triplet|x86_64-unknown-linux-gnu    |
 GCC target triplet|x86_64-unknown-linux-gnu    |
           Keywords|                            |wrong-code
            Summary|Gcc 4.2 miscompiles binutils|[4.2 Regression] Gcc 4.2
                   |                            |miscompiles binutils
   Target Milestone|---                         |4.2.0


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


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

* [Bug tree-optimization/27364] [4.2 Regression] Gcc 4.2 miscompiles binutils
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (9 preceding siblings ...)
  2006-04-30 18:17 ` [Bug tree-optimization/27364] [4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-04-30 18:21 ` pinskia at gcc dot gnu dot org
  2006-04-30 18:23 ` [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 18:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from pinskia at gcc dot gnu dot org  2006-04-30 18:21 -------
Here is the reduced testcase:
int f(unsigned number_of_digits_to_use)
{
  if (number_of_digits_to_use >1294)
    return 0;
  return (number_of_digits_to_use * 3321928 / 1000000 + 1) /16;
}

int main(void)
{
  if (f(11) != 2)
    __builtin_abort ();
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |blocker


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (10 preceding siblings ...)
  2006-04-30 18:21 ` pinskia at gcc dot gnu dot org
@ 2006-04-30 18:23 ` pinskia at gcc dot gnu dot org
  2006-04-30 18:24 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pinskia at gcc dot gnu dot org  2006-04-30 18:22 -------
(In reply to comment #10)
> Here is the reduced testcase:

And guess what that testcase also fails in 4.1.0.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org
            Summary|[4.2 Regression] Gcc 4.2    |[4.1/4.2 Regression] VRP
                   |miscompiles binutils        |miscompiles some unsigned
                   |                            |math


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (11 preceding siblings ...)
  2006-04-30 18:23 ` [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math pinskia at gcc dot gnu dot org
@ 2006-04-30 18:24 ` pinskia at gcc dot gnu dot org
  2006-04-30 19:45 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 18:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.2.0                       |4.1.1


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (12 preceding siblings ...)
  2006-04-30 18:24 ` pinskia at gcc dot gnu dot org
@ 2006-04-30 19:45 ` pinskia at gcc dot gnu dot org
  2006-05-01 16:36 ` law at redhat dot com
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-30 19:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from pinskia at gcc dot gnu dot org  2006-04-30 19:44 -------
The problem here is that 3321928 * 1294 wraps to 3607536 but VRP does not see
it because 3607536 > 3321928.  Oh how I hate wrapping.


-- 


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (13 preceding siblings ...)
  2006-04-30 19:45 ` pinskia at gcc dot gnu dot org
@ 2006-05-01 16:36 ` law at redhat dot com
  2006-05-02 19:44 ` law at redhat dot com
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: law at redhat dot com @ 2006-05-01 16:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from law at redhat dot com  2006-05-01 16:36 -------
The overflow check for multiplication is totally bogus.  The right way to check
for overflow of an integer multiplication is to use division.

ie, given
res = a * b;

Divide res by a, if the result is less than b, then the multiplication
overlowed.
[ Note, assumes a != 0. ]  In fact, any result other than "b" is bad.

Anyway, once we muck up the overflow status of the multiplication we lose.

Jeff


-- 


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (14 preceding siblings ...)
  2006-05-01 16:36 ` law at redhat dot com
@ 2006-05-02 19:44 ` law at redhat dot com
  2006-05-02 19:44 ` law at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: law at redhat dot com @ 2006-05-02 19:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from law at redhat dot com  2006-05-02 19:44 -------
Subject: Re:  [4.2 Regression] Gcc 4.2
        miscompiles binutils

On Sun, 2006-04-30 at 18:21 +0000, pinskia at gcc dot gnu dot org wrote:
> 
> ------- Comment #10 from pinskia at gcc dot gnu dot org  2006-04-30 18:21 -------
> Here is the reduced testcase:
> int f(unsigned number_of_digits_to_use)
> {
>   if (number_of_digits_to_use >1294)
>     return 0;
>   return (number_of_digits_to_use * 3321928 / 1000000 + 1) /16;
> }
> 
> int main(void)
> {
>   if (f(11) != 2)
>     __builtin_abort ();
As discussed in the PR, the problem is we don't detect overflow
from MULT_EXPR correctly.  This causes us to get an incorrect
range which ultimately cascades into generating the wrong
return value.

This patch fixes the overflow detection for MULT_EXPR.  Bootstrapped
and regression tested on i686-pc-linux-gnu, both on the 4.1 branch
and mainline.


------- Comment #15 from law at redhat dot com  2006-05-02 19:44 -------
Created an attachment (id=11362)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11362&action=view)


-- 


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (15 preceding siblings ...)
  2006-05-02 19:44 ` law at redhat dot com
@ 2006-05-02 19:44 ` law at gcc dot gnu dot org
  2006-05-02 19:54 ` law at gcc dot gnu dot org
  2006-05-03  0:49 ` pinskia at gcc dot gnu dot org
  18 siblings, 0 replies; 20+ messages in thread
From: law at gcc dot gnu dot org @ 2006-05-02 19:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from law at gcc dot gnu dot org  2006-05-02 19:44 -------
Subject: Bug 27364

Author: law
Date: Tue May  2 19:44:46 2006
New Revision: 113480

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113480
Log:

        PR tree-optimization/27364
        * tree-vrp.c (vrp_int_const_binop): Fix detection of overflow from
        multiply expressions.

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


Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.c-torture/execute/pr27364.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-vrp.c


-- 


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (16 preceding siblings ...)
  2006-05-02 19:44 ` law at gcc dot gnu dot org
@ 2006-05-02 19:54 ` law at gcc dot gnu dot org
  2006-05-03  0:49 ` pinskia at gcc dot gnu dot org
  18 siblings, 0 replies; 20+ messages in thread
From: law at gcc dot gnu dot org @ 2006-05-02 19:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from law at gcc dot gnu dot org  2006-05-02 19:54 -------
Subject: Bug 27364

Author: law
Date: Tue May  2 19:54:20 2006
New Revision: 113481

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113481
Log:

        PR tree-optimization/27364
        * tree-vrp.c (vrp_int_const_binop): Fix detection of overflow from
        multiply expressions.

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


Added:
    trunk/gcc/testsuite/gcc.c-torture/execute/pr27364.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c


-- 


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


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

* [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math
  2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
                   ` (17 preceding siblings ...)
  2006-05-02 19:54 ` law at gcc dot gnu dot org
@ 2006-05-03  0:49 ` pinskia at gcc dot gnu dot org
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-03  0:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #18 from pinskia at gcc dot gnu dot org  2006-05-03 00:48 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-05-03  0:49 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-30  7:13 [Bug other/27364] New: Gcc 4.2 miscompiles binutils hjl at lucon dot org
2006-04-30  7:14 ` [Bug other/27364] " pinskia at gcc dot gnu dot org
2006-04-30  7:25 ` pinskia at gcc dot gnu dot org
2006-04-30  7:35 ` pinskia at gcc dot gnu dot org
2006-04-30  9:59 ` dirtyepic dot sk at gmail dot com
2006-04-30 14:25 ` hjl at lucon dot org
2006-04-30 15:33 ` hjl at lucon dot org
2006-04-30 15:57 ` pinskia at gcc dot gnu dot org
2006-04-30 17:55 ` hjl at lucon dot org
2006-04-30 18:11 ` hjl at lucon dot org
2006-04-30 18:17 ` [Bug tree-optimization/27364] [4.2 Regression] " pinskia at gcc dot gnu dot org
2006-04-30 18:21 ` pinskia at gcc dot gnu dot org
2006-04-30 18:23 ` [Bug tree-optimization/27364] [4.1/4.2 Regression] VRP miscompiles some unsigned math pinskia at gcc dot gnu dot org
2006-04-30 18:24 ` pinskia at gcc dot gnu dot org
2006-04-30 19:45 ` pinskia at gcc dot gnu dot org
2006-05-01 16:36 ` law at redhat dot com
2006-05-02 19:44 ` law at redhat dot com
2006-05-02 19:44 ` law at gcc dot gnu dot org
2006-05-02 19:54 ` law at gcc dot gnu dot org
2006-05-03  0:49 ` pinskia at gcc dot gnu dot 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).