[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #13 from ppr at melexis dot com 2008-09-18 12:15 --- (In reply to comment #12) > Note you can do the same as AVR does - force flag_delete_null_pointer_checks > to > zero: > Thanks for the hint, I'll use it! Plamen -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #11 from ppr at melexis dot com 2008-09-18 10:57 --- (In reply to comment #10) This workaround doesn't work with GCC 3.4.3 (the base for our 16-bit port). It does work with the latest GCC4.3 though. Anyway, thanks for your support, and for explaining the reasons behin

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #9 from ppr at melexis dot com 2008-09-18 10:20 --- (In reply to comment #8) > I think this code is invalid. I seem to recall the argument that it's > undefined behavior to increment or decrement a pointer to 0. Well, the pointer is not NULL initially

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #6 from ppr at melexis dot com 2008-09-18 08:22 --- (In reply to comment #5) > another vrp bug? -fno-tree-vrp helps. > Yes, -fno-tree-vrp does help -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #4 from ppr at melexis dot com 2008-09-18 07:58 --- The problem seems to be related with the i pointer reaching 0. If the loop condition is e.g. "while ( i != 2 )" everything is ok. The same if the "sum = sum + *(i)" is replaced e.g. with "sum = s

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #3 from ppr at melexis dot com 2008-09-18 07:53 --- Created an attachment (id=16354) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16354&action=view) The compiler output -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #2 from ppr at melexis dot com 2008-09-18 07:53 --- Created an attachment (id=16353) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16353&action=view) The produced assembler source -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569

[Bug c/37569] Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
--- Comment #1 from ppr at melexis dot com 2008-09-18 07:52 --- Created an attachment (id=16352) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16352&action=view) preprocessed source of the test case -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569

[Bug c/37569] New: Loop incorrectly optimized to endless loop with -Os/-O2/-O3

2008-09-18 Thread ppr at melexis dot com
melexis dot com GCC host triplet: i686-pc-cygwin http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37569