public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization
@ 2021-11-20  6:36 johelegp at gmail dot com
  2021-11-23 17:00 ` [Bug c++/103339] " johelegp at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2021-11-20  6:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103339
           Summary: [modules] ICE in exporting module on use of outside
                    specialization
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

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

mod.cpp:
```C++
export module mod;
export template<class T> struct trait { };
export template<class> concept C = true;
template<class T> concept has_trait = C<trait<T>>;
```

test.cpp:
```C++
import mod;
template<C T> struct trait<T> { };
```

Output:
```
test.cpp:2:31: internal compiler error: in import_entity_index, at
cp/module.cc:3953
    2 | template<C T> struct trait<T> { };
      |                               ^
0x206aac9 internal_error(char const*, ...)
        ???:0
0x7d92db fancy_abort(char const*, int, char const*)
        ???:0
0x966072 module_may_redeclare(tree_node*)
        ???:0
0xaab517 begin_class_definition(tree_node*)
        ???:0
0xa0b065 c_parse_file()
        ???:0
0xb931d2 c_common_parse_file()
        ???:0
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.
```

Workaround:
```diff
-template<class T> concept has_trait = C<trait<T>>;
+template<class T> concept has_trait = C<trait<std::type_identity_t<T>>>;
```

As per the logic in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99631#c1, this
isn't marked with any of the ice-* keywords.

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

* [Bug c++/103339] [modules] ICE in exporting module on use of outside specialization
  2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
@ 2021-11-23 17:00 ` johelegp at gmail dot com
  2021-11-23 17:11 ` johelegp at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2021-11-23 17:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
In non-reduced code, I got the error from Bug 99861 which I solved with the
workaround above:

```
hash table checking failed: equal operator returns true for a pair of values
with a different hash value
In module waarudo.numbers, imported at
/home/johel/Documents/C++/Repos/waarudo/tests/test.waarudo.numbers.cpp:4:
/home/johel/Documents/C++/Repos/waarudo/sources/waarudo.numbers.cpp: In
substitution of ‘template<class T> using number_difference_t = typename
waarudo::number_difference@waarudo.numbers::type [with T = short unsigned
int]’:
/home/johel/Documents/C++/Repos/waarudo/sources/waarudo.numbers.cpp:57:24:  
required by substitution of ‘template<class Q>  requires  scalar_quantity<Q>
using x_component =
waarudo::component@waarudo.geometries<waarudo::x@waarudo.geometries, Q> [with Q
= waarudo::pixels@waarudo.quantities<short unsigned int>]’
/home/johel/Documents/C++/Repos/waarudo/tests/test.waarudo.numbers.cpp:111:9:  
required from ‘{anonymous}::test()::<lambda()>::<lambda(unsigned
char)>::<lambda(I)> [with I = short unsigned int]’
/usr/include/boost/mp11/algorithm.hpp:1039:29:   required from ‘constexpr F
boost::mp11::detail::mp_for_each_impl(boost::mp11::mp_list<Q ...>, F&&) [with T
= {unsigned char, short unsigned int}; F =
{anonymous}::test()::<lambda()>::<lambda(unsigned char)>::<lambda(I)>]’
/usr/include/boost/mp11/algorithm.hpp:1072:36:   required from ‘constexpr F
boost::mp11::mp_for_each(F&&) [with L = boost::mp11::mp_list<unsigned char,
short unsigned int>; F = {anonymous}::test()::<lambda()>::<lambda(unsigned
char)>::<lambda(I)>]’
/home/johel/Documents/C++/Repos/waarudo/tests/test.waarudo.numbers.cpp:110:58: 
 required from here
/home/johel/Documents/C++/Repos/waarudo/sources/waarudo.numbers.cpp:25:32:
internal compiler error: in hashtab_chk_error, at hash-table.c:137
   25 | export template<class T> using number_difference_t     = typename
number_difference<T>::type;
      |                                ^~~~~~~~~~~~~~~~~~~
0x20f297d internal_error(char const*, ...)
        ???:0
0x97de46 fancy_abort(char const*, int, char const*)
        ???:0
0x97dc52 hashtab_chk_error()
        ???:0
0x9eb38e hash_table<atom_hasher, false, xcallocator>::verify(tree_node* const&,
unsigned int)
        ???:0
0x9ea2c8 constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0xb8a0ec most_specialized_partial_spec(tree_node*, int)
        ???:0
0xba6a27 instantiate_class_template(tree_node*)
        ???:0
0xbf7c74 complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ???:0
0xb8d16a tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8be48 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9ea286 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9ea2c8 constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0xb8bfba tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e487 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e8df tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e664 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e487 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e8df tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e664 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xb8e487 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
```

Workaround:
```C++
template<class T> using workaround_gcc_bug_103339 = std::type_identity_t<T>;

export template<class T> using number_representation_t =
  typename number_representation<workaround_gcc_bug_103339<T>>::type;
```

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

* [Bug c++/103339] [modules] ICE in exporting module on use of outside specialization
  2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
  2021-11-23 17:00 ` [Bug c++/103339] " johelegp at gmail dot com
@ 2021-11-23 17:11 ` johelegp at gmail dot com
  2021-11-23 18:15 ` johelegp at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2021-11-23 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Or not really. Removing a comment breaks it again, so I guess the compiler is
already in a bugged state that seems to work fine.

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

* [Bug c++/103339] [modules] ICE in exporting module on use of outside specialization
  2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
  2021-11-23 17:00 ` [Bug c++/103339] " johelegp at gmail dot com
  2021-11-23 17:11 ` johelegp at gmail dot com
@ 2021-11-23 18:15 ` johelegp at gmail dot com
  2022-10-18  0:26 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2021-11-23 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Turns out that the error from Bug 99861 just happens occasionally when
compiling.

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

* [Bug c++/103339] [modules] ICE in exporting module on use of outside specialization
  2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2021-11-23 18:15 ` johelegp at gmail dot com
@ 2022-10-18  0:26 ` ppalka at gcc dot gnu.org
  2022-10-18  0:30 ` johelegp at gmail dot com
  2024-02-10  4:38 ` nshead at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-10-18  0:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW the testcase is accepted on trunk since r13-324

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

* [Bug c++/103339] [modules] ICE in exporting module on use of outside specialization
  2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
                   ` (3 preceding siblings ...)
  2022-10-18  0:26 ` ppalka at gcc dot gnu.org
@ 2022-10-18  0:30 ` johelegp at gmail dot com
  2024-02-10  4:38 ` nshead at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: johelegp at gmail dot com @ 2022-10-18  0:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
You're right. Feel free to close.

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

* [Bug c++/103339] [modules] ICE in exporting module on use of outside specialization
  2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
                   ` (4 preceding siblings ...)
  2022-10-18  0:30 ` johelegp at gmail dot com
@ 2024-02-10  4:38 ` nshead at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-02-10  4:38 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

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

--- Comment #6 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
So fixed.

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

end of thread, other threads:[~2024-02-10  4:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20  6:36 [Bug c++/103339] New: [modules] ICE in exporting module on use of outside specialization johelegp at gmail dot com
2021-11-23 17:00 ` [Bug c++/103339] " johelegp at gmail dot com
2021-11-23 17:11 ` johelegp at gmail dot com
2021-11-23 18:15 ` johelegp at gmail dot com
2022-10-18  0:26 ` ppalka at gcc dot gnu.org
2022-10-18  0:30 ` johelegp at gmail dot com
2024-02-10  4:38 ` nshead 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).