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

            Bug ID: 100595
           Summary: ICE: output_operand: invalid expression as operand
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210514 (experimental) [master revision
:e5c3c8afa:f3b1516d9dfd969d7cc1ca6f26dec13478a1c458] (GCC)

$ cat mutant.c
typedef __UINTPTR_TYPE__ uintptr_t;
test2() {
  static uintptr_t a = &&l1 + ((char *)&&l1 - (char *)&&l2);
l1:
l2:
  return a;
}

$ gcc-trunk  mutant.c
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | test2() {
      | ^~~~~
mutant.c: In function ‘test2’:
mutant.c:3:24: warning: initialization of ‘uintptr_t’ {aka ‘long unsigned int’}
from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
    3 |   static uintptr_t a = &&l1 + ((char *)&&l1 - (char *)&&l2);
      |                        ^~
mutant.c: At top level:
mutant.c:7:1: internal compiler error: output_operand: invalid expression as
operand
    7 | }
      | ^
0xb7f867 output_operand_lossage(char const*, ...)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/final.c:3238
0xb80341 output_addr_const(_IO_FILE*, rtx_def*)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/final.c:3835
0xb80123 output_addr_const(_IO_FILE*, rtx_def*)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/final.c:3810
0x1240c82 assemble_integer_with_op(char const*, rtx_def*)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2866
0x1240ce1 default_assemble_integer(rtx_def*, unsigned int, int)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2882
0x1240d60 assemble_integer(rtx_def*, unsigned int, unsigned int, int)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2898
0x1247cc8 output_constant
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:5267
0x1249f74 output_constant
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:5172
0x1249f74 assemble_variable_contents
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2235
0x1253cfc assemble_variable(tree_node*, int, int, int)
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varasm.c:2414
0x1256dc9 varpool_node::assemble_decl()
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/varpool.c:595
0xa80549 output_in_order
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2135
0xa80549 symbol_table::compile()
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2353
0xa8365b symbol_table::compile()
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2269
0xa8365b symbol_table::finalize_compilation_unit()
        /tmp/tmp.eZIsobWkq2-gcc-builder/gcc/gcc/cgraphunit.c:2537
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to