Message ID | 20160126163906.GC3017@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On Jan 26, 2016, at 8:39 AM, Jakub Jelinek <jakub@redhat.com> wrote: > On Tue, Jan 26, 2016 at 02:56:24PM +0100, Jakub Jelinek wrote: >> Another alternative would be to make sure tree folders don't introduce >> error_mark_node (if it wasn't there already), but instead fold the call say >> to build_int_cst (returntype, 0). The known cases that would need to change >> are at least darwin_build_constant_cfstring and darwin_fold_builtin, but >> maybe others. > > Here is the alternative (but it is unclear if other targets don't have > similar issues in their folders). So, Jason needs to make the decision on which patch he prefers. If he prefers that error mark node not be generated this late, then the below patch is Ok.
--- gcc/config/darwin.c.jj 2016-01-04 14:55:54.000000000 +0100 +++ gcc/config/darwin.c 2016-01-26 17:28:12.489018588 +0100 @@ -3345,19 +3345,17 @@ darwin_fold_builtin (tree fndecl, int n_ if (fcode == darwin_builtin_cfstring) { if (!darwin_constant_cfstrings) + error ("built-in function %qD requires the" + " %<-mconstant-cfstrings%> flag", fndecl); + else if (n_args != 1) + error ("built-in function %qD takes one argument only", fndecl); + else { - error ("built-in function %qD requires the" - " %<-mconstant-cfstrings%> flag", fndecl); - return error_mark_node; + tree ret = darwin_build_constant_cfstring (*argp); + if (ret != error_mark_node) + return ret; } - - if (n_args != 1) - { - error ("built-in function %qD takes one argument only", fndecl); - return error_mark_node; - } - - return darwin_build_constant_cfstring (*argp); + return build_int_cst (TREE_TYPE (TREE_TYPE (fndecl)), 0); } return NULL_TREE;