[Bug c/87581] Misaligned 16-bit read trap on x86 platform should be either fixed or documented.

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 11 12:20:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87581

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is not a problem, your program is simply invalid.  On partial strict
alignment architectures like x86 you sometimes get away with that, but that
doesn't mean it is valid, it is still undefined behavior.
As has been said, use -fsanitize=undefined to detect these cases and fix them.


More information about the Gcc-bugs mailing list