public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529
@ 2022-03-24 10:53 johelegp at gmail dot com
  2022-07-03 21:24 ` [Bug c++/105044] " johelegp at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2022-03-24 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105044
           Summary: [modules] ICE in comptypes, at cp/typeck.c:1529
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/YGo78aPE8.

`mod.cpp`:
```C++
export module mod;

export template<typename BaseType>
struct downcast_base {
  using downcast_base_type = BaseType;
  friend auto downcast_guide(downcast_base);
};

export template<typename T> concept Downcastable = true;

export template<typename Target, Downcastable T>
struct downcast_child : T {
  friend auto downcast_guide(typename T::downcast_base) { return T(); }
};

export struct ratio { int num; };

export template<ratio R, typename U>
struct scaled_unit : downcast_base<scaled_unit<R, U>> {};

export template<typename Child>
struct unit : downcast_child<Child, scaled_unit<ratio(1), Child>> {};

export struct unknown_coherent_unit : unit<unknown_coherent_unit> {};
```

`test.cpp`:
```C++
import mod;
struct u : downcast_base<u> { };
int main() { }
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct downcast_base@mod<u>':
test.cpp:2:12:   required from here
mod.cpp:4:8: internal compiler error: in comptypes, at cp/typeck.cc:1529
    4 | struct downcast_base {
      |        ^~~~~~~~~~~~~
0x218c519 internal_error(char const*, ...)
        ???:0
0x741b3f fancy_abort(char const*, int, char const*)
        ???:0
0xa7e346 comptypes(tree_node*, tree_node*, int)
        ???:0
0x828f6d complete_vars(tree_node*)
        ???:0
0x7a1a5c finish_struct_1(tree_node*)
        ???:0
0xa01359 instantiate_class_template(tree_node*)
        ???:0
0xa7739b complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ???:0
0x841a1c xref_basetypes(tree_node*, tree_node*)
        ???:0
0x986b0d c_parse_file()
        ???:0
0xb18ae2 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.
```

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

* [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.c:1529
  2022-03-24 10:53 [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529 johelegp at gmail dot com
@ 2022-07-03 21:24 ` johelegp at gmail dot com
  2022-07-03 21:25 ` [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531 johelegp at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2022-07-03 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Another simpler reproducer from another use-case:
https://godbolt.org/z/jroqv6Kzq.

`mod.cpp`:
```C++
export module mod;
export template<auto> struct constant { };
export template<class> struct is_constant { };
struct monostate { };
inline constexpr constant<monostate{}> c1{};
```

`test.cpp`:
```C++
import mod;
is_constant<constant<0>> v;
int main() { }
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct is_constant@mod<constant@mod<0> >':
test.cpp:2:26:   required from here
mod.cpp:3:31: internal compiler error: in comptypes, at cp/typeck.cc:1531
    3 | export template<class> struct is_constant { };
      |                               ^~~~~~~~~~~
0x2216469 internal_error(char const*, ...)
        ???:0
0x74b7d9 fancy_abort(char const*, int, char const*)
        ???:0
0xa90b66 comptypes(tree_node*, tree_node*, int)
        ???:0
0x833e5d complete_vars(tree_node*)
        ???:0
0x7ab99b finish_struct_1(tree_node*)
        ???:0
0xa13ed4 instantiate_class_template(tree_node*)
        ???:0
0x823818 start_decl_1(tree_node*, bool)
        ???:0
0x84b6a6 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ???:0
0x99555d c_parse_file()
        ???:0
0xb2bc61 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.
```

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

* [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531
  2022-03-24 10:53 [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529 johelegp at gmail dot com
  2022-07-03 21:24 ` [Bug c++/105044] " johelegp at gmail dot com
@ 2022-07-03 21:25 ` johelegp at gmail dot com
  2022-07-04  3:28 ` johelegp at gmail dot com
  2022-10-18 15:10 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2022-07-03 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[modules] ICE in comptypes, |[modules] ICE in comptypes,
                   |at cp/typeck.c:1529         |at cp/typeck.cc:1531

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Another simpler reproducer from another use-case:
https://godbolt.org/z/jroqv6Kzq.

`mod.cpp`:
```C++
export module mod;
export template<auto> struct constant { };
export template<class> struct is_constant { };
struct monostate { };
inline constexpr constant<monostate{}> c1{};
```

`test.cpp`:
```C++
import mod;
is_constant<constant<0>> v;
int main() { }
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct is_constant@mod<constant@mod<0> >':
test.cpp:2:26:   required from here
mod.cpp:3:31: internal compiler error: in comptypes, at cp/typeck.cc:1531
    3 | export template<class> struct is_constant { };
      |                               ^~~~~~~~~~~
0x2216469 internal_error(char const*, ...)
        ???:0
0x74b7d9 fancy_abort(char const*, int, char const*)
        ???:0
0xa90b66 comptypes(tree_node*, tree_node*, int)
        ???:0
0x833e5d complete_vars(tree_node*)
        ???:0
0x7ab99b finish_struct_1(tree_node*)
        ???:0
0xa13ed4 instantiate_class_template(tree_node*)
        ???:0
0x823818 start_decl_1(tree_node*, bool)
        ???:0
0x84b6a6 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ???:0
0x99555d c_parse_file()
        ???:0
0xb2bc61 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.
```

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

* [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531
  2022-03-24 10:53 [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529 johelegp at gmail dot com
  2022-07-03 21:24 ` [Bug c++/105044] " johelegp at gmail dot com
  2022-07-03 21:25 ` [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531 johelegp at gmail dot com
@ 2022-07-04  3:28 ` johelegp at gmail dot com
  2022-10-18 15:10 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2022-07-04  3:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Enough recompilations from the actual use-case show this error:
```
/home/johel/Documents/C++/Repos/Waarudo/tests/unit/test.waarudo.quantities.cpp:
In substitution of ‘template<auto ...D> struct
waarudo::is_unit@waarudo.quantities<const waarudo::unit@waarudo.quantities<D
...>*> [with auto ...D = {waarudo::ratio@waarudo.quantities{146097, 400}, (&
waarudo::day@waarudo.quantities)}]’:
/home/johel/Documents/C++/Repos/Waarudo/tests/unit/test.waarudo.quantities.cpp:21:57:
  required from here
/home/johel/Documents/C++/Repos/Waarudo/tests/unit/test.waarudo.quantities.cpp:21:57:
internal compiler error: tree check: expected tree that contains ‘typed’
structure, have ‘ggc_freed’ in convert_nontype_argument, at cp/pt.cc:7763
   21 | static_assert(waarudo::is_unit<decltype(&waarudo::year)>::value);
      |                                                         ^~
0x226d11c internal_error(char const*, ...)
        ???:0
0x8d094f tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ???:0
0xbc4daa lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0xbafdb7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xbbf9eb tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xbae4e6 most_specialized_partial_spec(tree_node*, int)
        ???:0
0xbd7a1c instantiate_class_template(tree_node*)
        ???:0
0xc2fe01 complete_type(tree_node*)
        ???:0
0xb7a0db c_parse_file()
        ???:0
0xcb9cd1 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://bugs.archlinux.org/> for instructions.
```

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

* [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531
  2022-03-24 10:53 [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529 johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2022-07-04  3:28 ` johelegp at gmail dot com
@ 2022-10-18 15:10 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-10-18 15:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup of PR100616 I think -- streaming of cNTTP arguments has been fixed on trunk
by r13-2953

*** This bug has been marked as a duplicate of bug 100616 ***

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

end of thread, other threads:[~2022-10-18 15:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24 10:53 [Bug c++/105044] New: [modules] ICE in comptypes, at cp/typeck.c:1529 johelegp at gmail dot com
2022-07-03 21:24 ` [Bug c++/105044] " johelegp at gmail dot com
2022-07-03 21:25 ` [Bug c++/105044] [modules] ICE in comptypes, at cp/typeck.cc:1531 johelegp at gmail dot com
2022-07-04  3:28 ` johelegp at gmail dot com
2022-10-18 15:10 ` 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).