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/35646] gcc is not using the overflow flag



------- 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


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