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

            Bug ID: 112504
           Summary: gcc: 14: internal compiler error: in operand_equal_p,
                    at fold-const.cc:3313
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/YdETsKzeb

When compiling this program with `gcc-14 -O0`, gcc crashes:
```
struct s {
  char c[1];
};
extern struct s foo(void);
void bar(void) {
  foo().c == foo().c;
}
```

The crash output:
```
<source>: In function 'bar':
<source>:6:3: internal compiler error: in operand_equal_p, at
fold-const.cc:3313
    6 |   foo().c == foo().c;
      |   ^~~
0x238b15e internal_error(char const*, ...)
        ???:0
0xa11270 fancy_abort(char const*, int, char const*)
        ???:0
0xd0bd67 operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
        ???:0
0xd0b6e4 operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
        ???:0
0xd25837 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ???:0
0xd45c84 fold(tree_node*)
        ???:0
0xac0aef c_fully_fold(tree_node*, bool, bool*, bool)
        ???:0
0xa574e3 c_process_expr_stmt(unsigned int, tree_node*)
        ???:0
0xa57711 c_finish_expr_stmt(unsigned int, tree_node*)
        ???:0
0xabd40d c_parse_file()
        ???:0
0xb30909 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
```

Reply via email to