This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/48377] [4.6/4.7 regression] miscompilation at -O3
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 7 Apr 2011 12:56:41 +0000
- Subject: [Bug middle-end/48377] [4.6/4.7 regression] miscompilation at -O3
- Auto-submitted: auto-generated
- References: <bug-48377-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48377
--- Comment #27 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-04-07 12:56:34 UTC ---
(In reply to comment #26)
> int a = __alignof__ (double);
> struct A { int b; double c; int d; } e;
> int f = __alignof__ (e.c);
> double *p;
> int g = __alignof__ (*p);
> int a2 = __alignof__ (long long);
> struct A2 { int b; long long c; int d; } e2;
> int f2 = __alignof__ (e2.c);
> long long *p2;
> int g2 = __alignof__ (*p2);
>
> on powerpc64-linux unfortunately shows that the target hook is needed, at least
> with -m64 -malign-power.
You mean a != f in the above? That's the basic issue of stor-layout not
using properly aligned types for FIELD_DECL types (same issue for packed
structs). So you can't really use type alignment for memory references
but you have to use get_object_alignment & friends. Same happens on
any target for non-packed but just custom (mis-)aligned struct types.