[Bug c/96019] New: Optimization forgets non-default scalar_storage_order

arthur200126 at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Jul 1 12:38:09 GMT 2020


            Bug ID: 96019
           Summary: Optimization forgets non-default scalar_storage_order
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur200126 at gmail dot com
  Target Milestone: ---

Created attachment 48818
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48818&action=edit
test case

The attached code uses a scalar_storage_order to access a byte field in big

On an x86-64 Windows system, the output without optimization, as expected, is
"aabbccdd 1122". The output with optimization (Og) is "ddccbbaa 2211".

The same happens on the https://gcc.godbolt.org/ site. With O0 a bswap can be
found, but it is gone in -O1 and -Og.

I was unable to find the responsible option by bisection on the godbolt
instance, but that could just be a godbolt thing.

More information about the Gcc-bugs mailing list