This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/11469] Code compiles and runs correctly without optimisation but causes a bus error if -O is used on Solaris 2.8
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2003 10:24:20 -0000
- Subject: [Bug c/11469] Code compiles and runs correctly without optimisation but causes a bus error if -O is used on Solaris 2.8
- References: <20030709051503.11469.uliva_98@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.