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

            Bug ID: 123345
           Summary: ICE: error reporting routines re-entered with an
                    alignment attribute
           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/49sWxvnzr

The ICE occurs in the C++ frontend when attempting to take the address of a
compound literal array whose element type has an alignment attribute greater
than its size. The compiler correctly identifies the alignment conflict but
fails to recover, leading to a recursive error-reporting crash.

Program:
```c
typedef struct CFI_cdesc_t {
    int i;
} T __attribute__((aligned(16)));

int main() {
    T *p ;
    p = &((T[]){*p}); 
}
```

Traceback:
```
internal compiler error: error reporting routines re-entered.
0x5da0e75 error(char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:397
0x27134ce layout_type(tree_node*)
        /workspace/install/gcc/src/gcc/gcc/stor-layout.cc:2753
0x163cf96 build_cplus_array_type(tree_node*, tree_node*, int)
        /workspace/install/gcc/src/gcc/gcc/cp/tree.cc:1199
0x164061e strip_typedefs(tree_node*, bool*, unsigned int)
        /workspace/install/gcc/src/gcc/gcc/cp/tree.cc:1706
0x163fef8 strip_typedefs(tree_node*, bool*, unsigned int)
        /workspace/install/gcc/src/gcc/gcc/cp/tree.cc:1681
0x117b567 type_to_string
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:3582
0x1181df9 cxx_format_postprocessor::handle(pretty_printer*)
        /workspace/install/gcc/src/gcc/gcc/cp/error.cc:4598
0x5df4577 pretty_printer::format(text_info&)
        /workspace/install/gcc/src/gcc/gcc/pretty-print.cc:1716
0x18ac446 pp_format(pretty_printer*, text_info*)
        /workspace/install/gcc/src/gcc/gcc/pretty-print.h:594
0x5d3e8a4 diagnostic_context::report_diagnostic(diagnostic_info*)
        /workspace/install/gcc/src/gcc/gcc/diagnostic.cc:1505
0x5d3f2b7 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        /workspace/install/gcc/src/gcc/gcc/diagnostic.cc:1641
0x5da1431 error_at(rich_location*, char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:439
0x16d9050 convert_for_assignment
        /workspace/install/gcc/src/gcc/gcc/cp/typeck.cc:10619
0x16d593e cp_build_modify_expr(unsigned long, tree_node*, tree_code,
tree_node*, int)
        /workspace/install/gcc/src/gcc/gcc/cp/typeck.cc:9995
0x16d6120 build_x_modify_expr(unsigned long, tree_node*, tree_code, tree_node*,
tree_node*, int)
        /workspace/install/gcc/src/gcc/gcc/cp/typeck.cc:10070
0x137f4eb cp_parser_assignment_expression
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:11136
0x137fa66 cp_parser_expression
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:11281
0x138b392 cp_parser_expression_statement
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:13598
0x138a175 cp_parser_statement
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:13342
0x138c529 cp_parser_statement_seq_opt
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:13861
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++/123345] New: IC... 522024330006 at smail dot nju.edu.cn via Gcc-bugs

Reply via email to