[Bug c++/87814] New: [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] New: [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

            Bug ID: 87814
           Summary: [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962
                    with range-v3
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Casey at Carter dot net
  Target Milestone: ---

Created attachment 44932
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44932&action=edit
Preprocessed repro

This program (preprocessed repro attached as repro.i.gz):

  #include <range/v3/iterator_range.hpp>
  #include <range/v3/view/join.hpp>
  #include <range/v3/view/transform.hpp>

  int main() {
      using namespace ranges;

      auto f = [](int) { return iterator_range<int*>(); };
      join_view<transform_view<int(&)[42], decltype(f)>> rng;
      (void) rng.begin();
  }

ICEs in tsubst_copy while instantiating a variadic inherited constructor
template that performs a "double" pack expansion, defined around line 43341 in
the repro.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.0
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

ensadc at mailnesia dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ensadc at mailnesia dot com

--- Comment #1 from ensadc at mailnesia dot com ---
Reduced:

template<class Element>
struct box {
    template<class E>
    constexpr box(E && e)
        noexcept(noexcept(Element(e)))
    {}
};

template<class... Ts>
struct compressed_tuple_ : box<Ts> ... {
    template<typename... Args>
    constexpr compressed_tuple_(Args &&... args)
        noexcept((noexcept(box<Ts>(args)) && ...))
      : box<Ts>(args)...
    {}
};

struct adaptor_cursor : compressed_tuple_<int*> {
    using compressed_tuple_::compressed_tuple_;
};

int main() {
    (void)noexcept(adaptor_cursor{(int*)0});
}
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-11-05
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
commit 9261bbbee3c2aa7be2cb37d358fa7c53dd4b3271
Author: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Jun 1 20:49:27 2018 +0000

            * pt.c (instantiate_decl): Any defaulted function is defined.

    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261084
138bc75d-0d04-0410-961f-82ee72b054a4
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

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

--- Comment #3 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
This is ICEing, but not in tsubst_copy:
87814.ii:19:8: internal compiler error: Segmentation fault
   19 | struct adaptor_cursor : compressed_tuple_<int*> {
      |        ^~~~~~~~~~~~~~
0xb08b4f crash_signal
        ../../../src/gcc/toplev.c:325
0x5ac177 standard_conversion
        ../../../src/gcc/cp/call.c:1122
0x5b226b implicit_conversion
        ../../../src/gcc/cp/call.c:1860
0x5af991 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        ../../../src/gcc/cp/call.c:10909
0x61d8be build_noexcept_spec(tree_node*, int)
        ../../../src/gcc/cp/except.c:1198
0x6a65d2 maybe_instantiate_noexcept(tree_node*, int)
        ../../../src/gcc/cp/pt.c:23802
0x5f5a2c start_preparsed_function(tree_node*, tree_node*, int)
        ../../../src/gcc/cp/decl.c:15430
0x63a6c1 synthesize_method(tree_node*)
        ../../../src/gcc/cp/method.c:913
0x6adaed instantiate_decl(tree_node*, bool, bool)
        ../../../src/gcc/cp/pt.c:24198
0x5ce05b instantiate_cx_fn_r
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I actually still see an ICE in tsubst_copy:

h.C: In instantiation of ‘constexpr adaptor_cursor::adaptor_cursor(Args&& ...)
[with Args = {int*}][inherited from compressed_tuple_<int*>]’:
h.C:24:43:   required from here
h.C:20:30: internal compiler error: in tsubst_copy, at cp/pt.c:16090
   20 |     using compressed_tuple_::compressed_tuple_;
      |                              ^~~~~~~~~~~~~~~~~
0x80b870 tsubst_copy
        /home/mpolacek/src/gcc/gcc/cp/pt.c:16090
0xa3cbc2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:19160
0xa4286b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:17862
0xa4286b tsubst_exception_specification
        /home/mpolacek/src/gcc/gcc/cp/pt.c:14231
0xa509b4 regenerate_decl_from_template
        /home/mpolacek/src/gcc/gcc/cp/pt.c:23584
0xa509b4 instantiate_decl(tree_node*, bool, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:24154
0x8e74c9 instantiate_cx_fn_r
        /home/mpolacek/src/gcc/gcc/cp/constexpr.c:4944
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixing this one will probably also fix bug 88146.
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #6 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Created attachment 45159
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45159&action=edit
candidate patch
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
Reply | Threaded
Open this post in threaded view
|

[Bug c++/87814] [9 Regression] ICE in in tsubst_copy, at cp/pt.c:15962 with range-v3

asolokha at gmx dot com
In reply to this post by asolokha at gmx dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87814

--- Comment #8 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Author: aoliva
Date: Fri Dec 14 21:57:07 2018
New Revision: 267155

URL: https://gcc.gnu.org/viewcvs?rev=267155&root=gcc&view=rev
Log:
[PR c++/87814] undefer deferred noexcept on tsubst if request

tsubst_expr and tsubst_copy_and_build are not expected to handle
DEFERRED_NOEXCEPT exprs, but if tsubst_exception_specification takes a
DEFERRED_NOEXCEPT expr with !defer_ok, it just passes the expr on for
tsubst_copy_and_build to barf.

This patch arranges for tsubst_exception_specification to combine the
incoming args with those already stored in a DEFERRED_NOEXCEPT, and
then substitute them into the pattern, when retaining a deferred
noexcept is unacceptable.


for  gcc/cp/ChangeLog

        PR c++/87814
        * pt.c (tsubst_exception_specification): Handle
        DEFERRED_NOEXCEPT with !defer_ok.

for  gcc/testsuite/ChangeLog

        PR c++/87814
        * g++.dg/cpp1z/pr87814.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1z/pr87814.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog