From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2755 invoked by alias); 24 Nov 2004 22:29:11 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1296 invoked by uid 48); 24 Nov 2004 22:28:05 -0000 Date: Wed, 24 Nov 2004 22:29:00 -0000 From: "skunk at iskunk dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20041124222749.18665.skunk@iskunk.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/18665] New: -ftrapv borks up simple integer arithmetic X-Bugzilla-Reason: CC X-SW-Source: 2004-11/txt/msg02984.txt.bz2 List-Id: 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; /* and 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