This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/35646] gcc is not using the overflow flag
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Mar 2008 10:18:15 -0000
- Subject: [Bug target/35646] gcc is not using the overflow flag
- References: <bug-35646-3511@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from rguenth at gcc dot gnu dot org 2008-03-20 10:18 -------
It works if you rewrite addto to
void addto(unsigned int *a,unsigned int b) {
if ((*a+b)<b) exit(0);
*a+=b;
}
because the store is no longer required in the path to exit(0).
addto:
.LFB3:
subq $8, %rsp
.LCFI0:
movl %esi, %eax
addl (%rdi), %eax
jb .L5
movl %eax, (%rdi)
addq $8, %rsp
ret
.L5:
xorl %edi, %edi
call exit
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35646