public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97582] New: Regression Internal compiler error in lambda
@ 2020-10-26 14:08 benjamin.freist at hexagon dot com
  2020-10-26 14:59 ` [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: benjamin.freist at hexagon dot com @ 2020-10-26 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97582
           Summary: Regression Internal compiler error in lambda
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: benjamin.freist at hexagon dot com
  Target Milestone: ---

Created attachment 49440
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49440&action=edit
ICE can be reproduced with this

This is an ICE that we noticed when upgrading from gcc 7 to 9.
I tried to remove everything that doesn't trigger the bug. The resulting source
file is attached to this report.

The command line to reproduce is g++ -std=c++17 -c crash_obfuscated.cpp

I'm using ubuntu 20.04
lsb_release -a
LSB Version:   
core-11.1.0ubuntu2-noarch:printing-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch

Does not appear on gcc 7.

g++-7 --version
g++-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0

g++-7 -std=c++17 -c ~/Desktop/crash_obfuscated.cpp
works fine

Appears on gcc 9.

g++ --version
g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

g++ -std=c++17 -c ~/Desktop/crash_obfuscated.cpp 
crash_obfuscated.cpp: In instantiation of ‘C5::get()::<lambda(auto:1)> [with
auto:1 = C6]’:
/usr/include/c++/9/bits/predefined_ops.h:283:11:   required from ‘bool
__gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator
= __gnu_cxx::__normal_iterator<C6*, std::vector<C6> >; _Predicate =
C5::get()::<lambda(auto:1)>]’
/usr/include/c++/9/bits/stl_algo.h:120:14:   required from
‘_RandomAccessIterator std::__find_if(_RandomAccessIterator,
_RandomAccessIterator, _Predicate, std::random_access_iterator_tag) [with
_RandomAccessIterator = __gnu_cxx::__normal_iterator<C6*, std::vector<C6> >;
_Predicate = __gnu_cxx::__ops::_Iter_pred<C5::get()::<lambda(auto:1)> >]’
/usr/include/c++/9/bits/stl_algo.h:161:23:   required from ‘_Iterator
std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator =
__gnu_cxx::__normal_iterator<C6*, std::vector<C6> >; _Predicate =
__gnu_cxx::__ops::_Iter_pred<C5::get()::<lambda(auto:1)> >]’
/usr/include/c++/9/bits/stl_algo.h:3963:28:   required from ‘_IIter
std::find_if(_IIter, _IIter, _Predicate) [with _IIter =
__gnu_cxx::__normal_iterator<C6*, std::vector<C6> >; _Predicate =
C5::get()::<lambda(auto:1)>]’
/usr/include/c++/9/bits/stl_algo.h:526:47:   required from ‘bool
std::none_of(_IIter, _IIter, _Predicate) [with _IIter =
__gnu_cxx::__normal_iterator<C6*, std::vector<C6> >; _Predicate =
C5::get()::<lambda(auto:1)>]’
/usr/include/c++/9/bits/stl_algo.h:544:27:   required from ‘bool
std::any_of(_IIter, _IIter, _Predicate) [with _IIter =
__gnu_cxx::__normal_iterator<C6*, std::vector<C6> >; _Predicate =
C5::get()::<lambda(auto:1)>]’
/home/freist@volumegraphics.com/Desktop/crash_obfuscated.cpp:77:6:   required
from here
/home/freist@volumegraphics.com/Desktop/crash_obfuscated.cpp:76:61: internal
compiler error: Segmentation fault
   76 |       return find (v2.begin (), v2.end (), elem.getLink ()) == v2.end
();
      |             
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.

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

* [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
@ 2020-10-26 14:59 ` marxin at gcc dot gnu.org
  2021-01-14  9:31 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-26 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
            Summary|Regression Internal         |[9/10/11 Regression] ICE
                   |compiler error in lambda    |tree check: expected
                   |                            |function_type or
                   |                            |method_type, have
                   |                            |error_mark in
                   |                            |add_function_candidate, at
                   |                            |cp/call.c:2146 since
                   |                            |r9-6405-gbddee796d0b4800b
   Target Milestone|---                         |9.4
   Last reconfirmed|                            |2020-10-26

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r9-6405-gbddee796d0b4800b.

Reduced test-case:

$ cat pr97582.ii
template <typename, typename> class __normal_iterator {};
template <typename _Iterator, typename _Container>
void operator==(__normal_iterator<_Iterator, _Container>,
                __normal_iterator<_Iterator, _Container>);
template <typename _Predicate> struct _Iter_pred {
  _Predicate _M_pred;
  template <typename _Iterator> void operator()(_Iterator __it) {
    _M_pred(__it);
  }
};
template <typename _Predicate> _Iter_pred<_Predicate> __pred_iter(_Predicate)
{}
template <typename _RandomAccessIterator, typename _Predicate>
void __find_if(_RandomAccessIterator __first, _Predicate __pred) {
  __pred(__first);
}
template <typename _InputIterator, typename _Predicate>
void none_of(_InputIterator __last, _Predicate __pred) {
  find_if(__last, __pred);
}
template <typename _InputIterator, typename _Predicate>
void any_of(_InputIterator, _InputIterator __last, _Predicate __pred) {
  none_of(__last, __pred);
}
template <typename _InputIterator, typename _Tp>
_InputIterator find(_InputIterator, _Tp);
template <typename _InputIterator, typename _Predicate>
void find_if(_InputIterator __last, _Predicate __pred) {
  _Iter_pred __trans_tmp_1 = __pred_iter(__pred);
  __find_if(__last, __trans_tmp_1);
}
class C2 {
  void operator==(C2);
};
class C6 {
  void operator==(C6);
};
class C5 : C6, C2 {
  void get() {
    __normal_iterator<C6 *, int> __trans_tmp_2, __trans_tmp_3;
    any_of(__trans_tmp_2, __trans_tmp_3, [](auto elem) {
      __normal_iterator<const int **, int> __trans_tmp_4, __trans_tmp_5;
      find(__trans_tmp_4, elem) == __trans_tmp_5;
    });
  }
};

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

* [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
  2020-10-26 14:59 ` [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b marxin at gcc dot gnu.org
@ 2021-01-14  9:31 ` rguenth at gcc dot gnu.org
  2021-02-02  5:23 ` ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14  9:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
  2020-10-26 14:59 ` [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b marxin at gcc dot gnu.org
  2021-01-14  9:31 ` rguenth at gcc dot gnu.org
@ 2021-02-02  5:23 ` ppalka at gcc dot gnu.org
  2021-02-11 16:00 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-02-02  5:23 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Minimal testcase:

struct C1 { void operator+(); };
struct C2 { void operator+(); };
struct C3 : C1, C2 {
  template <class T> void get() { [] (T x) { +x; }; }
};

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

* [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
                   ` (2 preceding siblings ...)
  2021-02-02  5:23 ` ppalka at gcc dot gnu.org
@ 2021-02-11 16:00 ` cvs-commit at gcc dot gnu.org
  2021-02-11 16:01 ` [Bug c++/97582] [9/10 " ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-11 16:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

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

commit r11-7191-gcb168f779c87c1e0c37d22ea82dfb93ff8c873bc
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Feb 11 10:59:54 2021 -0500

    c++: Fix ICE from op_unqualified_lookup [PR97582]

    In this testcase, we're crashing because the lookup of operator+ from
    within the generic lambda via lookup_name finds multiple bindings
    (C1::operator+ and C2::operator+) and returns a TREE_LIST thereof,
    something which op_unqualified_lookup (and push_operator_bindings) isn't
    prepared to handle.

    This patch extends op_unqualified_lookup and push_operator_bindings
    to handle such an ambiguous lookup result in the natural way.

    gcc/cp/ChangeLog:

            PR c++/97582
            * name-lookup.c (op_unqualified_lookup): Handle an ambiguous
            lookup result by discarding it if the first element is a
            class-scope declaration, otherwise return it.
            (push_operator_bindings): Handle an ambiguous lookup result by
            doing push_local_binding on each element in the list.

    gcc/testsuite/ChangeLog:

            PR c++/97582
            * g++.dg/cpp0x/lambda/lambda-template17.C: New test.

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

* [Bug c++/97582] [9/10 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
                   ` (3 preceding siblings ...)
  2021-02-11 16:00 ` cvs-commit at gcc dot gnu.org
@ 2021-02-11 16:01 ` ppalka at gcc dot gnu.org
  2021-06-01  8:18 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-02-11 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11 Regression] ICE    |[9/10 Regression] ICE tree
                   |tree check: expected        |check: expected
                   |function_type or            |function_type or
                   |method_type, have           |method_type, have
                   |error_mark in               |error_mark in
                   |add_function_candidate, at  |add_function_candidate, at
                   |cp/call.c:2146 since        |cp/call.c:2146 since
                   |r9-6405-gbddee796d0b4800b   |r9-6405-gbddee796d0b4800b

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11 so far.

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

* [Bug c++/97582] [9/10 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
                   ` (4 preceding siblings ...)
  2021-02-11 16:01 ` [Bug c++/97582] [9/10 " ppalka at gcc dot gnu.org
@ 2021-06-01  8:18 ` rguenth at gcc dot gnu.org
  2022-05-27  9:43 ` [Bug c++/97582] [10 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 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] 10+ messages in thread

* [Bug c++/97582] [10 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
                   ` (5 preceding siblings ...)
  2021-06-01  8:18 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:43 ` rguenth at gcc dot gnu.org
  2022-06-28 10:42 ` jakub at gcc dot gnu.org
  2023-07-07  9:10 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug c++/97582] [10 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
                   ` (6 preceding siblings ...)
  2022-05-27  9:43 ` [Bug c++/97582] [10 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:42 ` jakub at gcc dot gnu.org
  2023-07-07  9:10 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/97582] [10 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b
  2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
                   ` (7 preceding siblings ...)
  2022-06-28 10:42 ` jakub at gcc dot gnu.org
@ 2023-07-07  9:10 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.1.0
   Target Milestone|10.5                        |11.0
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |10.5.0
         Resolution|---                         |FIXED

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed for GCC 11.

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

end of thread, other threads:[~2023-07-07  9:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 14:08 [Bug c++/97582] New: Regression Internal compiler error in lambda benjamin.freist at hexagon dot com
2020-10-26 14:59 ` [Bug c++/97582] [9/10/11 Regression] ICE tree check: expected function_type or method_type, have error_mark in add_function_candidate, at cp/call.c:2146 since r9-6405-gbddee796d0b4800b marxin at gcc dot gnu.org
2021-01-14  9:31 ` rguenth at gcc dot gnu.org
2021-02-02  5:23 ` ppalka at gcc dot gnu.org
2021-02-11 16:00 ` cvs-commit at gcc dot gnu.org
2021-02-11 16:01 ` [Bug c++/97582] [9/10 " ppalka at gcc dot gnu.org
2021-06-01  8:18 ` rguenth at gcc dot gnu.org
2022-05-27  9:43 ` [Bug c++/97582] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07  9:10 ` rguenth 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).