From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30237 invoked by alias); 19 Apr 2012 20:16:30 -0000 Received: (qmail 30229 invoked by uid 22791); 19 Apr 2012 20:16:27 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Apr 2012 20:16:12 +0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53037] warn_if_not_aligned(X) Date: Thu, 19 Apr 2012 20:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg01684.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53037 --- Comment #12 from H.J. Lu 2012-04-19 20:15:= 55 UTC --- Created attachment 27197 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D27197 A patch I got [hjl@gnu-6 pr53037]$ cat x.i typedef unsigned long long __u64 __attribute__((aligned(4),warn_if_not_aligned(8))); struct foo1 { int i1; int i2; int i3; __u64 x; }; struct foo2 { int i1; int i2; int i3; __u64 x; } __attribute__((aligned(8))); struct foo3 { int i1; int i2; __u64 x; } __attribute__((aligned(8))); struct foo4 { int i1; int i3; __u64 x; }; union bar1 { int i1; int i3; __u64 x; }; union bar2 { int i1; int i3; __u64 x; } __attribute__((aligned(8))); [hjl@gnu-6 pr53037]$ make x.s /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -mx32 -Wall -S x.i x.i:10:1: warning: alignment 32 of =E2=80=98struct foo1=E2=80=99 is less th= an 64 [enabled by default] }; ^ x.i:10:1: warning: =E2=80=98x=E2=80=99 offset 12 in =E2=80=98struct foo1=E2= =80=99 isn't aligned to 8 [enabled by default] }; ^ x.i:18:1: warning: =E2=80=98x=E2=80=99 offset 12 in =E2=80=98struct foo2=E2= =80=99 isn't aligned to 8 [enabled by default] } __attribute__((aligned(8))); ^ x.i:32:1: warning: alignment 32 of =E2=80=98struct foo4=E2=80=99 is less th= an 64 [enabled by default] }; ^ x.i:39:1: warning: alignment 32 of =E2=80=98union bar1=E2=80=99 is less tha= n 64 [enabled by default] }; ^ [hjl@gnu-6 pr53037]$