--- Comment #1 from arjan at linux dot intel dot com 2009-09-30 09:50
---
Created an attachment (id=18672)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18672action=view)
the failing case with sizeof(int)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41516
--- Comment #2 from arjan at linux dot intel dot com 2009-09-30 09:51
---
Created an attachment (id=18673)
-- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18673action=view)
sizeof(int) replaced by 4 and it suddenly optimizes just fine
--
--- Comment #3 from jakub at gcc dot gnu dot org 2009-09-30 10:07 ---
Try using 4U instead of 4 or (size_t) 4 and you'll see it not optimized out
either.
The problem is that the second comparison is done in size_t, unsigned type, so
if argc is say -3, the function doesn't return -1