[Bug c++/99023] [modules] ICE/SIGSEGV in module_state::write_define

2021-03-03 Thread boris at kolpackov dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99023

--- Comment #5 from Boris Kolpackov  ---
Can confirm works for me, thanks!

[Bug c++/99023] [modules] ICE/SIGSEGV in module_state::write_define

2021-02-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99023

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

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

commit r11-7283-g1f9db6929d926222aee0628b93f77cd20cf3adc4
Author: Nathan Sidwell 
Date:   Thu Feb 18 12:46:25 2021 -0800

c++: header-unit build capability [PR 99023]

This defect really required building header-units and include translation
of pieces of the standard library.  This adds smarts to the modules
test harness to do that -- accept .X files as the source file, but
provide '-x c++-system-header $HDR' in the options.  The .X file will
be considered by the driver to be a linker script and ignored (with a
warning).

Using this we can add 2 tests that end up building list_initializer
and iostream, along with a test that iostream's build
include-translates list_initializer's #include.  That discovered a set
of issues with the -flang-info-include-translate=HDR handling, also
fixed and documented here.

PR c++/99023
gcc/cp/
* module.cc (canonicalize_header_name): Use
cpp_probe_header_unit.
(maybe_translate_include): Fix note_includes comparison.
(init_modules): Fix note_includes string termination.
libcpp/
* include/cpplib.h (cpp_find_header_unit): Rename to ...
(cpp_probe_header_unit): ... this.
* internal.h (_cp_find_header_unit): Declare.
* files.c (cpp_find_header_unit): Break apart to ..
(test_header_unit): ... this, and ...
(_cpp_find_header_unit): ... and, or and ...
(cpp_probe_header_unit): ... this.
* macro.c (cpp_get_token_1): Call _cpp_find_header_unit.
gcc/
* doc/invoke.texi (flang-info-include-translate): Document header
lookup behaviour.
gcc/testsuite/
* g++.dg/modules/modules.exp: Bail on cross-testing.  Add support
for .X files.
* g++.dg/modules/pr99023_a.X: New.
* g++.dg/modules/pr99023_b.X: New.

[Bug c++/99023] [modules] ICE/SIGSEGV in module_state::write_define

2021-02-18 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99023

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

https://gcc.gnu.org/g:1021222ee4d291ccb4f49cd0ae3393c83d8ff5d0

commit r11-7281-g1021222ee4d291ccb4f49cd0ae3393c83d8ff5d0
Author: Nathan Sidwell 
Date:   Thu Feb 18 07:33:12 2021 -0800

c++: Remove obsolete dg-module-headers [PR 99023]

PR99023's testcase is highlighting some missing functionality of the
modules test harness.  I did have some partial support, but it's only
use in one place for a now-obsolete test.  This patch expunges that
support so I can add better functionality now I understand better what
is necessary.

PR c++/99023
gcc/testsuite/
* g++.dg/modules/modules.exp: Remove dg-module-headers support
* g++.dg/modules/alias-2_a.H: Delete.
* g++.dg/modules/sys/alias-2_a.H: Delete.

[Bug c++/99023] [modules] ICE/SIGSEGV in module_state::write_define

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

Nathan Sidwell  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Nathan Sidwell  ---
d8889c99aab 2021-02-17 | c++: Macros need to be GTY-reachable [PR 99023]

[Bug c++/99023] [modules] ICE/SIGSEGV in module_state::write_define

2021-02-17 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99023

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

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

commit r11-7271-gd8889c99aab4b599aa7ceb7079e69a9766171336
Author: Nathan Sidwell 
Date:   Wed Feb 17 10:43:21 2021 -0800

c++: Macros need to be GTY-reachable [PR 99023]

I'd missed that macros were allocated from GC storage, and that they can
become unattached from an identifier, and therefore not GC-reachable.
And then bad things happen.   Fixed by making the module machinery's
reference vector a GC root.

PR c++/99023
gcc/cp/
* module.cc (struct macro_export): Add GTY markers.
(macro_exports): Likewise, us a va_gc Vector.
gcc/testsuite/
* g++.dg/modules/pr99023_a.H: New.
* g++.dg/modules/pr99023_b.H: New.