reopen 707118
tags 707118 + upstream
forwarded 707118 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57230
thanks
The incorrect optimization is not that the comparison was optimized
away. It's that the program prints 0 instead of 12. This simplified
testcase shows the same problem:
int main(void)
{
char pstring[] = " hello world";
pstring[0] = (char) (__builtin_strlen(pstring) - 1);
__builtin_printf("%zd\n", __builtin_strlen(pstring));
return 0;
}
The value written to pstring[0] is nonzero, so the length of the string
remains 12, but tree-ssa-strlen.c replaces the second call to
__builtin_strlen with a constant zero, which is wrong.
I was able to reproduce the problem with GCC 4.8 as well, so I filed the
bug upstream: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57230
zw
--
To UNSUBSCRIBE, email to debian-gcc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/518c26dc.6060...@panix.com