public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases
@ 2023-11-20  6:27 hanicka at hanicka dot net
  2023-11-20  6:47 ` [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: hanicka at hanicka dot net @ 2023-11-20  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112633
           Summary: ICE in parser GCC 13+ (including 14) around type
                    aliases
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hanicka at hanicka dot net
  Target Milestone: ---

Tested on GCC 14.0.0 20231119 (on Compiler-Explorer) and it's giving me ICE,
also on all 13.x versions (not 12.x)

```c++
template <class> constexpr bool dependent_true = true;

template <bool> struct empty_type { }; // something like enable_if

template <bool B> using empty_type_t = typename empty_type<B>::type; 

struct wrapper {
    using type = void;
};

template <class...> using all = wrapper;

template <class... Conditions>
using constraints = typename all<Conditions...>::type;

template <typename T, constraints<empty_type_t<dependent_true<T>>> = nullptr> 
void calculate() { };
```

I don't even need to instantiate `calculate` function.

It gives me this error:

<source>: In substitution of 'template<class ... Conditions> using constraints
= typename all<Conditions ...>::type [with Conditions = {typename
empty_type<dependent_true<T> >::type}]':
<source>:16:66:   required from here
   16 | template <typename T, constraints<empty_type_t<dependent_true<T>>> =
nullptr>
      |                                                                  ^
<source>:14:7: internal compiler error: Segmentation fault
   14 | using constraints = typename all<Conditions...>::type;
      |       ^~~~~~~~~~~
0x26a742e internal_error(char const*, ...)
        ???:0
0xd276f0 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd1b8f3 instantiate_template(tree_node*, tree_node*, int)
        ???:0
0xd285ea tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd35ed6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0xd6996f finish_template_type(tree_node*, tree_node*, int)
        ???:0
0xcf6a49 c_parse_file()
        ???:0
0xe38e79 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
@ 2023-11-20  6:47 ` pinskia at gcc dot gnu.org
  2023-11-20  6:47 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-20  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Version|13.0                        |13.1.0
            Summary|ICE in parser GCC 13+       |[13/14 Regression] ICE with
                   |(including 14) around type  |type aliases and depedent
                   |aliases                     |value
   Target Milestone|---                         |13.3

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, note this is not related to variadic templates as this crashes in a
similar way:
```
template <class> constexpr bool dependent_true = true;

template <bool> struct empty_type { }; // something like enable_if

template <bool B> using empty_type_t = typename empty_type<B>::type; 

struct wrapper {
    using type = void;
};

template <class> using all = wrapper;

template <class Conditions>
using constraints = typename all<Conditions>::type;

template <typename T, constraints<empty_type_t<dependent_true<T>>> = nullptr> 
void calculate() { };
```

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
  2023-11-20  6:47 ` [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value pinskia at gcc dot gnu.org
@ 2023-11-20  6:47 ` pinskia at gcc dot gnu.org
  2023-11-20 14:31 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-20  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-11-20
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |needs-bisection

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
  2023-11-20  6:47 ` [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value pinskia at gcc dot gnu.org
  2023-11-20  6:47 ` pinskia at gcc dot gnu.org
@ 2023-11-20 14:31 ` ppalka at gcc dot gnu.org
  2023-11-22 18:54 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-20 14:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r13-4729-gbe124477b38a71

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
                   ` (2 preceding siblings ...)
  2023-11-20 14:31 ` ppalka at gcc dot gnu.org
@ 2023-11-22 18:54 ` cvs-commit at gcc dot gnu.org
  2023-11-22 19:11 ` hanicka at hanicka dot net
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-22 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:3f266c84a15d63e42bfad46397fea9aff92b0720

commit r14-5763-g3f266c84a15d63e42bfad46397fea9aff92b0720
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Nov 22 13:54:29 2023 -0500

    c++: alias template of non-template class [PR112633]

    The entering_scope adjustment in tsubst_aggr_type assumes if an alias is
    dependent, then so is the aliased type (and therefore it has template info)
    but that's not true for the dependent alias template specialization ty1<T>
    below which aliases the non-template class A.  In this case no adjustment
    is needed anyway, so we can just punt.

            PR c++/112633

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO
            in the entering_scope adjustment.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/alias-decl-75.C: New test.

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
                   ` (3 preceding siblings ...)
  2023-11-22 18:54 ` cvs-commit at gcc dot gnu.org
@ 2023-11-22 19:11 ` hanicka at hanicka dot net
  2023-11-23  0:08 ` cvs-commit at gcc dot gnu.org
  2023-11-27 22:19 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: hanicka at hanicka dot net @ 2023-11-22 19:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Hana Dusíková <hanicka at hanicka dot net> ---
Thanks for really quick fix! You are awesome!

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
                   ` (4 preceding siblings ...)
  2023-11-22 19:11 ` hanicka at hanicka dot net
@ 2023-11-23  0:08 ` cvs-commit at gcc dot gnu.org
  2023-11-27 22:19 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-11-23  0:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:63c65224e778124eee52acc7b9fcb32cd8ad61e8

commit r13-8090-g63c65224e778124eee52acc7b9fcb32cd8ad61e8
Author: Patrick Palka <ppalka@redhat.com>
Date:   Wed Nov 22 19:07:19 2023 -0500

    c++: alias template of non-template class [PR112633]

    The entering_scope adjustment in tsubst_aggr_type assumes if an alias is
    dependent, then so is the aliased type (and therefore it has template info)
    but that's not true for the dependent alias template specialization ty1<T>
    below which aliases the non-template class A.  In this case no adjustment
    is needed anyway, so we can just punt.

            PR c++/112633

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO
            in the entering_scope adjustment.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/alias-decl-75.C: New test.

    (cherry picked from commit 3f266c84a15d63e42bfad46397fea9aff92b0720)

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

* [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value
  2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
                   ` (5 preceding siblings ...)
  2023-11-23  0:08 ` cvs-commit at gcc dot gnu.org
@ 2023-11-27 22:19 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-11-27 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 13.3, thanks for the bug report.

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

end of thread, other threads:[~2023-11-27 22:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-20  6:27 [Bug c++/112633] New: ICE in parser GCC 13+ (including 14) around type aliases hanicka at hanicka dot net
2023-11-20  6:47 ` [Bug c++/112633] [13/14 Regression] ICE with type aliases and depedent value pinskia at gcc dot gnu.org
2023-11-20  6:47 ` pinskia at gcc dot gnu.org
2023-11-20 14:31 ` ppalka at gcc dot gnu.org
2023-11-22 18:54 ` cvs-commit at gcc dot gnu.org
2023-11-22 19:11 ` hanicka at hanicka dot net
2023-11-23  0:08 ` cvs-commit at gcc dot gnu.org
2023-11-27 22:19 ` ppalka 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).