From owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org  Wed Dec  2 23:55:10 2026
Return-Path: <owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org>
X-Original-To: sc22wg14-domo2
Delivered-To: sc22wg14-domo2@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 7BD5D356D5B; Wed,  2 Dec 2026 23:55:10 +0100 (CET)
Delivered-To: sc22wg14@open-std.org
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124])
	by www.open-std.org (Postfix) with ESMTP id F0D183566C3
	for <sc22wg14@open-std.org>; Wed,  2 Dec 2026 23:55:09 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1796252108;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type;
	bh=JNwbCp/V2P1DqkkQRle/Xe7/3THKiQ5s+9+IzPW18mk=;
	b=QdbWQw5CQO/wO1/tWRUj7Mjg5jnBvx3UclnylW+jzTNU5bgffPWzAz6pEphc0BOiTsWySi
	yssoaRqPXOmwK0XmgdUPqexCaJ+GfMh55T80NRS2L5PwwK2sA2nZoUxGiDLAWpjyFexY8h
	7UzFFEvaLNuKDDID3ku/r+huK2zyt+E=
X-MC-Rep: binary re single
Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com
 [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-29-nM9UgX4UOLucPNFGVtXOng-1; Wed, 2 Dec 2026 22:55:06 +0000
X-MC-Unique: nM9UgX4UOLucPNFGVtXOng-1
X-Mimecast-MFC-AGG-ID: nM9UgX4UOLucPNFGVtXOng_1796252105
Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-48fbcf023dcso2912023f8f.2
        for <sc22wg14@open-std.org>; Wed, 02 Dec 2026 14:55:06 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796252105; x=1796856905;
        h=content-type:mime-version:message-id:subject:to:from:date:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=JNwbCp/V2P1DqkkQRle/Xe7/3THKiQ5s+9+IzPW18mk=;
        b=EF8GizLQR0aRDbq85qseU3JLyF270DIBMKpWYuXbtb4cbTqPeVXU2Y48ADfdOIblqf
         nWmu/Cp54+aC5VXjErQgJM2zM9nEpe0v1I2yKReCKasqTDnxqrOISGivhVambi5j8t7C
         24DvNUltHGg3lCp87pGmT9xmC8KpRlTgTJf5O4dDotcmgL1/1g+t+Axk8hblSbkO55l4
         Fk1HU86IfyxD9Ax56dMnhcZGy3r7fHpCvmU+NsOXrufnFd7vgcBsxrlbr1Wd23Ho1lGR
         qSd7UPWRPsnPNGm3DH+3mqWjtcpcipgQ2oQEsrt82GICZ1CMOOMcHvj/KcxFhyp31utC
         +A4g==
X-Gm-Message-State: APuU4Z+12R51skiNax3L1lL8R22bXv4Hz1C/cxUzxq8kKAs/AQs/D1sk
	QBBbe/QV0M/GOX5+Vki/J522huHWTF0bpMxq72wa7IOqOM9VUofAZb+5LECUh2SVKvLhjkVN8MN
	dgqHn2BG2LIGdhGOrbr7WT5fPGewclp7GVicbS65pynZEdZ2z/ELvt7ZG/yZSPK1vykASCPqoY6
	W1ukF3dmmDOimbXI2icfnLPdAom0ih5+k3j1UzzXtX
X-Gm-Gg: AZFdTZcbR09V8QZ3t57u0sN+i/9y5V1KUjHdbrFVhiv5dp7YghgT/zq08gCo54XQQwu
	uRDqqLhnrxxjKj0y2iHcFqtXV2M1PRelB8eTgC7k9FeDSa1uveeHNfD4rxdPcnIs90YgDxkoWwl
	nJrfKRo2qtrKFdkXmXm87Jx1tiUh9hH/Pkbkcg5HHLvuGXIVIb38q/tVT2NROHFEBxCZ3PvbHvs
	xpW3hV9PTcvDo7b9zvNDCRq3VtTYrtAinxveKqW3x0QDUYIRvtMJpLk0ebRbQdh0D5pnix5AggE
	simJgZbtQEDmUs/Rz/phRXN9tAF0SEoUqs8ln9U7bTe+aaAqg9GfeqaODnFxQ7yoxWiTBzrrmYx
	ac1K2IB3KoWapcqCcBnilchTKHP7J1LJA5EY6FlJusXhcxtRNjP2/x+Vb3wXW0Ce/MA8VYyAUuY
	dMdZHTRxPAbug/uLkH6E4=
X-Received: by 2002:a05:6000:2913:b0:4a8:7115:fa08 with SMTP id ffacd0b85a97d-4abb0f3c202mr84701371f8f.13.1796252105250;
        Wed, 02 Dec 2026 14:55:05 -0800 (PST)
X-Received: by 2002:a05:6000:2913:b0:4a8:7115:fa08 with SMTP id ffacd0b85a97d-4abb0f3c202mr84701344f8f.13.1796252104768;
        Wed, 02 Dec 2026 14:55:04 -0800 (PST)
Received: from digraph.polyomino.org.uk (digraph.polyomino.org.uk. [81.187.227.50])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6c61f558sm81989370f8f.58.2026.12.02.14.55.02
        for <sc22wg14@open-std.org>
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 02 Dec 2026 14:55:03 -0800 (PST)
Received: from jsm28 (helo=localhost)
	by digraph.polyomino.org.uk with local-esmtp (Exim 4.98.2)
	(envelope-from <josmyers@redhat.com>)
	id 1xYtE5-00000007sJh-0dkh
	for sc22wg14@open-std.org;
	Wed, 02 Dec 2026 22:55:01 +0000
Date: Wed, 2 Dec 2026 22:55:01 +0000 (UTC)
From: Joseph Myers <josmyers@redhat.com>
To: sc22wg14@open-std.org
Subject: Wording for issues 1041 and 1044 (alignment)
Message-ID: <32a8b8eb-667b-9663-ba6b-d6d5527e7193@redhat.com>
MIME-Version: 1.0
X-Mimecast-Spam-Score: 0
X-Mimecast-MFC-PROC-ID: Z4KW8MnZ_lQ0Ghs3CAbxQJhHIIi8_wv2DKlsYNUe_hQ_1796252105
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset=US-ASCII
Sender: owner-sc22wg14@open-std.org
Precedence: bulk

I propose the following wording for issues 1041 and 1044 concerning 
consistency requirements on alignment specifiers.

Because we changed some undefined behavior in this area to Constraints for 
C2Y (June 2024 meeting, N3244, item 69, using the alternative wording), 
there are some differences between the changes to 6.7.6 for C23 and the 
changes for C2Y.  The principle followed for C2Y, based on what was 
discussed at last month's meeting, is that inconsistency is a constraint 
violation when the inconsistent declarations are simultaneously visible, 
and otherwise undefined behavior (while for C23 it's always undefined 
behavior).

I chose the approach that alignas(0) is treated the same as no alignment 
specifier, but alignas(int) on an int is treated differently from having 
no alignment specifier at all.  The idea there is that it's rather tricky 
to define a concept of alignment specifiers that specify nonzero alignment 
but still don't end up increasing the alignment an object would otherwise 
have had, because the alignment it would otherwise have had is a 
complicated concept (may depend on storage duration, whether it's in a 
structure, previous structure members, etc.) - so rather than using a 
tricky and implementation-specific concept there, or a weaker one of the 
minimum alignment for the type (without regard to whether the particular 
declaration would have had larger alignment), something simpler and not 
implementation-specific is used.


### Suggested correction (C23)

Insert new Constraints paragraphs in 6.7.6 (Alignment specifier),
after the paragraph describing valid constant expressions in an
alignment specifier.

> <ins>An alignment specifier is said to be *effective* if it
> specifies nonzero alignment.</ins>
> 
> <ins>The sets (possibly empty) of alignment specifiers for two
> declarations or member declarations are said to be *equivalent*
> if:</ins>
> - <ins>each set contains an effective alignment specifier, and the
>   strictest specified alignment in each set is the same; or</ins>
> - <ins>neither set contains an effective alignment specifier.</ins>
> 
> <ins>Two declarations are said to have *consistent* sets of
> alignment specifiers if:</ins>
> - <ins>both sets of alignment specifiers are equivalent; or</ins>
> - <ins>one declaration has an effective alignment specifier, the
>   other declaration does not have an effective alignment specifier,
>   and the declaration without an effective alignment specifier is
>   not a definition or tentative definition.</ins>

Replace the last paragraph of Semantics in 6.7.6 (Alignment
specifier):

> <del>If the definition of an object has an alignment specifier, any
> other declaration of that object shall either specify equivalent
> alignment or have no alignment specifier. If the definition of an
> object does not have an alignment specifier, any other declaration
> of that object shall also have no alignment specifier. If
> declarations of an object in different translation units have
> different alignment specifiers, the behavior is undefined.</del>

> <ins>All declarations of the same object shall have consistent sets
> of alignment specifiers.</ins>

Modify a bullet point in 6.2.7 (Compatible type and composite type):

> - <del>if one member of the pair is declared with an alignment
>   specifier, the other is declared with an equivalent alignment
>   specifier</del> <ins>the members of each pair have equivalent
>   sets of alignment specifiers</ins>;

Modify the definition of "common initial sequence" in 6.5.3.4
(Structure and union members):

> Two structures share a *common initial sequence* if corresponding
> members have compatible types (and, for bit-fields, the same
> widths)<ins>, and equivalent sets of alignment specifiers,</ins> for
> a sequence of one or more initial members.

Modify the rules for tentative definitions in 6.9.3 (External object
definitions):

> If a translation unit contains one or more tentative definitions for
> an identifier, and the translation unit contains no external
> definition for that identifier, then the behavior is exactly as if
> the translation unit contains a file scope declaration of that
> identifier with an empty initializer<ins>, with equivalent alignment
> specifiers to the tentative definitions,</ins> and a type determined
> as follows:

### Suggested correction (C2Y, N3998 draft)

Insert new Constraints paragraphs in 6.7.6 (Alignment specifier),
after the paragraph describing valid constant expressions in an
alignment specifier, the same as for C23 (see above).

In addition to the Constraints changes for C23, replace the last
paragraph of Constraints in 6.7.6 (Alignment specifier):

> <del>If the definition of an object has an alignment specifier, any
> other declaration of that object in the same translation unit shall
> either specify equivalent alignment or have no alignment
> specifier. If the definition of an object does not have an alignment
> specifier, any other declaration of that object in the same
> translation unit shall also have no alignment specifier.</del>

> <ins>If an object is declared in a scope where a prior declaration
> of that object is visible, the two declarations shall have
> consistent sets of alignment specifiers.</ins>

Replace the last paragraph of Semantics in 6.7.6 (Alignment
specifier):

> <del>If the definition of an object has an alignment specifier, no
> declaration of the object in a different translation unit shall
> specify a stricter alignment.</del>

> <ins>All declarations of the same object shall have consistent sets
> of alignment specifiers.</ins>

The changes to 6.2.7 (Compatible type and composite type), 6.5.3.4
(Structure and union members) and 6.9.3 (External object
definitions) are the same as for C23, so are not repeated here.

-- 
Joseph S. Myers
josmyers@redhat.com

