From patchwork Wed Feb 17 13:31:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Sidwell X-Patchwork-Id: 1441245 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=e6SsRYVP; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dgdyh6lf2z9sBJ for ; Thu, 18 Feb 2021 00:31:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E1B5B3939C0D; Wed, 17 Feb 2021 13:31:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) by sourceware.org (Postfix) with ESMTPS id D6A08389850A for ; Wed, 17 Feb 2021 13:31:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D6A08389850A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=acm.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=nathanmsidwell@gmail.com Received: by mail-qv1-xf32.google.com with SMTP id 2so6238316qvd.0 for ; Wed, 17 Feb 2021 05:31:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=HgeIUtRPzbLhQd9vE/jZ0ARANbFuP+tbwqbKXDjQ8Hw=; b=e6SsRYVPoI8dVCAuziID9xfFKelwl6ml6rei/q/3aYt34eo6F6MfUaECP8YXvzCr0q MxGe36P9ezaySL0Ht+AKRsSdJZz2EWYNZf4mLmxsm+3dOyfiwNgc7AtZTZr74gKu7eoQ rz8ZHdjfUtVQXVsj8Y8k9i+2KQFIrPXOWP9xB+hWIdciXnD3rinDv1nQAryn8fO7JWu3 JIHO47PwnBNtOVoIBt7NSuj+hkRBYhhSPX/9oLyybltR91ieXjCcUgG53XFeCquQtW10 SdsB18aByRg841qReelK4d6cco5pyP/ul8JpP3TsR/NQj7/fsOfTJZlxpHEZt+Njlcm8 BOEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:to:from:subject:message-id:date :user-agent:mime-version:content-language; bh=HgeIUtRPzbLhQd9vE/jZ0ARANbFuP+tbwqbKXDjQ8Hw=; b=pyNjCCxTDLskK5Z7l9Oid8SuRC+ZVyB4Q8EeJYGSju/46x/59/8KeJ54XRk5MXY/uR wlMySUL5PevqiNe+Xi/jJ3Bfg41VLDUu+SUYbAntQwRySKTj2MJSO7R1qT9/2Y5wfvW0 0bEpPYwizzfUlm+u95/ctJgsaJnw8HEaERC6bi3L9JYGIblQbDACmfjY7e/sAPGZ6f8w HN6v12dFv00Gv3JS8kTOZZLhXOGyYxjuh15+h4EZHKeCdiWC/tP75QwRZNMB760vo6Ha 320G/GBcYxtYvrIeefPbBqlovcJWOcZQ5Qj1vDgnXrMN5HNsaJVc9QwdtlK1OJ4gKte3 U6og== X-Gm-Message-State: AOAM532oKUU4kaEpMgaYlUtCa0ss8pAoMGUROm1Ko1gfZLiaHHwrr1Ti P+9gl28wLJbs1x4QhaKK6js= X-Google-Smtp-Source: ABdhPJxE3omAorTy1RYxpE8p+2tPDp2aGRW3kQn4m1hD7zE9JIz77u02rM7LawMBbMtWz22+kqKCiw== X-Received: by 2002:a0c:b7a3:: with SMTP id l35mr24328090qve.46.1613568663374; Wed, 17 Feb 2021 05:31:03 -0800 (PST) Received: from ?IPv6:2620:10d:c0a8:1102:a074:e186:6b89:877d? ([2620:10d:c091:480::1:6fa]) by smtp.googlemail.com with ESMTPSA id s40sm1162335qtb.93.2021.02.17.05.31.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Feb 2021 05:31:02 -0800 (PST) To: GCC Patches From: Nathan Sidwell Subject: c++: ICE with header-units [PR 99071] Message-ID: Date: Wed, 17 Feb 2021 08:31:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This ICE was caused by dereferencing the wrong pointer and not finding the expected thing there. Pointers are like that. PR c++/99071 gcc/cp/ * name-lookup.c (maybe_record_mergeable_decl): Deref the correct pointer. gcc/testsuite/ * g++.dg/modules/pr99071_a.H: New. * g++.dg/modules/pr99071_b.H: New. diff --git c/gcc/cp/name-lookup.c w/gcc/cp/name-lookup.c index 5aa206d40d4..fda987e9616 100644 --- c/gcc/cp/name-lookup.c +++ w/gcc/cp/name-lookup.c @@ -3525,7 +3525,7 @@ maybe_record_mergeable_decl (tree *slot, tree name, tree decl) if (!partition) { binding_slot &orig - = BINDING_VECTOR_CLUSTER (*gslot, 0).slots[BINDING_SLOT_CURRENT]; + = BINDING_VECTOR_CLUSTER (*slot, 0).slots[BINDING_SLOT_CURRENT]; if (!STAT_HACK_P (tree (orig))) orig = stat_hack (tree (orig)); diff --git c/gcc/testsuite/g++.dg/modules/pr99071_a.H w/gcc/testsuite/g++.dg/modules/pr99071_a.H new file mode 100644 index 00000000000..44bc7c43601 --- /dev/null +++ w/gcc/testsuite/g++.dg/modules/pr99071_a.H @@ -0,0 +1,6 @@ +// PR 99071 ICE with global-module merging +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +template +void begin (T *); diff --git c/gcc/testsuite/g++.dg/modules/pr99071_b.H w/gcc/testsuite/g++.dg/modules/pr99071_b.H new file mode 100644 index 00000000000..1c773d74f12 --- /dev/null +++ w/gcc/testsuite/g++.dg/modules/pr99071_b.H @@ -0,0 +1,8 @@ +// PR 99071 ICE with global-module merging +// { dg-additional-options -fmodule-header } +// { dg-module-cmi {} } + +import "pr99071_a.H"; + +template +void begin(T &);