https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66556
Bug ID: 66556 Summary: Wrong code-generation for armv7-a big-endian at -Os Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: renlin at gcc dot gnu.org Target Milestone: --- Created attachment 35789 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35789&action=edit test case The test case is attached. toolchain built from latest trunk code and branch 5 produce wrong code-generation with the following command line option. arm-none-eabi-gcc -march=armv7-a -mbig-endian -Os test.c -o test.out The correct output should be: checksum = ff However, the result is: checksum = 7 The testcase is correctly compiled at -O1, which gives the right execution result. The test case works fine for little-endian at any optimization level.