From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id CDD2D21285 for ; Sun, 21 Apr 2024 21:04:46 +0200 (CEST) Received: (qmail 11413 invoked by uid 550); 21 Apr 2024 19:04:41 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 11377 invoked from network); 21 Apr 2024 19:04:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mforney.org; s=google; t=1713726272; x=1714331072; darn=lists.openwall.com; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:references:from:subject:to:date:from:to:cc:subject:date :message-id:reply-to; bh=ddMq6r1q7GLSOoPJOioru+iK02ZFiPHNBpWeaDZrbbs=; b=qvAqkgzc7zg6NWXuaH/GgJ9Ov9kp+FkBRVQ3VY66K6bMgOfYPorTva/WJNKTFOp6R2 4h9hnu3BY5YqU7kJJtLuibgqhaFe/5N25wBoOY96ziZSVtfHEzQg2NmfZy7HTMTuMNhc Ztr59yYRFhsEcmUj7xqitCiiXfYx+61NBIhRt1pjCT7g/uSzN0MRCnuADLjgaeaFd54d NKaT0HjtIIaEAl/1x80DXXjR4izqCSrm5lMymNp2cCwkpnqEihJW+3vtypYW7Ninw6oH 5cZjQ0/rarpwaSPDi4dnYE328MgbVbHBpsQNapujDVGf5fAt8AhDVZUaeX5bxWZnmVh7 bGOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713726272; x=1714331072; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:references:from:subject:to:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ddMq6r1q7GLSOoPJOioru+iK02ZFiPHNBpWeaDZrbbs=; b=YNE2ZDP2Vyt+hA3wMcTBsqH+WVENvB3RaqAas4jW7jApIbXCf9pBTzI16QjHYPlPco bk8TXyw/GqNUh8oqzLXOHH9Hpd4yB/Tq5HZ+A7QtwVrM+eGCxohmxN/7Khq51YcexUqr b6IOGQ9DwpQOP+Wi5/hbHkCAWs3dwp0w/aM8rF7mMW58YNmIhjS59mtahfA2fi5sbmcx /RpX5HqhU5Og6xez/OCF4qQiC82rG614Fy42PUUEAZdBOXlitBHY2lnMPDxqBn1Pudd5 gdszG8SvYu7ftXXy8Eu186S21eKLWIKQV3K2YmOtzoE4SsJR5aWvDlc0l1FMpkifjysz BURg== X-Gm-Message-State: AOJu0YwlcYUy28lidijZt81eFKa8OEgAZ+0uox9TVxTelh8MQ8cinp0/ lV2QaswATwQlYeU5ZGtNhFd3cHjaN/rG3xco71fEMY+xIdJLeG7A1jEwhuzCm/2l8dzG3IEX6qS UgTE= X-Google-Smtp-Source: AGHT+IE+O1ZLPcE0mo7I0MEgJZezPzzp0H7gKhaamLtgbHqQUS2aBhwEpsUltIFRWcvWiYhMR34yRg== X-Received: by 2002:a05:6a20:dca0:b0:1a8:367c:9b73 with SMTP id ky32-20020a056a20dca000b001a8367c9b73mr9338783pzb.59.1713726272097; Sun, 21 Apr 2024 12:04:32 -0700 (PDT) Date: Sun, 21 Apr 2024 12:04:30 -0700 To: musl@lists.openwall.com From: Michael Forney References: <3KDMGHI91MHTL.24XCHF6E4X1XG@mforney.org> In-Reply-To: Message-Id: <3EBS8QD55K8YJ.3M8DNLQQKVDYL@mforney.org> User-Agent: mblaze/1.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [musl] Alignment attribute in headers Markus Wichmann wrote: > Am Sun, Apr 21, 2024 at 03:50:31PM +0000 schrieb Thorsten Glaser: > > I haven=E2=80=99t looked at the C11 one. >=20 > C11's _Alignas can only raise alignment, not lower it. Alignment > specifications with a lower number than the field already has are > ignored. I can't believe the C++ guys screwed up so hard as to make > lower alignment UB. It's true that _Alignas can't lower alignment, but it's not ignored if you specify a weaker alignment, it's a constraint violation: C17 6.7.5p5: > The combined effect of all alignment specifiers in a declaration > shall not specify an alignment that is less strict than the > alignment that would otherwise be required for the type of the > object or member being declared. This doesn't matter for the proposed alignment specifiers since they are in architecture-specific headers where we know that the specified alignment is not less than is required for the type. However, in general, I think Thorsten's concern is valid. If you specify some alignment that your application needs, but the implementation already requires a stricter alignment, your program has an error. You could work around it by specifying two alignment specifiers: _Alignas(N) _Alignas(T) T x; But anyway, this has veered a bit off-topic.