This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[GIMPLE FE] Fix ICE's with default ssa-name parsing in c_parser_gimple_postfix_expression


Hi,
For the following test-case:

int __GIMPLE () foo (int a)
{
  return t0_1(D);
}

The compiler emits the undeclared diagnostic and then ICE's in
c_parser_gimple_postfix_expression because we don't check if
c_parser_parse_ssa_name returned error_mark_node.
ICE: https://gist.github.com/anonymous/45a01338d80faf4f21330bc9ee97ca5f

For this test-case:
int __GIMPLE() foo(int a)
{
  int _1;
  return _1(D);
}

c_parser_gimple_postfix_expression calls set_ssa_default_def which
crashes with segfault
because SSA_VAR_P(_1) is NULL and set_ssa_default_def expects it to be non-null.
ICE: https://gist.github.com/anonymous/1df5a4e8a59eca289e214bbaf07a461a

The patch rejects the above test-case with:
foo.c: In function ‘foo’:
foo.c:4:10: error: anonymous SSA name cannot have default definition
   return _1(D);

OK to commit after bootstrap+test ?

Thanks,
Prathamesh

Attachment: foo.diff
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]