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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

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

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2012-04-17 
14:37:13 UTC ---
child_t is a struct that requires 32-bit alignment, so the compiler is entitled
to assume that any pointer to an object containing a child_t will be correctly
aligned.  The line:

const parent_t* parentptr = (const parent_t*)(data + 1);

violates that assumption, so your code has undefined behaviour.  In this case
that turns out to be an alignment fault at run-time.

Reply via email to