This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/18665] New: -ftrapv borks up simple integer arithmetic


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]