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

            Bug ID: 98204
           Summary: ICE in pointer_diff, at c/c-typeck.c:3954
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gs...@t-online.de
  Target Milestone: ---

Following options produce an ICE for a bunch of testsuite files,
e.g. with file 920928-1.c (down to version r8) :


$ cat 920928-1.c
struct{int c;}v;
static long i=((char*)&(v.c)-(char*)&v);


$ gcc-11-20201206 -c 920928-1.c -fsanitize=address -fsanitize=pointer-subtract
920928-1.c:2:1: internal compiler error: in pointer_diff, at c/c-typeck.c:3954
    2 | static long i=((char*)&(v.c)-(char*)&v);
      | ^~~~~~
0x65f8d2 pointer_diff
        ../../gcc/c/c-typeck.c:3954
0x65f8d2 build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, bool)
        ../../gcc/c/c-typeck.c:11750
0x660364 parser_build_binary_op(unsigned int, tree_code, c_expr, c_expr)
        ../../gcc/c/c-typeck.c:3759
0x677460 c_parser_binary_expression
        ../../gcc/c/c-parser.c:8005
0x6780b5 c_parser_conditional_expression
        ../../gcc/c/c-parser.c:7598
0x678611 c_parser_expr_no_commas
        ../../gcc/c/c-parser.c:7513
0x678882 c_parser_expression
        ../../gcc/c/c-parser.c:10606
0x66c1cc c_parser_postfix_expression
        ../../gcc/c/c-parser.c:9092
0x675dc2 c_parser_unary_expression
        ../../gcc/c/c-parser.c:8230
0x676def c_parser_cast_expression
        ../../gcc/c/c-parser.c:8072
0x6770a9 c_parser_binary_expression
        ../../gcc/c/c-parser.c:7875
0x6780b5 c_parser_conditional_expression
        ../../gcc/c/c-parser.c:7598
0x678611 c_parser_expr_no_commas
        ../../gcc/c/c-parser.c:7513
0x67ea29 c_parser_initializer
        ../../gcc/c/c-parser.c:5206
0x68c98a c_parser_declaration_or_fndef
        ../../gcc/c/c-parser.c:2276
0x693fd7 c_parser_external_declaration
        ../../gcc/c/c-parser.c:1777
0x694af9 c_parser_translation_unit
        ../../gcc/c/c-parser.c:1650
0x694af9 c_parse_file()
        ../../gcc/c/c-parser.c:21877
0x6e4782 c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1211

Reply via email to