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

            Bug ID: 112499
           Summary: GCC: 14: internal compiler error: output_operand:
                    invalid expression as operand
           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/MdacfWqhr

When attempting to compile this program with `gcc-14 -O1`, gcc crashes:
```
#include <stdint.h>

int f(void) {
  static uintptr_t a = ((char *)&&l3 - (char *)&&l2) +
                       ((char *)&&l1 - (char *)&&l2);
l1:
l2:
l3:
  return a;
}
```

If removing the qualifier `static`, then this crash disappears.

The crash output:
```
<source>:10:1: internal compiler error: output_operand: invalid expression as
operand
   10 | }
      | ^
0x238b15e internal_error(char const*, ...)
        ???:0
0xd01147 output_operand_lossage(char const*, ...)
        ???:0
0xd01c71 output_addr_const(_IO_FILE*, rtx_def*)
        ???:0
0xd01a53 output_addr_const(_IO_FILE*, rtx_def*)
        ???:0
0xd01ae5 output_addr_const(_IO_FILE*, rtx_def*)
        ???:0
0x14cec92 assemble_integer_with_op(char const*, rtx_def*)
        ???:0
0x14cecf1 default_assemble_integer(rtx_def*, unsigned int, int)
        ???:0
0x14ced7f assemble_integer(rtx_def*, unsigned int, unsigned int, int)
        ???:0
0x14e1cae assemble_variable(tree_node*, int, int, int)
        ???:0
0x14e62ae symbol_table::output_variables()
        ???:0
0xc027bb symbol_table::finalize_compilation_unit()
        ???: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