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

            Bug ID: 89691
           Summary: ICE on a MEM_REF plus negative offset in gimple
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

Like in pr89690, I tried the following while attempting to come up with a test
case to exercise -Warray-bounds with pointer to a VLA and got another ICE (I
was using testsuite/gcc.dg/gimplefe-21.c as a template).  I have no idea if the
'+ -2' syntax is meant to be valid.  It seems to like the hex offset.

$ cat z.c && gcc -O2 -S -Wall -fdump-tree-gimple=/dev/stdout -fgimple z.c
extern int x;

void __GIMPLE () g (int *p)
{
  int i;

  i = __MEM <int, 8> ((char *)p + 1);

  __MEM <int, 16> ((char *)&x + -2) = i;
  // __MEM <int, 16> ((char *)&x + 0xfffffffffffffffe) = i;   // okay
}
z.c: In function ‘g’:
z.c:9:33: error: expected expression before ‘-’ token
    9 |   __MEM <int, 16> ((char *)&x + -2) = i;
      |                                 ^
z.c:5:7: warning: variable ‘i’ set but not used [-Wunused-but-set-variable]
    5 |   int i;
      |       ^
g (int * p)
z.c:11:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in dump_generic_node, at tree-pretty-print.c:1694
   11 | }
      | ^
0x15b2de2 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        /src/gcc/git-svn/gcc/tree.c:9907
0x7f0831 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        /src/gcc/git-svn/gcc/tree.h:3299
0x12b27ea dump_generic_node(pretty_printer*, tree_node*, int, dump_flag, bool)
        /src/gcc/git-svn/gcc/tree-pretty-print.c:1694
0xcd5b97 dump_gimple_assign
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:614
0xcdb7ac pp_gimple_stmt_1(pretty_printer*, gimple*, int, dump_flag)
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:2506
0xcd44aa dump_gimple_seq
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:200
0xcd74eb dump_gimple_bind
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:1149
0xcdb7d2 pp_gimple_stmt_1(pretty_printer*, gimple*, int, dump_flag)
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:2510
0xcd44aa dump_gimple_seq
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:200
0xcd4537 print_gimple_seq(_IO_FILE*, gimple*, int, dump_flag)
        /src/gcc/git-svn/gcc/gimple-pretty-print.c:216
0x11ddfac dump_function_to_file(tree_node*, _IO_FILE*, dump_flag)
        /src/gcc/git-svn/gcc/tree-cfg.c:8043
0xae5db1 dump_function(int, tree_node*)
        /src/gcc/git-svn/gcc/dumpfile.c:2021
0x8c0bab c_parser_parse_gimple_body(c_parser*)
        /src/gcc/git-svn/gcc/c/gimple-parser.c:120
0x87e8b3 c_parser_declaration_or_fndef
        /src/gcc/git-svn/gcc/c/c-parser.c:2334
0x87ce6a c_parser_external_declaration
        /src/gcc/git-svn/gcc/c/c-parser.c:1653
0x87c96b c_parser_translation_unit
        /src/gcc/git-svn/gcc/c/c-parser.c:1534
0x8b6c3e c_parse_file()
        /src/gcc/git-svn/gcc/c/c-parser.c:19854
0x94365c c_common_parse_file()
        /src/gcc/git-svn/gcc/c-family/c-opts.c:1156
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