This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Mar 2008 10:50:42 -0000
- Subject: [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
- References: <bug-19020-226@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from steven at gcc dot gnu dot org 2008-03-01 10:50 -------
With trunk as of today, the test case of comment #0 does trap if optimization
is disabled. At -O, the libcall is optimized away, but the call to iaddv() from
main() is also optimized away because iaddv is found to be pure. You must use
the result of iaddv() to avoid this:
#include <limits.h>
int __attribute__((noinline))
iaddv (int a, int b)
{
return a + b;
}
int main(void)
{
return iaddv (INT_MAX, 1);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020