From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3C96E3858CDB for ; Fri, 7 Oct 2022 15:09:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3C96E3858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665155397; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J3vkffE+vcc8M2jaYtzZ7qalyxyYixwiAhCxLbUvfH8=; b=iMxA8FXMM7/lfys2X3SQZJ767sifxyjbKr9m6qh9HgKX0iEcan4G853+qRbm1/9N1f2Fcj vkWpvzHOr5MEmFOJFHIqcPS09nsKoZFiI/NrGLlalnf7JLe6S5f17t4Yn3SS51qvt1bjLQ 0mYNbLYQwmfNoo0Nv3dosgcU6yeOFuQ= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-531-AzLogzq7PZan5_f_gkbmMg-1; Fri, 07 Oct 2022 11:09:56 -0400 X-MC-Unique: AzLogzq7PZan5_f_gkbmMg-1 Received: by mail-qk1-f200.google.com with SMTP id j13-20020a05620a288d00b006be7b2a758fso3937888qkp.1 for ; Fri, 07 Oct 2022 08:09:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=J3vkffE+vcc8M2jaYtzZ7qalyxyYixwiAhCxLbUvfH8=; b=1ngJXhGo0+hYO9qPwLaWMLUCPxkZfu4deGyNfkikZqBp/LZqqUCnVUqIuDNPNYN4Tz /jbioiJGigQv7XpvVPqFu2vDm4fb6pnfrg5fpFbsNgb5Y5OaMIqLYEKtBX47o+m64y/7 xQhbTsGR/F4V1GdhfyFK/CG3CThSzTa7BFJ/i4KbATlh2Yc5rj14UMEWCLsCb0uTo+p8 YfHg1MBy/sDRRwoPbMXFU/nP/9hVFGkXQ2N8yQaG3wqP2L/JsWTpCWsRgrVhh2tWy6IF q5wcZoz7LJiufhSluIruJvOTQBBgdphUEcIj0tlrRFgnsyzqxH47eegHwm6I6S1Ni2S9 e+KA== X-Gm-Message-State: ACrzQf0MUM2hMehKm0QdEklEzL76gNV1LGMf7z/43kCH2qVjEOOzrjbB 1awGQ8pGYJPgn68evClusaqdqcwyTvGrBxJJxB2mT+8l1M7uyLjVsCC6/YXI+AkcEFeB9ryiO3r Pf1FRH69KPZ7BC6O6ZyyV3QQSnKFvBUgIlSS/WhQ2nGrE3rotOHwdxZFOD3lX/K6pzWw= X-Received: by 2002:ae9:f715:0:b0:6e7:73bf:63c9 with SMTP id s21-20020ae9f715000000b006e773bf63c9mr3880448qkg.225.1665155395448; Fri, 07 Oct 2022 08:09:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GLNTGb/bstbSLX4ipSPVqbAfCe7SFaSoCinckQ6Aujn7pwEMePDdtXyDRf8uVzsQwdy2NmA== X-Received: by 2002:ae9:f715:0:b0:6e7:73bf:63c9 with SMTP id s21-20020ae9f715000000b006e773bf63c9mr3880430qkg.225.1665155395141; Fri, 07 Oct 2022 08:09:55 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id f11-20020a05620a280b00b006ce515196a7sm2295911qkp.8.2022.10.07.08.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Oct 2022 08:09:54 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, nathan@acm.org, Patrick Palka Subject: [PATCH] c++ modules: ICE with bitfield member in class template Date: Fri, 7 Oct 2022 11:09:52 -0400 Message-Id: <20221007150952.102429-1-ppalka@redhat.com> X-Mailer: git-send-email 2.38.0.rc2 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,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: According to grokbitfield, DECL_BITFIELD_REPRESENTATIVE may "temporarily" contain the width of the bitfield until we layout the class type (after which it'll contain a FIELD_DECL). But for a class template, it'll always be the width since we don't/can't layout dependent types. Tested on x86_64-pc-linux-gnu, does this look OK for trunk? gcc/cp/ChangeLog: * module.cc (trees_out::mark_class_def): Guard against DECL_BITFIELD_REPRESENTATIVE not being a decl. gcc/testsuite/ChangeLog: * g++.dg/modules/bfield-3.H: New test. --- gcc/cp/module.cc | 3 ++- gcc/testsuite/g++.dg/modules/bfield-3.H | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/modules/bfield-3.H diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index cb1929bc5d5..172a72e92b9 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -11919,7 +11919,8 @@ trees_out::mark_class_def (tree defn) mark_class_member (member); if (TREE_CODE (member) == FIELD_DECL) if (tree repr = DECL_BIT_FIELD_REPRESENTATIVE (member)) - mark_declaration (repr, false); + if (DECL_P (repr)) + mark_declaration (repr, false); } /* Mark the binfo hierarchy. */ diff --git a/gcc/testsuite/g++.dg/modules/bfield-3.H b/gcc/testsuite/g++.dg/modules/bfield-3.H new file mode 100644 index 00000000000..4fd4db7116a --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/bfield-3.H @@ -0,0 +1,8 @@ +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template +struct A { + int x : 1; + int y : N; +}; -- 2.38.0.rc2