[Bug middle-end/56341] GCC produces unaligned data access

bernd.edlinger at hotmail dot de gcc-bugzilla@gcc.gnu.org
Tue Feb 26 18:25:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56341

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29506|0                           |1
        is obsolete|                            |

--- Comment #8 from Bernd Edlinger <bernd.edlinger at hotmail dot de> 2013-02-26 18:24:58 UTC ---
Created attachment 29546
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29546
proposed patch, cleaned up

in the last version of this patch the packedp parameter had only an
impact on the generated warning.

if packedp==true the warning is:
"multiple accesses to volatile structure member/bitfield
 because of packed attribute"

if packedp==false the warning is:
"mis-aligned access used for structure member/bitfield
 when a volatile object spans multiple type-sized locations,
 the compiler must choose between using a single mis-aligned access to
 preserve the volatility, or using multiple aligned accesses to avoid
 runtime faults; this code may fail at runtime if the hardware does
 not allow this access"

The second warning says in short:
"I am going to generate mis-aligned code, and I know it will fail at runtime."

However this patch is supposed to avoid mis-aligned code, at least for ARM.
Therefore it is only natural that the second warning is no longer needed.

Now I removed all packedp code in extract_bit_field and store_bit_field,
including the second warning. Fortunately that makes the patch much smaller.

I did boot-strap the patched compiler several times, and everything looks good.

TODO: remove translations of the obsolete warnings. (I dont know how to)



More information about the Gcc-bugs mailing list