http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59343
Bug ID: 59343 Summary: miscompiled for loop in sh4 target (-Os) Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugzilla-f5d8 at theblacksun dot eu Created attachment 31327 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31327&action=edit miscompilation testcase The attached testcase miscompiles on sh4 target if build with -Os $ sh4-unknown-linux-gnu-g++ -Wall -Wextra -o for_loop_miscompile_O2 -O2 for_loop_miscompile.cpp $ sh4-unknown-linux-gnu-g++ -Wall -Wextra -o for_loop_miscompile_Os -Os for_loop_miscompile.cpp target $ ./for_loop_miscompile_O2 teststring = 0x411068 teststring = 0x411068 target $ ./for_loop_miscompile_Os teststring = 0x411068 teststring = 0x1