[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-02 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #24 from Alexander Lelyakin  ---
Congratulations! 
After first testing results this bug is not seen more!

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-02 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

Nathan Sidwell  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #23 from Nathan Sidwell  ---
* f4e05eebd6a 2021-04-02 | c++: header unit purview [PR 99283]

I think if there are other cases with other test patterns, they should be
separate bugs, otherwise this has just turned into a meta bug of its own.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-01 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #22 from Alexander Lelyakin  ---
Clean rebuild do not change things:

/home/sasha/GCC/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header streambuf
/home/sasha/GCC/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header
type_traits
/home/sasha/GCC/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header valarray

In file included from /home/sasha/GCC/include/c++/11.0.1/iterator:66,
 from
/home/sasha/GCC/include/c++/11.0.1/bits/ranges_algobase.h:36,
 from /home/sasha/GCC/include/c++/11.0.1/bits/ranges_algo.h:35,
 from /home/sasha/GCC/include/c++/11.0.1/algorithm:64,
 from /home/sasha/GCC/include/c++/11.0.1/valarray:38:
/home/sasha/GCC/include/c++/11.0.1/bits/streambuf_iterator.h:53:5: internal
compiler error: in assert_definition, at cp/module.cc:4492
   53 | {
  | ^
0x6e31c7 trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4492
0xa5eed0 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11323
0xa6e5af trees_in::read_function_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11403
0xa70aa1 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14817
0xa7111d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18079
0xa711df module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18737
0xa6b460 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9661
0xa7091b module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14714
0xa7111d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18079
0xa711df module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18737
0xa74337 lazy_load_pendings(tree_node*)
../../gcc/gcc/cp/module.cc:18830
0xb7eed5 complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:140
0xb3fe22 lookup_member(tree_node*, tree_node*, int, bool, int,
access_failure_info*)
../../gcc/gcc/cp/search.c:1148
0xa79195 get_class_binding
../../gcc/gcc/cp/name-lookup.c:5333
0xa8065f outer_binding(tree_node*, cxx_binding*, bool)
../../gcc/gcc/cp/name-lookup.c:7649
0xa808af innermost_non_namespace_value(tree_node*)
../../gcc/gcc/cp/name-lookup.c:7686
0xae6547 check_template_shadow(tree_node*)
../../gcc/gcc/cp/pt.c:4379
0xa7ced1 push_class_level_binding_1
../../gcc/gcc/cp/name-lookup.c:5418
0xa7d49e push_class_level_binding(tree_node*, tree_node*)
../../gcc/gcc/cp/name-lookup.c:5567
0xa7d49e pushdecl_class_level(tree_node*)
../../gcc/gcc/cp/name-lookup.c:5280
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210323 (experimental)
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.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-01 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #21 from Nathan Sidwell  ---
Pants

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-01 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #20 from Alexander Lelyakin  ---
Just make:
 git pull
 make
 make install

That is: just make in previously configured dir.

Then:
---
g++ -std=c++20 -fmodules-ts -x c++-system-header string
g++ -std=c++20 -fmodules-ts -x c++-system-header type_traits
g++ -std=c++20 -fmodules-ts -x c++-system-header iostream

In file included from /home/sasha/GCC/include/c++/11.0.1/bits/ios_base.h:41,
 from /home/sasha/GCC/include/c++/11.0.1/ios:42,
 from /home/sasha/GCC/include/c++/11.0.1/ostream:38,
 from /home/sasha/GCC/include/c++/11.0.1/iostream:39:
/home/sasha/GCC/include/c++/11.0.1/bits/locale_classes.h:163:23: internal
compiler error: in assert_definition, at cp/module.cc:4492
  163 | locale(const std::string& __s) : locale(__s.c_str()) { }
  |   ^~
0x6e31c7 trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4492
0xa5eed0 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11323
0xa6e5af trees_in::read_function_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11403
0xa70aa1 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14817
0xa7111d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18079
0xa711df module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18737
0xa6b460 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9661
0xa7091b module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14714
0xa7111d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18079
0xa711df module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18737
0xa6b460 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9661
0xa7091b module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14714
0xa7111d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18079
0xa712d8 lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*)
../../gcc/gcc/cp/module.cc:18770
0xa8301e name_lookup::search_namespace_only(tree_node*)
../../gcc/gcc/cp/name-lookup.c:928
0xa8321a name_lookup::search_namespace(tree_node*)
../../gcc/gcc/cp/name-lookup.c:1014
0xa8321a name_lookup::search_namespace(tree_node*)
../../gcc/gcc/cp/name-lookup.c:1007
0xa8331c name_lookup::search_qualified(tree_node*, bool)
../../gcc/gcc/cp/name-lookup.c:1075
0xa8785f qualified_namespace_lookup
../../gcc/gcc/cp/name-lookup.c:7161
0xa88878 lookup_qualified_name(tree_node*, tree_node*, LOOK_want, bool)
../../gcc/gcc/cp/name-lookup.c:7122
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210323 (experimental)
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.
---

Will do full rebuild in clean directory to make test cleaner.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-01 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #19 from Nathan Sidwell  ---
Yes! that seems to have done it!

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-01 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #18 from Nathan Sidwell  ---
* 584731ecedf 2021-04-01 | c++: inter-cluster import order [PR 99283]

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-04-01 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #17 from CVS Commits  ---
The master branch has been updated by Nathan Sidwell :

https://gcc.gnu.org/g:584731ecedf09c2c067913c4af9ed0a30cf19e8d

commit r11-7950-g584731ecedf09c2c067913c4af9ed0a30cf19e8d
Author: Nathan Sidwell 
Date:   Thu Apr 1 05:25:53 2021 -0700

c++: inter-cluster import order [PR 99283]

I finally managed to reduce the testcase without hitting other bugs.
This problem is caused by discovering a duplicate in the middle of
reading in the entity in question.  I had thougt the import seeding at
the beginning of a cluster prevented that, but it is insufficient.
Specifically an earlier cluster in the same module can cause the
import of a duplicate.  Although clusters within a module are
well-ordered, there is no ordering between clusters of one module and
clusters of another module.  And thus we can get duplicate declaration
loops.  This prevents the problem by also seeding references to
earlier clusters in the same module.  As the FIXME notes, it is
sufficient to reference a single entity in any particular earlier
cluster, plus, we also could determine the implicit dependencies and
prune that seeding even further.  I do not do that -- it decrease the
loading that will happen, but would reduce the serialization size.  As
ever, let's get correctness first.

PR c++/99283
gcc/cp/
* module.cc (trees_out::decl_node): Adjust importedness reference
assert.
(module_state::intercluster_seed): New.  Seed both imports and
inter-cluster references.  Broken out of ...
(module_state::write_cluster): ... here.  Call it.
gcc/testsuite/
* g++.dg/modules/pr99283-6.h: New.
* g++.dg/modules/pr99283-6_a.H: New.
* g++.dg/modules/pr99283-6_b.H: New.
* g++.dg/modules/pr99283-6_c.C: New.
* g++.dg/modules/hdr-init-1_c.C: Adjust scan.
* g++.dg/modules/indirect-3_c.C: Adjust scan.
* g++.dg/modules/indirect-4_c.C: Adjust scan.
* g++.dg/modules/lambda-3_b.C: Adjust scan.
* g++.dg/modules/late-ret-3_c.C: Adjust scan.
* g++.dg/modules/pr99425-1_b.H: Adjust scan.
* g++.dg/modules/pr99425-1_c.C: Adjust scan.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-30 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #16 from Alexander Lelyakin  ---
Still reproduces:

/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header system_error
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header type_traits
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header ccomplex

In file included from /usr/local/include/c++/11.0.1/ios:42,
 from /usr/local/include/c++/11.0.1/istream:38,
 from /usr/local/include/c++/11.0.1/sstream:38,
 from /usr/local/include/c++/11.0.1/complex:45,
 from /usr/local/include/c++/11.0.1/ccomplex:39:
/usr/local/include/c++/11.0.1/bits/ios_base.h:205:69: internal compiler error:
in assert_definition, at cp/module.cc:4491
  205 |   template <> struct is_error_code_enum : public true_type {
};
  | ^
0x6e20eb trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4491
0xa5db60 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11323
0xa6d21f trees_in::read_function_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11403
0xa6f711 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14806
0xa6fd8d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18068
0xa6fe4f module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18726
0xa6a0d0 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9661
0xa6aee6 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6662
0xa68937 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7057
0xa68937 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8927
0xa68d6f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9145
0xa6ab71 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6413
0xa68937 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7057
0xa68937 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8927
0xa68d6f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9145
0xa6ab71 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6413
0xa68937 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7057
0xa68937 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8927
0xa68d6f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9145
0xa6ab71 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6413
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210330 (experimental)
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.

commit 5f3c6027257118469a722816e228394b5978ddb0 (HEAD -> master, origin/trunk,
origin/master, origin/HEAD)
Author: Nathan Sidwell 
Date:   Tue Mar 30 09:45:59 2021 -0700

c++: duplicate const static members [PR 99283]

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-30 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #15 from Nathan Sidwell  ---
another one encountered on the way ...
* 5f3c6027257 2021-03-30 | c++: duplicate const static members [PR 99283]

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-30 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #14 from CVS Commits  ---
The master branch has been updated by Nathan Sidwell :

https://gcc.gnu.org/g:5f3c6027257118469a722816e228394b5978ddb0

commit r11-7915-g5f3c6027257118469a722816e228394b5978ddb0
Author: Nathan Sidwell 
Date:   Tue Mar 30 09:45:59 2021 -0700

c++: duplicate const static members [PR 99283]

This is the bug that keeps on giving.  Reducing it has been successful
at hitting other defects. In this case, some more specialization hash
table fun, plus an issue with reading in a definition of a duplicated
declaration.  At least I discovered a null context check is no longer
needed.

PR c++/99283
gcc/cp/
* module.cc (dumper::operator): Make less brittle.
(trees_out::core_bools): VAR_DECLs always have a context.
(trees_out::key_mergeable): Use same_type_p for asserting.
(trees_in::read_var_def): Propagate
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P.
gcc/testsuite/
* g++.dg/modules/pr99283-5.h: New.
* g++.dg/modules/pr99283-5_a.H: New.
* g++.dg/modules/pr99283-5_b.H: New.
* g++.dg/modules/pr99283-5_c.C: New.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-27 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #13 from Alexander Lelyakin  ---
There is a shorter sequence:

/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header ratio
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header ios
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header
condition_variable

In file included from /usr/local/include/c++/11.0.1/bits/unique_ptr.h:42,
 from /usr/local/include/c++/11.0.1/bits/shared_ptr_base.h:59,
 from /usr/local/include/c++/11.0.1/bits/shared_ptr.h:53,
 from /usr/local/include/c++/11.0.1/condition_variable:43:
/usr/local/include/c++/11.0.1/ostream:58:42: internal compiler error: in
assert_definition, at cp/module.cc:4491
   58 | class basic_ostream : virtual public basic_ios<_CharT, _Traits>
  |  ^
0x6e20cf trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4491
0xa5db10 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11321
0xa6d14f trees_in::read_function_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11401
0xa6f611 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14800
0xa6fc8d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18062
0xa6fe48 lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*)
../../gcc/gcc/cp/module.cc:18753
0xa81b8e name_lookup::search_namespace_only(tree_node*)
../../gcc/gcc/cp/name-lookup.c:928
0xa831bb name_lookup::search_unqualified(tree_node*, cp_binding_level*)
../../gcc/gcc/cp/name-lookup.c:1158
0xa85eb4 lookup_name_1
../../gcc/gcc/cp/name-lookup.c:7804
0xa8607a lookup_name(tree_node*, LOOK_where, LOOK_want)
../../gcc/gcc/cp/name-lookup.c:7824
0xa94d02 lookup_name(tree_node*, LOOK_want)
../../gcc/gcc/cp/name-lookup.h:401
0xa94d02 cp_parser_lookup_name
../../gcc/gcc/cp/parser.c:29375
0xabd64f cp_parser_template_name
../../gcc/gcc/cp/parser.c:17709
0xabdb8f cp_parser_template_id
../../gcc/gcc/cp/parser.c:17324
0xabe3eb cp_parser_class_name
../../gcc/gcc/cp/parser.c:24692
0xab595a cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:7002
0xab595a cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6684
0xaa974c cp_parser_base_specifier
../../gcc/gcc/cp/parser.c:26711
0xaa974c cp_parser_base_clause
../../gcc/gcc/cp/parser.c:26564
0xaa974c cp_parser_class_head
../../gcc/gcc/cp/parser.c:25651
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210327 (experimental)
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.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-27 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #12 from Alexander Lelyakin  ---
Still reproduces:

/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header fstream
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header string_view
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header mutex
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header future

In file included from /usr/local/include/c++/11.0.1/bits/shared_ptr_base.h:53,
 from /usr/local/include/c++/11.0.1/bits/shared_ptr.h:53,
 from /usr/local/include/c++/11.0.1/condition_variable:43,
 from /usr/local/include/c++/11.0.1/future:39:
/usr/local/include/c++/11.0.1/bits/allocated_ptr.h:48:32: internal compiler
error: in assert_definition, at cp/module.cc:4491
   48 |   using pointer = typename allocator_traits<_Alloc>::pointer;
  |^~~~
0x6e20cf trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4491
0xa5db10 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11321
0xa6d607 trees_in::read_var_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11509
0xa6f611 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14800
0xa6fc8d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18062
0xa6fd4f module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18720
0xa6a000 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9662
0xa6aaa1 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6414
0xa68867 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7058
0xa68867 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8928
0xa68c9f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9146
0xa6aaa1 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6414
0xa68867 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7058
0xa68867 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8928
0xa68c9f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9146
0xa6b1f2 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6622
0xa68867 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7058
0xa68867 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8928
0xa68c9f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9146
0xa6b200 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6623
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210326 (experimental)
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.

commit 42a21b4cb540be93548a6ff6d4cb4a73ab1665be

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-26 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #11 from Nathan Sidwell  ---
more fixes

* d82797420c2 2021-03-26 | c++: imported templates and alias-template changes
[PR 99283

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-26 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #10 from CVS Commits  ---
The master branch has been updated by Nathan Sidwell :

https://gcc.gnu.org/g:d82797420c2238e31a7a25fe6db6bd05cd37224d

commit r11-7866-gd82797420c2238e31a7a25fe6db6bd05cd37224d
Author: Nathan Sidwell 
Date:   Fri Mar 26 10:46:31 2021 -0700

c++: imported templates and alias-template changes [PR 99283]

During development of modules, I had difficulty deciding whether the
module flags of a template should live on the decl_template_result,
the template_decl, or both.  I chose the latter, and require them to
be consistent.  This and a few other defects show how hard that
consistency is.  Hence this patch move to holding the flags on the
template-decl-result decl.  That's the entity various bits of the
parser have at the appropriate time.   Once needs STRIP_TEMPLATE in a
bunch of places, which this patch adds.  Also a check that we never
give a TEMPLATE_DECL to the module flag accessors.

This left a problem with how I was handling template aliases.  These
were in two parts -- separating the TEMPLATE_DECL from the TYPE_DECL.
That seemed somewhat funky, but development showed it necessary.  Of
course, that causes problems if the TEMPLATE_DECL cannot contain 'am
imported' information.  Investigating now shows that we do not need to
treat them separately.  By reverting a bit of template instantiation
machinery that caused the problem, we're back on course.  I think what
has happened is that between then and now, other typedef fixes have
corrected the underlying problem this separation was working around.
It allows a bunch of cleanup in the decl streamer, as we no longer
have to handle a null TEMPLATE_DECL_RESULT.

PR c++/99283
gcc/cp/
* cp-tree.h (DECL_MODULE_CHECK): Ban TEMPLATE_DECL.
(SET_TYPE_TEMPLATE_INFO): Restore Alias template setting.
* decl.c (duplicate_decls): Remove template_decl module flag
propagation.
* module.cc (merge_kind_name): Add alias tmpl spec as a thing.
(dumper::impl::nested_name): Adjust for template-decl module flag
change.
(trees_in::assert_definition): Likewise.
(trees_in::install_entity): Likewise.
(trees_out::decl_value): Likewise.  Remove alias template
separation of template and type_decl.
(trees_in::decl_value): Likewise.
(trees_out::key_mergeable): Likewise,
(trees_in::key_mergeable): Likewise.
(trees_out::decl_node): Adjust for template-decl module flag
change.
(depset::hash::make_dependency): Likewise.
(get_originating_module, module_may_redeclare): Likewise.
(set_instantiating_module, set_defining_module): Likewise.
* name-lookup.c (name_lookup::search_adl): Likewise.
(do_pushdecl): Likewise.
* pt.c (build_template_decl): Likewise.
(lookup_template_class_1): Remove special alias_template handling
of DECL_TI_TEMPLATE.
(tsubst_template_decl): Likewise.
gcc/testsuite/
* g++.dg/modules/pr99283-2_a.H: New.
* g++.dg/modules/pr99283-2_b.H: New.
* g++.dg/modules/pr99283-2_c.H: New.
* g++.dg/modules/pr99283-3_a.H: New.
* g++.dg/modules/pr99283-3_b.H: New.
* g++.dg/modules/pr99283-4.H: New.
* g++.dg/modules/tpl-alias-1_a.H: Adjust scans.
* g++.dg/modules/tpl-alias-1_b.C: Adjust scans.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-24 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #9 from Alexander Lelyakin  ---
There is a shorter sequence:

/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header fstream
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header string_view
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header mutex
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header future

In file included from /usr/local/include/c++/11.0.1/bits/shared_ptr_base.h:53,
 from /usr/local/include/c++/11.0.1/bits/shared_ptr.h:53,
 from /usr/local/include/c++/11.0.1/condition_variable:43,
 from /usr/local/include/c++/11.0.1/future:39:
/usr/local/include/c++/11.0.1/bits/allocated_ptr.h:48:32: internal compiler
error: in assert_definition, at cp/module.cc:4484
   48 |   using pointer = typename allocator_traits<_Alloc>::pointer;
  |^~~~
0x6e204d trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4484
0xa5d810 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11362
0xa6d497 trees_in::read_var_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11550
0xa6f4a1 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14855
0xa6fb1d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18117
0xa6fbdf module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18778
0xa69e80 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9700
0xa6a921 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6407
0xa686e7 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7051
0xa686e7 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8966
0xa68b1f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9184
0xa6a921 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6407
0xa686e7 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7051
0xa686e7 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8966
0xa68b1f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9184
0xa6b072 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6615
0xa686e7 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7051
0xa686e7 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8966
0xa68b1f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9184
0xa6b080 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6616
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210324 (experimental)
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.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-24 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #8 from Alexander Lelyakin  ---
Still reproducible:

/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header charconv
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header fstream
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header mutex
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header cfloat
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header stdexcept
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header ios
/usr/local/bin/g++ -std=c++20 -fmodules-ts -x c++-system-header filesystem

In file included from /usr/local/include/c++/11.0.1/bits/unique_ptr.h:42,
 from /usr/local/include/c++/11.0.1/bits/locale_conv.h:41,
 from /usr/local/include/c++/11.0.1/locale:43,
 from /usr/local/include/c++/11.0.1/bits/fs_path.h:37,
 from /usr/local/include/c++/11.0.1/filesystem:45:
/usr/local/include/c++/11.0.1/ostream:58:42: internal compiler error: in
assert_definition, at cp/module.cc:4484
   58 | class basic_ostream : virtual public basic_ios<_CharT, _Traits>
  |  ^
0x6e204d trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4484
0xa5d810 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11362
0xa6d773 trees_in::read_class_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11842
0xa6f4a1 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14855
0xa6fb1d module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18117
0xa6fcd8 lazy_load_binding(unsigned int, tree_node*, tree_node*, binding_slot*)
../../gcc/gcc/cp/module.cc:18811
0xa81ace name_lookup::search_namespace_only(tree_node*)
../../gcc/gcc/cp/name-lookup.c:928
0xa830fb name_lookup::search_unqualified(tree_node*, cp_binding_level*)
../../gcc/gcc/cp/name-lookup.c:1158
0xa84cf4 lookup_name_1
../../gcc/gcc/cp/name-lookup.c:7802
0xa84eba lookup_name(tree_node*, LOOK_where, LOOK_want)
../../gcc/gcc/cp/name-lookup.c:7822
0xa94c62 lookup_name(tree_node*, LOOK_want)
../../gcc/gcc/cp/name-lookup.h:401
0xa94c62 cp_parser_lookup_name
../../gcc/gcc/cp/parser.c:29368
0xabd58f cp_parser_template_name
../../gcc/gcc/cp/parser.c:17708
0xabdacf cp_parser_template_id
../../gcc/gcc/cp/parser.c:17317
0xabe32b cp_parser_class_name
../../gcc/gcc/cp/parser.c:24685
0xab589a cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:7002
0xab589a cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6684
0xaa96ac cp_parser_base_specifier
../../gcc/gcc/cp/parser.c:26704
0xaa96ac cp_parser_base_clause
../../gcc/gcc/cp/parser.c:26557
0xaa96ac cp_parser_class_head
../../gcc/gcc/cp/parser.c:25644
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210323 (experimental)
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.

gcc at commit be70bb5e4babdf9d3d33e8f4658452038407fa8e

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-23 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #7 from Nathan Sidwell  ---
found while reducing testcase

* bd71889b901 2021-03-23 | c++: Note duplicates in symbol table [PR 99283]

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-23 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Nathan Sidwell :

https://gcc.gnu.org/g:bd71889b9017751e1a06970d20b28b9fe9479bdc

commit r11-7804-gbd71889b9017751e1a06970d20b28b9fe9479bdc
Author: Nathan Sidwell 
Date:   Tue Mar 23 12:23:30 2021 -0700

c++: Note duplicates in symbol table [PR 99283]

I ran into this reducing 99283, we were failing to mark binding
vectors when the current TU declares a duplicate decl (as opposed to
an import introduces a duplicate).

PR c++/99283
gcc/cp/
* name-lookup.c (check_module_override): Set global or partition
DUP on the binding vector.
gcc/testsuite/
* g++.dg/modules/pr99283-1_a.H: New.
* g++.dg/modules/pr99283-1_b.H: New.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-12 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #5 from Alexander Lelyakin  ---
In several previous version this message was not seen, but after last commits:

g++ -std=c++20 -fmodules-ts -x c++-system-header syncstream
g++ -std=c++20 -fmodules-ts -x c++-system-header vector
g++ -std=c++20 -fmodules-ts -x c++-system-header filesystem
g++ -std=c++20 -fmodules-ts -x c++-system-header string_view
g++ -std=c++20 -fmodules-ts -x c++-system-header numbers
g++ -std=c++20 -fmodules-ts -x c++-system-header mutex
g++ -std=c++20 -fmodules-ts -x c++-system-header unordered_set
g++ -std=c++20 -fmodules-ts -x c++-system-header stack
g++ -std=c++20 -fmodules-ts -x c++-system-header future

In file included from /usr/local/include/c++/11.0.1/bits/shared_ptr_base.h:53,
 from /usr/local/include/c++/11.0.1/bits/shared_ptr.h:53,
 from /usr/local/include/c++/11.0.1/condition_variable:43,
 from /usr/local/include/c++/11.0.1/future:39:
/usr/local/include/c++/11.0.1/bits/allocated_ptr.h:48:32: internal compiler
error: in assert_definition, at cp/module.cc:4489
   48 |   using pointer = typename allocator_traits<_Alloc>::pointer;
  |^~~~
0x6e1aff trees_in::assert_definition(tree_node*, bool)
../../gcc/gcc/cp/module.cc:4489
0xa5ca00 trees_in::odr_duplicate(tree_node*, bool)
../../gcc/gcc/cp/module.cc:11351
0xa6c637 trees_in::read_var_def(tree_node*, tree_node*)
../../gcc/gcc/cp/module.cc:11543
0xa6e641 module_state::read_cluster(unsigned int)
../../gcc/gcc/cp/module.cc:14842
0xa6ecbd module_state::load_section(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18104
0xa6ed7f module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/gcc/cp/module.cc:18758
0xa68fc0 trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9681
0xa69a61 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6412
0xa67827 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7056
0xa67827 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8947
0xa67c5f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9165
0xa69a61 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6412
0xa67827 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7056
0xa67827 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8947
0xa67c5f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9165
0xa6a1b2 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6620
0xa67827 trees_in::tree_node_vals(tree_node*)
../../gcc/gcc/cp/module.cc:7056
0xa67827 trees_in::tree_value()
../../gcc/gcc/cp/module.cc:8947
0xa67c5f trees_in::tree_node(bool)
../../gcc/gcc/cp/module.cc:9165
0xa6a1c0 trees_in::core_vals(tree_node*)
../../gcc/gcc/cp/module.cc:6621
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

g++ (GCC) 11.0.1 20210312 (experimental)
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.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-05 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #4 from Alexander Lelyakin  ---
ICE in assert_definition is not seen in version 20210305.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-05 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #3 from Alexander Lelyakin  ---
Following sequence:
-
g++ -std=c++20 -fmodules-ts -x c++-system-header ostream
g++ -std=c++20 -fmodules-ts -x c++-system-header any
g++ -std=c++20 -fmodules-ts -x c++-system-header execution
g++ -std=c++20 -fmodules-ts -x c++-system-header limits
g++ -std=c++20 -fmodules-ts -x c++-system-header cstdarg
g++ -std=c++20 -fmodules-ts -x c++-system-header type_traits
g++ -std=c++20 -fmodules-ts -x c++-system-header ctime
g++ -std=c++20 -fmodules-ts -x c++-system-header locale
-
Before it produce ICE in assert_definition.
Now it produces another error:
-
In file included from /usr/local/include/c++/11.0.1/bits/locale_conv.h:41,
 from /usr/local/include/c++/11.0.1/locale:43:
/usr/local/include/c++/11.0.1/bits/unique_ptr.h:74:60: internal compiler error:
tree check: expected tree_vec, have ggc_freed in lookup_template_class_1, at
cp/pt.c:9803
   74 |typename = _Require>>
  |^
0x875966 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9814
0x71d27b tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:3353
0x71d27b lookup_template_class_1
../../gcc/gcc/cp/pt.c:9803
0xb21d1c lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
../../gcc/gcc/cp/pt.c:10237
0xb49afb finish_template_type(tree_node*, tree_node*, int)
../../gcc/gcc/cp/semantics.c:3498
0xabbd21 cp_parser_template_id
../../gcc/gcc/cp/parser.c:17444
0xabbf0b cp_parser_class_name
../../gcc/gcc/cp/parser.c:24671
0xab349a cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:6994
0xab349a cp_parser_nested_name_specifier_opt
../../gcc/gcc/cp/parser.c:6676
0xac8bf4 cp_parser_simple_type_specifier
../../gcc/gcc/cp/parser.c:18837
0xaa798d cp_parser_type_specifier
../../gcc/gcc/cp/parser.c:18495
0xab9753 cp_parser_type_specifier_seq
../../gcc/gcc/cp/parser.c:23346
0xab7dd4 cp_parser_type_id_1
../../gcc/gcc/cp/parser.c:23149
0xaba3b3 cp_parser_template_type_arg
../../gcc/gcc/cp/parser.c:23254
0xaba4df cp_parser_template_argument
../../gcc/gcc/cp/parser.c:17894
0xaba4df cp_parser_template_argument_list
../../gcc/gcc/cp/parser.c:17805
0xaba4df cp_parser_enclosed_template_argument_list
../../gcc/gcc/cp/parser.c:30775
0xabb80c cp_parser_template_id
../../gcc/gcc/cp/parser.c:17377
0xabbf0b cp_parser_class_name
../../gcc/gcc/cp/parser.c:24671
0xab349a cp_parser_qualifying_entity
../../gcc/gcc/cp/parser.c:6994
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

--
g++ (GCC) 11.0.1 20210305 (experimental)

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-05 Thread alexander.lelyakin at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

--- Comment #2 from Alexander Lelyakin  ---
It is(was) reproducible in version:
g++ (GCC) 11.0.1 20210303 (experimental)

Last version I will check tomorrow.

[Bug c++/99283] [modules] ICE in assert_definition, at cp/module.cc:4608

2021-03-05 Thread nathan at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99283

Nathan Sidwell  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Last reconfirmed||2021-03-05
 Status|UNCONFIRMED |WAITING

--- Comment #1 from Nathan Sidwell  ---
Can (no longer?) reproduce.  Is it working for you now?