On Sat, 4 Feb 2017, Prathamesh Kulkarni wrote: > Hi, > The following test-case ICE's with -fgimple: > > int __GIMPLE foo(int a) > { > int t1; > t1_1 = __builtin_abs (a); > return t1_1; > } > > gimplefe-2.c:4:3: internal compiler error: in get_callee_fndecl, at > tree.c:9500 > t1_1 = __builtin_abs (a); > ^~~~ > 0xe96e8d get_callee_fndecl(tree_node const*) > ../../gcc/gcc/tree.c:9500 > 0x924d75 gimple_build_call_from_tree(tree_node*) > ../../gcc/gcc/gimple.c:351 > 0x6c86b3 c_parser_gimple_statement > ../../gcc/gcc/c/gimple-parser.c:393 > 0x6c86b3 c_parser_gimple_compound_statement > ../../gcc/gcc/c/gimple-parser.c:216 > 0x6c86b3 c_parser_parse_gimple_body(c_parser*) > ../../gcc/gcc/c/gimple-parser.c:93 > 0x6b04f1 c_parser_declaration_or_fndef > ../../gcc/gcc/c/c-parser.c:2081 > 0x6b883b c_parser_external_declaration > ../../gcc/gcc/c/c-parser.c:1464 > 0x6b92a1 c_parser_translation_unit > ../../gcc/gcc/c/c-parser.c:1344 > 0x6b92a1 c_parse_file() > ../../gcc/gcc/c/c-parser.c:18141 > 0x717832 c_common_parse_file() > ../../gcc/gcc/c-family/c-opts.c:1102 > > This happens because __builtin_abs(a) gets folded to <nop_expr<abs_expr<a>> > and get_callee_fndecl expects CALL_EXPR. > > The attached patch tries to fix the issue by building gimple_assign > with appropriate subcode > for functions that get folded to expression instead of trying to build > it as a function-call. > Is it OK to commit after bootstrap+test ?
No. The proper fix is to not use the C frontend call-expr parsing and building -- it does have many more issues I think. Richard. > Thanks, > Prathamesh > -- Richard Biener <rguent...@suse.de> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)