From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90166 invoked by alias); 18 Aug 2015 15:57:42 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 90157 invoked by uid 89); 18 Aug 2015 15:57:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f180.google.com Received: from mail-lb0-f180.google.com (HELO mail-lb0-f180.google.com) (209.85.217.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 18 Aug 2015 15:57:39 +0000 Received: by lbbtg9 with SMTP id tg9so106753999lbb.1 for ; Tue, 18 Aug 2015 08:57:36 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.65.35 with SMTP id u3mr6825259lbs.103.1439913456085; Tue, 18 Aug 2015 08:57:36 -0700 (PDT) Received: by 10.114.27.4 with HTTP; Tue, 18 Aug 2015 08:57:36 -0700 (PDT) In-Reply-To: <20150818155042.GC30482@gate.crashing.org> References: <20150818155042.GC30482@gate.crashing.org> Date: Tue, 18 Aug 2015 15:57:00 -0000 Message-ID: Subject: Re: Where does C standard mention alignment requirements as written in gcc manual? From: john smith To: Segher Boessenkool Cc: gcc-help@gcc.gnu.org Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-08/txt/msg00079.txt.bz2 On Tue, Aug 18, 2015 at 5:50 PM, Segher Boessenkool wrote: > On Tue, Aug 18, 2015 at 05:04:28PM +0200, john smith wrote: >> In gcc manual it says: >> >> "Note that the alignment of any given struct or union type is required >> by the ISO C standard to be at least a perfect multiple of the lowest >> common multiple of the alignments of all of the members of the struct >> or union in question." >> >> Where exactly is this requirement mentioned in C standard? I was >> looking for it in both C99 and C11 drafts and couldn't find it. > > C99 6.7.2.1/12 ? It just says that "Each non-bit-field member of a structure or union object is aligned in an implementation-defined manner appropriate to its type.". It doesn't require an overall alignment of the structure to be "at least a perfect multiple of the lowest common multiple of the alignments of all of the members of the struct". --