Bug 102598 - [modules] ICE in pp_string, at pretty-print.c
Summary: [modules] ICE in pp_string, at pretty-print.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 14.0
Assignee: Nathaniel Shead
URL:
Keywords: diagnostic, ice-on-valid-code
Depends on:
Blocks: c++-modules
  Show dependency tree / graph
 
Reported: 2021-10-04 19:17 UTC by Johel Ernesto Guerrero Peña
Modified: 2024-02-11 14:00 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johel Ernesto Guerrero Peña 2021-10-04 19:17:34 UTC
See https://godbolt.org/z/3rGTTr6jE.

write.cpp:
```C++
export module write;
export void write(const auto &v) {}
```

main.cpp:
```C++
import write;
int main() { write(char{}); }
```

Compile commands:
```
gcc -Wall -Wextra -fmodules-ts -std=c++23 -c write.cpp
gcc -Wall -Wextra -fmodules-ts -std=c++23 -c main.cpp
```

Output:
```
In module write, imported at main.cpp:1:
in pp_string, at pretty-print.c:1827
0x2068f9d internal_error(char const*, ...)
	???:0
0x973872 fancy_abort(char const*, int, char const*)
	???:0
0x2086861 pp_format(pretty_printer*, text_info*)
	???:0
0x2087d92 pp_verbatim(pretty_printer*, char const*, ...)
	???:0
0x2067adf diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
	???:0
0x2068720 warning_at(unsigned int, int, char const*, ...)
	???:0
0xca067c do_warn_unused_parameter(tree_node*)
	???:0
0xa3ba82 finish_function(bool)
	???:0
0xb77dfb instantiate_decl(tree_node*, bool, bool)
	???:0
0xb9b883 instantiate_pending_templates(int)
	???:0
0xa50e3c c_parse_final_cleanups()
	???: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.
```
Comment 1 Johel Ernesto Guerrero Peña 2021-10-04 19:21:22 UTC
Attempts to reduce another wrong-code bug lead to this.
Comment 2 Johel Ernesto Guerrero Peña 2022-03-24 02:47:18 UTC
Another test case: https://godbolt.org/z/Gsfx56GM9.
Comment 3 Nathaniel Shead 2024-02-11 14:00:47 UTC
Fixed with r14-8462-gec57d183d35412.