public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string>
@ 2021-12-16 17:14 egor.pugin at gmail dot com
  2021-12-16 21:14 ` [Bug c++/103752] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: egor.pugin at gmail dot com @ 2021-12-16 17:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103752
           Summary: [12 Regression][ICE][modules] with import <string>
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egor.pugin at gmail dot com
  Target Milestone: ---

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

export module x;
import <string>;
std::pair<std::string, std::string> environment;

gcc11 works fine, gcc from master gives an ICE.

In file included from
/home/egor/dev/gcc/build/install/include/c++/12.0.0/bits/stl_algobase.h:64,
                 from
/home/egor/dev/gcc/build/install/include/c++/12.0.0/bits/char_traits.h:39,
                 from
/home/egor/dev/gcc/build/install/include/c++/12.0.0/string:40,
of module /home/egor/dev/gcc/build/install/include/c++/12.0.0/string, imported
at crash.cpp:2:
/home/egor/dev/gcc/build/install/include/c++/12.0.0/bits/stl_pair.h: In
instantiation of ‘struct std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >’:
crash.cpp:3:37:   required from here
/home/egor/dev/gcc/build/install/include/c++/12.0.0/bits/stl_pair.h:242:7:
internal compiler error: Segmentation fault
  242 |       pair()
      |       ^~~~
0x1140a2f crash_signal
        ../../gcc/toplev.c:322
0xb01b55 hash_table_mod1(unsigned int, unsigned int)
        ../../gcc/hash-table.h:344
0xb01b55 hash_table<hash_map<tree_node*, tree_node*,
decl_tree_cache_traits>::hash_entry, false,
xcallocator>::find_with_hash(tree_node* const&, unsigned int)
        ../../gcc/hash-table.h:914
0xb01b55 hash_map<tree_node*, tree_node*,
decl_tree_cache_traits>::get(tree_node* const&)
        ../../gcc/hash-map.h:189
0xb01b55 lookup_explicit_specifier
        ../../gcc/cp/pt.c:13787
0xb01b55 tsubst_function_decl
        ../../gcc/cp/pt.c:14012
0xb051c2 tsubst_decl
        ../../gcc/cp/pt.c:14439
0xb33a79 instantiate_class_template_1
        ../../gcc/cp/pt.c:12020
0xb35112 instantiate_class_template(tree_node*)
        ../../gcc/cp/pt.c:12306
0xb83b79 complete_type(tree_node*)
        ../../gcc/cp/typeck.c:143
0x9b9055 start_decl_1(tree_node*, bool)
        ../../gcc/cp/decl.c:5771
0x9b9055 start_decl_1(tree_node*, bool)
        ../../gcc/cp/decl.c:5750
0x9d90b0 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/cp/decl.c:5737
0xaceda2 cp_parser_init_declarator
        ../../gcc/cp/parser.c:22529
0xaaa393 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:15155
0xada635 cp_parser_declaration
        ../../gcc/cp/parser.c:14841
0xadb04a cp_parser_toplevel_declaration
        ../../gcc/cp/parser.c:14862
0xadb04a cp_parser_translation_unit
        ../../gcc/cp/parser.c:4986
0xadb04a c_parse_file()
        ../../gcc/cp/parser.c:47839
0xc0838d c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1237
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.

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
@ 2021-12-16 21:14 ` pinskia at gcc dot gnu.org
  2022-01-17 12:53 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-16 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |103524
   Target Milestone|---                         |12.0
           Keywords|                            |ice-on-valid-code


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
  2021-12-16 21:14 ` [Bug c++/103752] " pinskia at gcc dot gnu.org
@ 2022-01-17 12:53 ` rguenth at gcc dot gnu.org
  2022-01-17 13:13 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 12:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.2.1
           Priority|P3                          |P1

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
  2021-12-16 21:14 ` [Bug c++/103752] " pinskia at gcc dot gnu.org
  2022-01-17 12:53 ` rguenth at gcc dot gnu.org
@ 2022-01-17 13:13 ` redi at gcc dot gnu.org
  2022-02-09  2:25 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-17 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem seems to be explicit(bool), and it fails for gcc-11 too.

// header.h
template<typename _T1, typename _T2>
struct pair
{
        constexpr
      explicit(__is_same(_T1, _T2))
      pair()
      { }

        _T1 first;
        _T2 second;
};

struct string
{
  string() { }
  string(const char* s) : s(s) { }

  const char* s = "";
};

/home/jwakely/gcc/11/bin/g++ -std=c++2b -xc++-header header.h  -fmodules-ts


// crash.cpp
export module x;
import "header.h";
pair<string, string> environment;

/home/jwakely/gcc/11/bin/g++ -std=c++2b -c crash.cpp -fmodules-ts

In module ./header.h, imported at crash.cpp:2:
header.h: In instantiation of ‘struct pair<string, string>’:
crash.cpp:3:22:   required from here
header.h:6:7: internal compiler error: Segmentation fault
    6 |       pair()
      |       ^~~~
0xca8f1f crash_signal
        /home/jwakely/src/gcc/gcc-11/gcc/toplev.c:327
0x7fb52bd2d31f ???
        ../sysdeps/unix/sysv/linux/sigaction.c:670
0x7a3c23 hash_table_mod1(unsigned int, unsigned int)
        /home/jwakely/src/gcc/gcc-11/gcc/hash-table.h:344
0x7a3c23 hash_table<hash_map<tree_node*, tree_node*,
decl_tree_cache_traits>::hash_entry, false,
xcallocator>::find_with_hash(tree_node* const&, unsigned int)
        /home/jwakely/src/gcc/gcc-11/gcc/hash-table.h:911
0x7a3c23 hash_map<tree_node*, tree_node*,
decl_tree_cache_traits>::get(tree_node* const&)
        /home/jwakely/src/gcc/gcc-11/gcc/hash-map.h:185
0x7a3c23 lookup_explicit_specifier
        /home/jwakely/src/gcc/gcc-11/gcc/cp/pt.c:13782
0x7a3c23 tsubst_function_decl
        /home/jwakely/src/gcc/gcc-11/gcc/cp/pt.c:14007
0x799879 tsubst_decl
        /home/jwakely/src/gcc/gcc-11/gcc/cp/pt.c:14467
0x7ab3cc instantiate_class_template_1
        /home/jwakely/src/gcc/gcc-11/gcc/cp/pt.c:11997
0x7ac6a2 instantiate_class_template(tree_node*)
        /home/jwakely/src/gcc/gcc-11/gcc/cp/pt.c:12276
0x7de8db complete_type(tree_node*)
        /home/jwakely/src/gcc/gcc-11/gcc/cp/typeck.c:143
0x7de8db complete_type(tree_node*)
        /home/jwakely/src/gcc/gcc-11/gcc/cp/typeck.c:111
0x69c6eb start_decl_1(tree_node*, bool)
        /home/jwakely/src/gcc/gcc-11/gcc/cp/decl.c:5644
0x6ad5af start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        /home/jwakely/src/gcc/gcc-11/gcc/cp/decl.c:5610
0x76c443 cp_parser_init_declarator
        /home/jwakely/src/gcc/gcc-11/gcc/cp/parser.c:21763
0x74b124 cp_parser_simple_declaration
        /home/jwakely/src/gcc/gcc-11/gcc/cp/parser.c:14467
0x774e25 cp_parser_declaration
        /home/jwakely/src/gcc/gcc-11/gcc/cp/parser.c:14164
0x775afe cp_parser_toplevel_declaration
        /home/jwakely/src/gcc/gcc-11/gcc/cp/parser.c:14193
0x775afe cp_parser_translation_unit
        /home/jwakely/src/gcc/gcc-11/gcc/cp/parser.c:4942
0x775afe c_parse_file()
        /home/jwakely/src/gcc/gcc-11/gcc/cp/parser.c:45340
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.


The only reason you don't see it for gcc-11 is that <string> doesn't use
explicit(bool) until gcc-12.

I think the short answer for now is that compiling libstdc++ headers as header
units is not really supported.

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
                   ` (2 preceding siblings ...)
  2022-01-17 13:13 ` redi at gcc dot gnu.org
@ 2022-02-09  2:25 ` jason at gcc dot gnu.org
  2022-02-09 15:41 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-09  2:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Last reconfirmed|                            |2022-02-09
                 CC|                            |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
                   ` (3 preceding siblings ...)
  2022-02-09  2:25 ` jason at gcc dot gnu.org
@ 2022-02-09 15:41 ` cvs-commit at gcc dot gnu.org
  2022-02-09 15:41 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-09 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:1ce5395977f37e8d0c03394f7b932a584ce85cc7

commit r12-7133-g1ce5395977f37e8d0c03394f7b932a584ce85cc7
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Feb 9 00:31:12 2022 -0500

    c++: modules and explicit(bool) [PR103752]

    We weren't streaming a C++20 dependent explicit-specifier.

            PR c++/103752

    gcc/cp/ChangeLog:

            * module.cc (trees_out::core_vals): Stream explicit specifier.
            (trees_in::core_vals): Likewise.
            * pt.cc (store_explicit_specifier): No longer static.
            (tsubst_function_decl): Clear DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
            * cp-tree.h (lookup_explicit_specifier): Declare.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/explicit-bool-1_b.C: New test.
            * g++.dg/modules/explicit-bool-1_a.H: New test.

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
                   ` (4 preceding siblings ...)
  2022-02-09 15:41 ` cvs-commit at gcc dot gnu.org
@ 2022-02-09 15:41 ` jason at gcc dot gnu.org
  2022-02-09 15:45 ` johelegp at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-02-09 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
                   ` (5 preceding siblings ...)
  2022-02-09 15:41 ` jason at gcc dot gnu.org
@ 2022-02-09 15:45 ` johelegp at gmail dot com
  2022-02-09 16:32 ` johelegp at gmail dot com
  2022-10-12 11:31 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2022-02-09 15:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johelegp at gmail dot com

--- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Do you think this also fixed Bug 103921?

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
                   ` (6 preceding siblings ...)
  2022-02-09 15:45 ` johelegp at gmail dot com
@ 2022-02-09 16:32 ` johelegp at gmail dot com
  2022-10-12 11:31 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: johelegp at gmail dot com @ 2022-02-09 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
*** Bug 103921 has been marked as a duplicate of this bug. ***

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

* [Bug c++/103752] [12 Regression][ICE][modules] with import <string>
  2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
                   ` (7 preceding siblings ...)
  2022-02-09 16:32 ` johelegp at gmail dot com
@ 2022-10-12 11:31 ` redi at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2022-10-12 11:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andreemalcher at gmail dot com

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 100583 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-10-12 11:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 17:14 [Bug c++/103752] New: [12 Regression][ICE][modules] with import <string> egor.pugin at gmail dot com
2021-12-16 21:14 ` [Bug c++/103752] " pinskia at gcc dot gnu.org
2022-01-17 12:53 ` rguenth at gcc dot gnu.org
2022-01-17 13:13 ` redi at gcc dot gnu.org
2022-02-09  2:25 ` jason at gcc dot gnu.org
2022-02-09 15:41 ` cvs-commit at gcc dot gnu.org
2022-02-09 15:41 ` jason at gcc dot gnu.org
2022-02-09 15:45 ` johelegp at gmail dot com
2022-02-09 16:32 ` johelegp at gmail dot com
2022-10-12 11:31 ` redi 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).