From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by sourceware.org (Postfix) with ESMTPS id 931853858CD1 for ; Thu, 23 May 2024 21:54:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 931853858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=golang.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=golang.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 931853858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1135 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716501243; cv=none; b=knoSSO8av4JSHpxrB5WUE9eL6T5YmWoNi2J6gK5Z596Xqqz1hPChlggGWYsrpBPsVnMsm68rq7MnagbwDwdgaaPAag2XgzqZSEsZk/iYpNd/OByCMRC1C8mJxAJcv+AhF1QF4+PEyF5EU1BHvSIXcIetjHxrtkwsDbv12Sn+5sA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716501243; c=relaxed/simple; bh=FUt5bY086VhkZ3DWUXBJGSBbnzaEdfFT2jlm1q2/P28=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=gLyq5tSsAvYOBknA+7nr43/aCCOsIqaZHceMQ5bbKueg0i1JiBeoXAhRHZXMNYtIW6m68Decs7PupWPZwI51XjnbmCGF6utE/JDDKByaHWzGipBNujnkdyxZYDCteZZJh8iMrqPMUlK1AXL0aZ1t1qrtpe4vUMqRfuzEExfT2o0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-627f46fbe14so19972717b3.2 for ; Thu, 23 May 2024 14:54:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20230601.gappssmtp.com; s=20230601; t=1716501241; x=1717106041; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jArz+ZaJiYiRFfq7xMyrCR+iMVa2YKmep3KBim3tWgM=; b=QUhQr7ziaTr49+4nHf2cEliR44BQQRkQM2h7Dze839Vp77D7dGMUY0TsZBRa9mcHkI D94PSzB2HJBPsDpweryL4za9OsY1ndUCpI1zbGXgYFVsUXvoYC+xAM3uIjpyFYofAUcG xYQS1IV3MWGCxPQo+5cYp47it1TBJMunXg9rxUlmGoozkFR2zrfEzZ415fJ9A+NK0l2h VhSMuhivuNtBh7iv0nd4G3r4JAoi0t8k9cLjlI3jUnIY6iuIPcXTDHF/Xek/aJiptOQq t67c9//MymyHOqzGlfUJaJ3IG0VWcBu7jWx+wReWcUj0B8jIV+BzQuRAo6jQOVQqc5g2 mdng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716501241; x=1717106041; 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=jArz+ZaJiYiRFfq7xMyrCR+iMVa2YKmep3KBim3tWgM=; b=vVu8vfriSFc8waNCrxHyLhmHUf1R2WIrwHhhYByXJ2oCNyLeSP4/0WW6lbsWMVpHPR nshivCmW09za71/H6fe/v4NMo0J5pBRmXK34ZnJ9oEk77ziLV9Jw1zlUj4PqO7cTcb2C A6IyokqbCSnAHUHNfsS6X8TjNGxO8+U2b7CxU9iLmSXJq9VkpCZgTbprGrikJJvIdEQM kz1CFCiLfDYssGjygrFtTSaTP0oPKLkxfuV3umQGNiSJ9sysvoswwzWh1GCL7I5GRYP4 gdAd/ib3H4JXda75CMA6WtMB8k7d5lCi4qJ9/I+d4qHELXkxlnRKGLYTGgD/g840m8PB mj9Q== X-Forwarded-Encrypted: i=1; AJvYcCXSANJkvWZqEQamEZNy67Lp8vN+gMXxKnJrX2mFaIWExm6zNVOkWEeTjNmmFAmYFG6Pu9BnOwvKbddA7p7u7DzTxbIlGsbU/g== X-Gm-Message-State: AOJu0YzJVH0FcvJMwCMxIag/9Z7kBV6iH5taB/v6Q71wXvCJCpSD8+CS hS8VIwaoOYclHGgD+ph8dQ6fW3kP0Rs/KU+wrMRGEJoSoBPFhHtRWkGPkG9pvgDsHI+YDJ/MNkc zk7Vfkh6T9yzUKDvEeKBmrMeaSakmfB6X4gnwjw== X-Google-Smtp-Source: AGHT+IGoPnxe5L8RZnM+4OGTteXPXcs4wQNP0A5VYIz/c2IJojwn3+RAwx18a5jTP2/4Ws8sXcabwxvn6LkBBjPLamQ= X-Received: by 2002:a0d:db97:0:b0:618:83a4:588e with SMTP id 00721157ae682-62a08f4470emr4409067b3.37.1716501240740; Thu, 23 May 2024 14:54:00 -0700 (PDT) MIME-Version: 1.0 References: <02a9b94e4d653b6f1b9f89a1b62187f46e871738.camel@tugraz.at> <45067a3258e0ec1677ed95f62ac21c1353d66355.camel@tugraz.at> <65955827-eccc-acd0-c8f6-dfd2aaae2cbf@redhat.com> In-Reply-To: From: Ian Lance Taylor Date: Thu, 23 May 2024 14:53:49 -0700 Message-ID: Subject: Re: [C PATCH]: allow aliasing of compatible types derived from enumeral types [PR115157] To: Martin Uecker Cc: Joseph Myers , gcc-patches@gcc.gnu.org, Richard Biener , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, May 23, 2024 at 2:48=E2=80=AFPM Martin Uecker wr= ote: > > Am Donnerstag, dem 23.05.2024 um 14:30 -0700 schrieb Ian Lance Taylor: > > On Thu, May 23, 2024 at 2:00=E2=80=AFPM Joseph Myers wrote: > > > > > > On Tue, 21 May 2024, Martin Uecker wrote: > > > > > > > > C: allow aliasing of compatible types derived from enumeral typ= es [PR115157] > > > > > > > > Aliasing of enumeral types with the underlying integer is now a= llowed > > > > by setting the aliasing set to zero. But this does not allow a= liasing > > > > of derived types which are compatible as required by ISO C. In= stead, > > > > initially set structural equality. Then set TYPE_CANONICAL and= update > > > > pointers and main variants when the type is completed (as done = for > > > > structures and unions in C23). > > > > > > > > PR 115157 > > > > > > > > gcc/c/ > > > > * c-decl.cc (shadow_tag-warned,parse_xref_tag,start_enu= m, > > > > finish_enum): Set SET_TYPE_STRUCTURAL_EQUALITY / TYPE_C= ANONICAL. > > > > * c-obj-common.cc (get_alias_set): Remove special case. > > > > (get_aka_type): Add special case. > > > > > > > > gcc/ > > > > * godump.cc (go_output_typedef): use TYPE_MAIN_VARIANT = instead > > > > of TYPE_CANONICAL. > > > > > > > > gcc/testsuite/ > > > > * gcc.dg/enum-alias-1.c: New test. > > > > * gcc.dg/enum-alias-2.c: New test. > > > > * gcc.dg/enum-alias-3.c: New test. > > > > > > OK, in the absence of objections on middle-end or Go grounds within t= he > > > next week. > > > > The godump.cc patch is > > > > && (TYPE_CANONICAL (TREE_TYPE (decl)) =3D=3D NULL_TREE > > || !container->decls_seen.contains > > - (TYPE_CANONICAL (TREE_TYPE (decl)))= )) > > + (TYPE_MAIN_VARIANT (TREE_TYPE (decl= ))))) > > { > > > > What is the problem you are seeing? > > Test failures in godump-1.c > > > > > This patch isn't right: > > > > 1) The code is saying if "X =3D=3D NULL_TREE || !already_seen(X)". Thi= s > > patch is changing the latter X but not the former. They should be > > consistent. > > Maybe the X =3D=3D NULL_TREE can be removed if we > add TYPE_MAIN_VARIANTs instead? If TYPE_MAIN_VARIANT is never NULL_TREE, then I agree that the NULL_TREE test can be removed. Ian