From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by sourceware.org (Postfix) with ESMTPS id 6B35A3858D28 for ; Mon, 28 Aug 2023 11:40:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6B35A3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-58dfe2d5b9aso42742917b3.1 for ; Mon, 28 Aug 2023 04:40:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693222852; x=1693827652; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9kLDek6rTtjhc6OgnX07j3j3zBhAPaVZMgw7x1dkhgE=; b=gd0gPPk8pe4k4HUe/oC0yJKNbDD+dYhiagIwAyo6NsDZOrBNtYKjso8tLtGfPUnzj1 diI8zoRQQ1RIjjB+bqCIhFTpmArHB5JLQY8qPszImSAwyW90WyxMhYAVFS8dfy8oroRN ij8E9AUlGsC1CQ01GiIleLv9ivGU6kb5fifQHHMPvKYTeezvEcsPPYnyQdbdZZpKuT4r emrjGZlFJ7Vu+KPeg23T6q+IHzBt7cdq41EOliGVX847lbiczBrN81cLKkgVOAADRdbC GtQy4rv/eX7SQWU5WxNzCDed4zgRz4znqg8NS5MLken2T+aIvHlToGAWKiYD1A4MyOPs x6pQ== X-Gm-Message-State: AOJu0Yxfrqc/C6kTmlV5tK1zeXJGhr+zpDgQ6q6CWqWVavgUyPHgMyFr 70K3GC+5fVVKpRH65eTDshv7OD0UCdEH/g== X-Google-Smtp-Source: AGHT+IESXsFVVufc8u2KpHM9vZthwJ1Y+fvBD3uJt24x0W2y9wUG6Y7WcXEnnXubUQ9iZNpIbjrYyw== X-Received: by 2002:a81:9195:0:b0:583:8c61:de8 with SMTP id i143-20020a819195000000b005838c610de8mr24640846ywg.16.1693222852622; Mon, 28 Aug 2023 04:40:52 -0700 (PDT) Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com. [209.85.219.177]) by smtp.gmail.com with ESMTPSA id i129-20020a819187000000b0058c4e33b2d6sm2088107ywg.90.2023.08.28.04.40.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Aug 2023 04:40:52 -0700 (PDT) Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-d7766072ba4so5582003276.1 for ; Mon, 28 Aug 2023 04:40:52 -0700 (PDT) X-Received: by 2002:a25:f81b:0:b0:d4b:f497:c869 with SMTP id u27-20020a25f81b000000b00d4bf497c869mr22123150ybd.8.1693222851829; Mon, 28 Aug 2023 04:40:51 -0700 (PDT) MIME-Version: 1.0 References: <10cbcb8a65639f88e7eeb503fd02df172bc46a07.camel@physik.fu-berlin.de> <80a52487-3105-ed5b-a1eb-ec1a0689ef21@linux-m68k.org> <751c83150533b701d66ac24c8fe81863cf5eab98.camel@aura-online.co.uk> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 28 Aug 2023 13:40:39 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Tuple and changes for m68k with -malign-int To: Richard Cc: debian-68k@lists.debian.org, James Le Cuirot , Finn Thain , John Paul Adrian Glaubitz , libc-help@sourceware.org, linux-m68k Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Richard, On Mon, Aug 28, 2023 at 1:27=E2=80=AFPM Richard wrote: > On August 28, 2023 7:00:07 AM UTC, Geert Uytterhoeven wrote: > >On Sun, Aug 27, 2023 at 11:36=E2=80=AFAM James Le Cuirot > > wrote: > >> On Sun, 2023-08-27 at 10:46 +1000, Finn Thain wrote: > >> > Moreover, why is it that only a few developers have a problem with m= aking > >> > explicit their decisions regarding alignment of shorts? What actual = pain > >> > does it cause them to accept a patch to make their struct layouts pl= ain? > >> > >> Some projects do accept patches. Yann Collet was even kind enough to f= ix this > >> in zstd themselves. On the other hand, we have had to fight to stop Py= thon > >> from dropping m68k support entirely. The real problem is the effort re= quired > >> to produce these patches. I haven't been able to wrap my head around t= his so > >> far, but I would still like to learn. I could see myself eventually fi= xing > >> mold, but LLVM feels like a very tall order. > > > >Perhaps we need a new compiler warning: "hole in structure due to > >non-natural alignment, please consider adding explicit padding"? > > Sounds reasonable but I am afraid in 99% of cases this would be completel= y irrelevant and not break anything so the acceptance would be pretty low. > > The problem arises only when people start doing "strange" things with suc= h structs. Can we define strange things in a better way? It appears to me a= ll modern c standards somewhat lack an attribute to mark a struct as being = "special use" and thus emit more warnings and avoid some kinds of trickery. Do you consider struct foo { short x; int y; } bar; a "strange" thing? In se it's not strange. Unless someone starts doing: assert(sizeof(struct foo) =3D=3D 8); or: write(fd, &bar, sizeof(bar)); and expects this to be portable/interoperable (ignoring endianness for now). IIRC, there are similar issues with the alignment of long long and double on some 32-bit platforms, where they would not be aligned naturally. In Linux userspace APIs, we always[*] use natural alignment and explicit padding. [*] try to. Gr{oetje,eeting}s, Geert --=20 Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k= .org In personal conversations with technical people, I call myself a hacker. Bu= t when I'm talking to journalists I just say "programmer" or something like t= hat. -- Linus Torvalds