https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117108
Bug ID: 117108
Summary: internal compiler error: error reporting routines
re-entered at build_c_cast(unsigned int, tree_node*,
cp_expr)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: yihan4845 at gmail dot com
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/G3rT9aaGW
The following program:
```cpp
typedef char __attribute__((aligned(2))) AlignedChar;
typedef AlignedChar arrayType0[4];
void test(char *p) {
auto r0 = (AlignedChar(&)[1])(*p & 1);
}
```
will trigger segmentation fault for gcc trunk.
The stack dump:
```
internal compiler error: error reporting routines re-entered.
0x285c0cf diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
0x285c505 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x286f955 error(char const*, ...)
???:0
0x28930d3 pretty_printer::format(text_info&)
???:0
0x285c222 diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
0x285c505 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x286fbcf error_at(unsigned int, char const*, ...)
???:0
0xd70f1e build_c_cast(unsigned int, tree_node*, cp_expr)
???:0
0xc989da c_parse_file()
???:0
0xdf0599 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```