public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c
@ 2020-06-24 15:30 viktor.rosendahl at bmw dot de
  2020-06-24 16:46 ` [Bug c++/95870] " mpolacek at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: viktor.rosendahl at bmw dot de @ 2020-06-24 15:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

            Bug ID: 95870
           Summary: ICE(segmentation fault) in most_general_template(), in
                    gcc/cp/pt.c
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: viktor.rosendahl at bmw dot de
  Target Milestone: ---

Created attachment 48780
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48780&action=edit
Selfcontained example (preprocessed cource code)

I can reproduce this bug with the following gcc versions:
9.3.0
10.1.0
11.0.0 20200624 (experimental) [this was built with revision eb0ff770e29 from
git://gcc.gnu.org/git/gcc.git, which was the tip of the master branch on 24th
of June, 2020]

The bug does not happen with:
7.5.0

I have not tested any 8.x version.

All compilers were built from pristine sources, no patches added.

My system is a x86_64 machine with Ubuntu 18.04.4 LTS.

I configured all compiler builds like this:
./configure --disable-multilib --prefix=/home/viktor/gcc-bin-9.3.0
--enable-languages=c,c++

Steps to reproduce:
xz -dc preproc_example4.ii.xz > preproc_example4.ii
g++  -c -pipe -O2 -Wall -std=c++17 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG
-DQT_GUI_LIB -DQT_CORE_LIB  -o obj/example4.o preproc_example4.ii

I get the following output (with gcc-9.3.0):
example4.cpp: In instantiation of ‘BungleFooBar<U, V>::BungleFooBar() [with U =
FailFoo; V = BotchFoo]’:
example4.cpp:44:22:   required from here
example4.cpp:17:5: internal compiler error: Segmentation fault
   17 |     MACRO_FOOBAR(foofoobar, bar);
      |     ^
0xb8ff1f crash_signal
        ../.././gcc/toplev.c:326
0x6e4260 most_general_template(tree_node*)
        ../.././gcc/cp/pt.c:23652
0x6e457d enclosing_instantiation_of
        ../.././gcc/cp/pt.c:13424
0x701c53 tsubst_function_decl
        ../.././gcc/cp/pt.c:12943
0x6fe2b8 tsubst_decl
        ../.././gcc/cp/pt.c:13464
0x6f9ee7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:14365
0x70263a lookup_template_class_1
        ../.././gcc/cp/pt.c:9483
0x70263a lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../.././gcc/cp/pt.c:9771
0x700e5d tsubst_aggr_type
        ../.././gcc/cp/pt.c:12764
0x6f9cbf tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:14447
0x6fe940 tsubst_decl
        ../.././gcc/cp/pt.c:13731
0x6f9ee7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:14365
0x6f42ce tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17173
0x6f2378 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17088
0x6f24ec tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17389
0x6f24ec tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17389
0x6f5885 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../.././gcc/cp/pt.c:17073
0x6f5885 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ../.././gcc/cp/pt.c:18301
0x6f7775 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../.././gcc/cp/pt.c:19666
0x6f618e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../.././gcc/cp/pt.c:18918
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
@ 2020-06-24 16:46 ` mpolacek at gcc dot gnu.org
  2020-06-24 16:46 ` mpolacek at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 16:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed, don't see any existing PRs for this.

Going to bisect + reduce.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
  2020-06-24 16:46 ` [Bug c++/95870] " mpolacek at gcc dot gnu.org
@ 2020-06-24 16:46 ` mpolacek at gcc dot gnu.org
  2020-06-24 17:22 ` mpolacek at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 16:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-06-24
     Ever confirmed|0                           |1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
  2020-06-24 16:46 ` [Bug c++/95870] " mpolacek at gcc dot gnu.org
  2020-06-24 16:46 ` mpolacek at gcc dot gnu.org
@ 2020-06-24 17:22 ` mpolacek at gcc dot gnu.org
  2020-06-24 17:23 ` mpolacek at gcc dot gnu.org
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 17:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Looks like it started with r251433.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (2 preceding siblings ...)
  2020-06-24 17:22 ` mpolacek at gcc dot gnu.org
@ 2020-06-24 17:23 ` mpolacek at gcc dot gnu.org
  2020-06-24 18:05 ` [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation " mpolacek at gcc dot gnu.org
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 17:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Reduced, but invalid:

template <typename> class a {
public:
  a();
  int b = [] { enum E {}; };
};
class c : a<int> {
  c();
};
template <typename d> a<d>::a() = default;
c::c() {}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (3 preceding siblings ...)
  2020-06-24 17:23 ` mpolacek at gcc dot gnu.org
@ 2020-06-24 18:05 ` mpolacek at gcc dot gnu.org
  2020-10-12 12:52 ` rguenth at gcc dot gnu.org
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 18:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5
           Keywords|                            |ice-on-valid-code
            Summary|ICE(segmentation fault) in  |[8/9/10/11 Regression] ICE
                   |most_general_template(), in |(segmentation fault) in
                   |gcc/cp/pt.c                 |most_general_template(), in
                   |                            |gcc/cp/pt.c

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Valid code that ICEs:

template <typename> struct S {
  S();
  int b = []() -> int { enum E {}; return 1; }();
};
struct C : S<int> {
  C();
};
template <typename T> S<T>::S() = default;
C::C() {}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (4 preceding siblings ...)
  2020-06-24 18:05 ` [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation " mpolacek at gcc dot gnu.org
@ 2020-10-12 12:52 ` rguenth at gcc dot gnu.org
  2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-12 12:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (5 preceding siblings ...)
  2020-10-12 12:52 ` rguenth at gcc dot gnu.org
@ 2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
  2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-12  0:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |public at enkore dot de

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 97372 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (6 preceding siblings ...)
  2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
@ 2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
  2021-04-05 13:53 ` jason at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-12  0:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Valid test from bug 97372:

class Lockable {
public:
  Lockable(int *);
};
template <typename> class ThreadTask2 {
  Lockable _state_mutex{[]() -> int * { static int srcloc; return 0; }()};
public:
  ThreadTask2() {}
};
void x() { ThreadTask2<int> foo; }

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (7 preceding siblings ...)
  2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
@ 2021-04-05 13:53 ` jason at gcc dot gnu.org
  2021-04-05 13:53 ` viktor.rosendahl at bmw dot de
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-05 13:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (8 preceding siblings ...)
  2021-04-05 13:53 ` jason at gcc dot gnu.org
@ 2021-04-05 13:53 ` viktor.rosendahl at bmw dot de
  2021-04-05 19:39 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: viktor.rosendahl at bmw dot de @ 2021-04-05 13:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #7 from Viktor Rosendahl <viktor.rosendahl at bmw dot de> ---
Thanks for your message. I am on vacation. I will be working again on 6th of
April 2021.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (9 preceding siblings ...)
  2021-04-05 13:53 ` viktor.rosendahl at bmw dot de
@ 2021-04-05 19:39 ` cvs-commit at gcc dot gnu.org
  2021-04-05 21:30 ` [Bug c++/95870] [8/9/10 " jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-05 19:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:62d60246e53778db6ee613377dd013ba4b264968

commit r11-7992-g62d60246e53778db6ee613377dd013ba4b264968
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 5 11:34:48 2021 -0400

    c++: lambda in DMI in class template [PR95870]

    Here enclosing_instantiation_of was failing to find a match because otctx
is
    struct S<T> and current_function_decl is S<int>::S(), so the latter has
more
    function contexts, and we end up trying to compare S() to NULL_TREE.

    After spending a bit of time working on establishing the correspondence in
    this case (class <=> constructor), it occurred to me that we could just use
    DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
    redeclared.  Since we're so close to release, for now I'm only doing this
    for the case that was failing before.

    gcc/cp/ChangeLog:

            PR c++/95870
            * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION
if
            there is no enclosing non-lambda function.

    gcc/testsuite/ChangeLog:

            PR c++/95870
            * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [8/9/10 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (10 preceding siblings ...)
  2021-04-05 19:39 ` cvs-commit at gcc dot gnu.org
@ 2021-04-05 21:30 ` jason at gcc dot gnu.org
  2021-05-14  9:53 ` [Bug c++/95870] [9/10 " jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-05 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.0
            Summary|[8/9/10/11 Regression] ICE  |[8/9/10 Regression] ICE
                   |(segmentation fault) in     |(segmentation fault) in
                   |most_general_template(), in |most_general_template(), in
                   |gcc/cp/pt.c                 |gcc/cp/pt.c

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11 so far.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [9/10 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (11 preceding siblings ...)
  2021-04-05 21:30 ` [Bug c++/95870] [8/9/10 " jason at gcc dot gnu.org
@ 2021-05-14  9:53 ` jakub at gcc dot gnu.org
  2021-05-14 16:11 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [9/10 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (12 preceding siblings ...)
  2021-05-14  9:53 ` [Bug c++/95870] [9/10 " jakub at gcc dot gnu.org
@ 2021-05-14 16:11 ` cvs-commit at gcc dot gnu.org
  2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-14 16:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:2f1bb00ba340e53663651be7874011fd54e1d085

commit r12-804-g2f1bb00ba340e53663651be7874011fd54e1d085
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 5 11:47:50 2021 -0400

    c++: simplify enclosing_instantiation_of [PR95870]

    Comparing DECL_SOURCE_LOCATION like the GCC 11 patch for PR 95870 will also
    work for user-defined functions, if we update their location when
    instantiating.  Another option would be to use LAMBDA_EXPR_REGEN_INFO for
    lambdas, but this way is even simpler.

    gcc/cp/ChangeLog:

            PR c++/95870
            * pt.c (enclosing_instantiation_of): Just compare
            DECL_SOURCE_LOCATION.
            (regenerate_decl_from_template): Copy DECL_SOURCE_LOCATION.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [9/10 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (13 preceding siblings ...)
  2021-05-14 16:11 ` cvs-commit at gcc dot gnu.org
@ 2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
  2021-06-01  8:17 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 21:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:ff24ef677edee888012aaddeb0ec9bbe366b4f57

commit r10-9845-gff24ef677edee888012aaddeb0ec9bbe366b4f57
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 5 11:34:48 2021 -0400

    c++: lambda in DMI in class template [PR95870]

    Here enclosing_instantiation_of was failing to find a match because otctx
is
    struct S<T> and current_function_decl is S<int>::S(), so the latter has
more
    function contexts, and we end up trying to compare S() to NULL_TREE.

    After spending a bit of time working on establishing the correspondence in
    this case (class <=> constructor), it occurred to me that we could just use
    DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
    redeclared.  Since we're so close to release, for now I'm only doing this
    for the case that was failing before.

    gcc/cp/ChangeLog:

            PR c++/95870
            * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION
if
            there is no enclosing non-lambda function.

    gcc/testsuite/ChangeLog:

            PR c++/95870
            * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [9/10 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (14 preceding siblings ...)
  2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
@ 2021-06-01  8:17 ` rguenth at gcc dot gnu.org
  2022-05-13 17:41 ` [Bug c++/95870] [9 " cvs-commit at gcc dot gnu.org
  2022-05-13 17:46 ` jason at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [9 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (15 preceding siblings ...)
  2021-06-01  8:17 ` rguenth at gcc dot gnu.org
@ 2022-05-13 17:41 ` cvs-commit at gcc dot gnu.org
  2022-05-13 17:46 ` jason at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-13 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:cf475f6e23581b1766e508dba81171de8f81b180

commit r9-10166-gcf475f6e23581b1766e508dba81171de8f81b180
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Apr 5 11:34:48 2021 -0400

    c++: lambda in DMI in class template [PR95870]

    Here enclosing_instantiation_of was failing to find a match because otctx
is
    struct S<T> and current_function_decl is S<int>::S(), so the latter has
more
    function contexts, and we end up trying to compare S() to NULL_TREE.

    After spending a bit of time working on establishing the correspondence in
    this case (class <=> constructor), it occurred to me that we could just use
    DECL_SOURCE_LOCATION, which is unique for lambdas, since they cannot be
    redeclared.  Since we're so close to release, for now I'm only doing this
    for the case that was failing before.

    gcc/cp/ChangeLog:

            PR c++/95870
            * pt.c (enclosing_instantiation_of): Compare DECL_SOURCE_LOCATION
if
            there is no enclosing non-lambda function.

    gcc/testsuite/ChangeLog:

            PR c++/95870
            * g++.dg/cpp0x/lambda/lambda-nsdmi10.C: New test.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [Bug c++/95870] [9 Regression] ICE (segmentation fault) in most_general_template(), in gcc/cp/pt.c
  2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
                   ` (16 preceding siblings ...)
  2022-05-13 17:41 ` [Bug c++/95870] [9 " cvs-commit at gcc dot gnu.org
@ 2022-05-13 17:46 ` jason at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-13 17:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95870

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #15 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 9.5/10.4/11.

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2022-05-13 17:46 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 15:30 [Bug c++/95870] New: ICE(segmentation fault) in most_general_template(), in gcc/cp/pt.c viktor.rosendahl at bmw dot de
2020-06-24 16:46 ` [Bug c++/95870] " mpolacek at gcc dot gnu.org
2020-06-24 16:46 ` mpolacek at gcc dot gnu.org
2020-06-24 17:22 ` mpolacek at gcc dot gnu.org
2020-06-24 17:23 ` mpolacek at gcc dot gnu.org
2020-06-24 18:05 ` [Bug c++/95870] [8/9/10/11 Regression] ICE (segmentation " mpolacek at gcc dot gnu.org
2020-10-12 12:52 ` rguenth at gcc dot gnu.org
2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
2021-03-12  0:37 ` mpolacek at gcc dot gnu.org
2021-04-05 13:53 ` jason at gcc dot gnu.org
2021-04-05 13:53 ` viktor.rosendahl at bmw dot de
2021-04-05 19:39 ` cvs-commit at gcc dot gnu.org
2021-04-05 21:30 ` [Bug c++/95870] [8/9/10 " jason at gcc dot gnu.org
2021-05-14  9:53 ` [Bug c++/95870] [9/10 " jakub at gcc dot gnu.org
2021-05-14 16:11 ` cvs-commit at gcc dot gnu.org
2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
2021-06-01  8:17 ` rguenth at gcc dot gnu.org
2022-05-13 17:41 ` [Bug c++/95870] [9 " cvs-commit at gcc dot gnu.org
2022-05-13 17:46 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).