From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5537 invoked by alias); 18 Apr 2012 22:59:21 -0000 Received: (qmail 5484 invoked by uid 22791); 18 Apr 2012 22:59:20 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,SUBJ_OBFU_PUNCT_FEW,SUBJ_OBFU_PUNCT_MANY 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; Wed, 18 Apr 2012 22:58:33 +0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53037] New: warn_if_not_aligned(X) Date: Wed, 18 Apr 2012 22:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" 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/msg01576.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53037 Bug #: 53037 Summary: warn_if_not_aligned(X) Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: hjl.tools@gmail.com What I'd like to have is an __attribute__((warn_if_not_aligned(X))) which issues a warning if the object/type/field in question is not aligned to X. In particular, I'd like to build with: typedef unsigned long long __u64 __attribute__((aligned(4),warn_if_not_aligned(8))); ... in order to get a list of the places where we have misaligned 64-bit data pieces in x86. Then we can do Linus' requested cleanups which ultimately aims to getting __u64 to be __attribute__((aligned(8))) even on i386, with an explicit __compat_u64 for the places where we need to be misaligned for legacy reasons.