public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/18665] New: -ftrapv borks up simple integer arithmetic
@ 2004-11-24 22:29 skunk at iskunk dot org
  2004-11-24 22:32 ` [Bug target/18665] " skunk at iskunk dot org
                   ` (30 more replies)
  0 siblings, 31 replies; 33+ messages in thread
From: skunk at iskunk dot org @ 2004-11-24 22:29 UTC (permalink / raw)
  To: gcc-bugs

A large program was failing mysteriously on our new Opteron box. Went through it
with a fine-toothed debugger, until I came to the line

    k -= i;  /* <k> and <i> are ints */

Before this line: k == 2, i == 1
 After this line: k == -14, i == 1

Compiling without -ftrapv makes this weirdness go away.

I will attach a tarball containing two .c files and a makefile, basically the
aforementioned big program with all irrelevant code ripped out---just enough to
reproduce the problem.

This bug first came up with 3.4.2, as shipped with Fedora Core 3 (x86-64). I
built 3.4.3 with the below configuration to confirm that the bug is still present.

Output from "gcc -v"
====================
Reading specs from
/mnt/freeport/opt/gcc-3.4.3--linux64/bin/../lib/gcc/x86_64-unknown-linux-gnu/3.4.3/specs
Configured with: /mnt/freeport/src/gcc/current/configure
--prefix=/mnt/freeport/arch/linux64 --disable-dependency-tracking
--disable-shared --disable-nls --with-libiconv-prefix=/mnt/freeport/arch/linux64
--disable-multilib --with-arch=opteron
Thread model: posix
gcc version 3.4.3

-- 
           Summary: -ftrapv borks up simple integer arithmetic
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: skunk at iskunk dot org
                CC: gcc-bugs at gcc dot gnu 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=18665


^ permalink raw reply	[flat|nested] 33+ messages in thread
* [Bug target/18665] [3.4/4.0 Regression] -ftrapv borks up simple integer arithmetic
@ 2004-12-07  1:16 Paul Schlie
  0 siblings, 0 replies; 33+ messages in thread
From: Paul Schlie @ 2004-12-07  1:16 UTC (permalink / raw)
  To: gcc-bugs

> ------- Additional Comments From rth at gcc dot gnu dot org  2004-12-06
> Look at the routines we implement in libgcc and ask again.  We never did
> implement sub-word routines.

Which is an interesting point, but wouldn't it be more ideal to define
default built-in's for each of a target's defined unique sized types
independently of it's word size?

(Thereby enabling operations to operate on the smallest sized operands
necessary to satisfy it's destination precision requirements without having
to otherwise unnecessarily promote smaller operations to their larger
defined counterparts if advantageous to do so?)




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

end of thread, other threads:[~2004-12-15 12:39 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-24 22:29 [Bug target/18665] New: -ftrapv borks up simple integer arithmetic skunk at iskunk dot org
2004-11-24 22:32 ` [Bug target/18665] " skunk at iskunk dot org
2004-11-24 22:42 ` pinskia at gcc dot gnu dot org
2004-11-28  0:07 ` steven at gcc dot gnu dot org
2004-11-28  0:22 ` steven at gcc dot gnu dot org
2004-11-28  0:26 ` steven at gcc dot gnu dot org
2004-11-28  0:31 ` [Bug target/18665] [4.0 Regression] " steven at gcc dot gnu dot org
2004-11-28  0:33 ` [Bug target/18665] [3.4/4.0 " pinskia at gcc dot gnu dot org
2004-11-28  0:34 ` steven at gcc dot gnu dot org
2004-11-28 13:00 ` steven at gcc dot gnu dot org
2004-12-06 18:45 ` ebotcazou at gcc dot gnu dot org
2004-12-06 18:47 ` ebotcazou at gcc dot gnu dot org
2004-12-06 20:51 ` rth at gcc dot gnu dot org
2004-12-07  6:59 ` ebotcazou at gcc dot gnu dot org
2004-12-07 14:36 ` schlie at comcast dot net
2004-12-10  7:35 ` ebotcazou at gcc dot gnu dot org
2004-12-10  9:53 ` ebotcazou at gcc dot gnu dot org
2004-12-10 10:11 ` ebotcazou at gcc dot gnu dot org
2004-12-10 18:59 ` [Bug other/18665] " rth at gcc dot gnu dot org
2004-12-10 19:24 ` ebotcazou at gcc dot gnu dot org
2004-12-10 19:40 ` rth at gcc dot gnu dot org
2004-12-10 20:04 ` ebotcazou at gcc dot gnu dot org
2004-12-10 20:17 ` rth at gcc dot gnu dot org
2004-12-11  9:39 ` ebotcazou at gcc dot gnu dot org
2004-12-11 23:12 ` rth at gcc dot gnu dot org
2004-12-12  7:19 ` ebotcazou at gcc dot gnu dot org
2004-12-13 17:11 ` pinskia at gcc dot gnu dot org
2004-12-14 14:17 ` pinskia at gcc dot gnu dot org
2004-12-14 14:36 ` ebotcazou at gcc dot gnu dot org
2004-12-15 12:31 ` cvs-commit at gcc dot gnu dot org
2004-12-15 12:35 ` cvs-commit at gcc dot gnu dot org
2004-12-15 12:39 ` ebotcazou at gcc dot gnu dot org
2004-12-07  1:16 [Bug target/18665] " Paul Schlie

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).