[Bug c/11469] Code compiles and runs correctly without optimisation but causes a bus error if -O is used on Solaris 2.8

ebotcazou at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jul 9 10:24:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2003-07-09 10:24 -------
Your code invokes undefined behaviour according to the C standard, because
you're converting a void pointer 'p' (which has the alignment requirement of
char* pointer) to a double* pointer, and 'p' is not sufficiently aligned for
pointing to a double.

char* pointers are 4-byte aligned on SPARC while double* pointers are 8-byte
aligned.



More information about the Gcc-bugs mailing list