Bug in scalar_storage_order("big-endian")

Bug #1818326 reported by Tony on 2019-03-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Undecided
Unassigned

Bug Description

If a 16-bit integer is loaded from memory as a little-endian, and then immediately again as a big-endian, the compiler optimises away the second load, but forgets to switch its endianness. The attached file BigEndianBug.c shows the problem: f2 returns 0x1234 instead of the expected 0x3412.

Incidentally, there is a minor problem in f1 too: the uxth instruction is redundant. (This is still the case at optimisation level O3.)

Compile command:

arm-none-eabi-gcc.exe -c -oBigEndianBug.o -march=armv6-m -mthumb -Wall -Wa,-a,-adn -O1 BigEndianBug.c >BigEndianBug.lst

Compiler version:

arm-none-eabi-gcc.exe (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074]

(but these problems were also there in version 7 2018-q2-update).

Running on Windows 10.

Tony (tonyk) on 2019-03-02
description: updated
Tony (tonyk) on 2019-03-02
description: updated
Tony (tonyk) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments