[Bug libstdc++/100583] New: [modules] ICE when importing

2021-05-13 Thread andreemalcher at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100583

Bug ID: 100583
   Summary: [modules] ICE when importing 
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: andreemalcher at gmail dot com
  Target Milestone: ---

$ g++ --version
g++ (Ubuntu 11.1.0-1ubuntu1~18.04.1) 11.1.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cat span.cpp
import ;
void foo() { std::span s; }
$ g++ -fmodules-ts -std=c++20 -c -x c++-system-header span
$ g++ -fmodules-ts -std=c++20 -c span.cpp
In module /usr/include/c++/11/span, imported at span.cpp:1:
/usr/include/c++/11/span: In instantiation of ‘class std::span’:
span.cpp:4:29:   required from here
/usr/include/c++/11/span:155:9: internal compiler error: Segmentation fault
  155 |         span(_It __first, size_type __count)
      |         ^~~~
0x1702697 internal_error(char const*, ...)
        ???:0
0x7bfc52 instantiate_class_template(tree_node*)
        ???:0
0x7f17ab complete_type(tree_node*)
        ???:0
0x6af20b start_decl_1(tree_node*, bool)
        ???:0
0x6c1e0f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ???:0
0x7888ee c_parse_file()
        ???:0
0x85988d 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  for instructions.


Even if import  is replaced with #include , the sheer presence of
span.gcm leads to an ICE when compiled with -fmodules-ts. The solution is to
use the include and remove the gcm file altogether.But this means that there is
no way of importing  as a module.

[Bug c++/100584] New: [modules] ICE when using import ; with std::jthread

2021-05-13 Thread andreemalcher at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100584

Bug ID: 100584
   Summary: [modules] ICE when using import ; with
std::jthread
   Product: gcc
   Version: 11.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: andreemalcher at gmail dot com
  Target Milestone: ---

$ cat thread.cpp
import ; // Compiles & runs fine with include or if order if swapped
with next line
#include 

int main() {
  std::jthread t{[]{}}; // Compiles & runs fine with std::thread
}
$ g++ -fmodules-ts -std=c++20 -c -x c++-system-header iostream$ g++
-fmodules-ts -std=c++20 -o prog thread.cpp -pthread
during IPA pass: visibility
thread.cpp:6:1: internal compiler error: in function_and_variable_visibility,
at ipa-visibility.c:712
    6 | }
      | ^
0x1702697 internal_error(char const*, ...)
        ???:0
0x64082b fancy_abort(char const*, int, char const*)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


If you replace std::jthread with std::thread (optionally, with corresponding
join()), it compiles just fine.


Also, the order of import vs. include seems to matter (see comment in code).
Same ICE for import ;, for example, but not for import ;.
Haven't tried others.