This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/19020] New: addition on integers doesn't trap
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Dec 2004 20:23:42 -0000
- Subject: [Bug rtl-optimization/19020] New: addition on integers doesn't trap
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following code should abort at runtime when compiled with -ftrapv:
#include <limits.h>
int __attribute__((noinline))
iaddv (int a, int b)
{
return a + b;
}
int main(void)
{
iaddv (INT_MAX, 1);
return 0;
}
It doesn't in 64-bit mode:
[eric@localhost native]$ gcc-4.0 -o addv addv.c -ftrapv
[eric@localhost native]$ ./addv
[eric@localhost native]$ gcc-4.0 -o addv addv.c -ftrapv -m32
[eric@localhost native]$ ./addv
Aborted
The problem originates in .03.jump: the libcall to __addvdi3 is eliminated.
--
Summary: addition on integers doesn't trap
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ebotcazou at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: x86_64-*-*
GCC host triplet: x86_64-*-*
GCC target triplet: x86_64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020