https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123493

            Bug ID: 123493
           Summary: ICE: error reporting routines re-entered via invalid
                    array alignment and sizeof syntax
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

To reproduce: https://godbolt.org/z/9jedP46rf

Similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101070

GCC crashes with an ICE "error reporting routines re-entered" when attempting
to report errors on a code snippet involving an invalid array alignment (where
alignment is greater than element size) combined with a malformed sizeof
expression.

Program:
```
typedef short ashorts __attribute__((aligned(16)));
ashorts Kernshort[2][1]; 

int main() {
    auto* p = &Kernshort[0 % sizeof(Kernshort/[])];
    return 0;
}
```

Part of the traceback:
```
internal compiler error: error reporting routines re-entered.
0x291ad30
diagnostics::context::report_diagnostic(diagnostics::diagnostic_info*)
        ???:0
0x291af48 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x290eb89 error(char const*, ...)
        ???:0
0xc40ead pp_markup::element_quoted_type::print_type(pp_markup::context&)
        ???:0
0xb50eb0 pp_markup::element_quoted_type::add_to_phase_2(pp_markup::context&)
        ???:0
0x297d001 pretty_printer::format(text_info&)
        ???:0
0x291a843
diagnostics::context::report_diagnostic(diagnostics::diagnostic_info*)
        ???:0
0x291af48 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x290f306 error_at(rich_location*, char const*, ...)
        ???:0
0xb4fed7 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ???:0
0xe1ea42 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ???:0
0xd542e3 c_parse_file()
        ???:0
0xec5d19 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.
```
  • [Bug c++/123493] New: IC... 522024330006 at smail dot nju.edu.cn via Gcc-bugs

Reply via email to