public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23109] New: compiler generates wrong code leading to spurious division by zero
@ 2005-07-28 10:43 p dot van-hoof at qub dot ac dot uk
  2005-07-28 16:56 ` [Bug tree-optimization/23109] [4.1 Regression] compiler generates wrong code leading to spurious division by zero with -funsafe-math-optimizations (instead of -ftrapping-math) pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: p dot van-hoof at qub dot ac dot uk @ 2005-07-28 10:43 UTC (permalink / raw)
  To: gcc-bugs

The attached code crashes on a division by zero when compiled as follows:

dogbert> gcc -O1 -funsafe-math-optimizations -ftrapping-math b.c
dogbert> a.out
Floating exception
dogbert> gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/usr/local/gcc410
--enable-languages=c,c++,f95
Thread model: posix
gcc version 4.1.0 20050725 (experimental)

I don't believe that -funsafe-math-optimizations enables -fno-trapping-math, but
to be really sure I added the -ftrapping-math command line option. It makes no
difference.

Taken at face value it looks like the optimizer lifts the division by d outside
the conditional on line 19, even though that could lead to a spurious division
by zero and -ftrapping-math is in effect.

This behavior only shows up on the mainline, and not on the 3.4 and 4.0
branches. A slightly modified version (to enable FP traps on Suns) also crashes
with gcc 4.1.0 on the target sparc-sun-solaris2.9.

-- 
           Summary: compiler generates wrong code leading to spurious
                    division by zero
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: p dot van-hoof at qub dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2006-01-11 14:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23109-1396@http.gcc.gnu.org/bugzilla/>
2005-10-14 12:00 ` [Bug tree-optimization/23109] [4.1 Regression] compiler generates wrong code leading to spurious division by zero with -funsafe-math-optimizations (instead of -ftrapping-math) bonzini at gcc dot gnu dot org
2005-10-14 12:13 ` rguenth at gcc dot gnu dot org
2005-10-14 12:16 ` rguenth at gcc dot gnu dot org
2005-10-14 12:19 ` rguenth at gcc dot gnu dot org
2005-10-22 21:56 ` pinskia at gcc dot gnu dot org
2005-10-31  4:20 ` mmitchel at gcc dot gnu dot org
2005-11-01 22:00 ` bonzini at gcc dot gnu dot org
2005-11-01 22:17 ` rguenth at gcc dot gnu dot org
2005-11-03 10:05 ` bonzini at gcc dot gnu dot org
2005-11-16 14:12 ` steven at gcc dot gnu dot org
2005-11-16 14:16 ` rguenth at gcc dot gnu dot org
2005-11-16 14:46 ` bonzini at gcc dot gnu dot org
2006-01-11 13:02 ` [Bug tree-optimization/23109] [4.1/4.2 " bonzini at gcc dot gnu dot org
2006-01-11 14:29 ` [Bug tree-optimization/23109] [4.1 " bonzini at gcc dot gnu dot org
2006-01-11 14:30 ` bonzini at gnu dot org
2005-07-28 10:43 [Bug c/23109] New: compiler generates wrong code leading to spurious division by zero p dot van-hoof at qub dot ac dot uk
2005-07-28 16:56 ` [Bug tree-optimization/23109] [4.1 Regression] compiler generates wrong code leading to spurious division by zero with -funsafe-math-optimizations (instead of -ftrapping-math) pinskia at gcc dot gnu dot org
2005-08-01  8:53 ` cvs-commit at gcc dot gnu dot org
2005-08-01  8:54 ` rguenth 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).