> -----Original Message----- > From: Jeff Law [mailto:l...@redhat.com] > Sent: Tuesday, June 04, 2013 2:07 PM > To: Iyer, Balaji V > Cc: gcc-patches@gcc.gnu.org; Steve Ellcey > Subject: Re: [PATCH] pr57457 > > On 06/04/2013 11:37 AM, Iyer, Balaji V wrote: > > > > Yes, that does simplify the whole thing. Here is an updated ChangeLog > > and patch (with testcode) attached. So, is it Ok for trunk? > > > > gcc/testsuite/ChangeLog 2013-06-04 Balaji V. Iyer > > <balaji.v.i...@intel.com> > > > > PR C/57457 * c-c++-common/cilk-plus/AN/pr57457.c: New test. > > > > gcc/c/ChangeLog 2013-06-04 Balaji V. Iyer <balaji.v.i...@intel.com> > > > > * c-typeck.c (convert_arguments): Moved checking of builtin cilkplus > > reduction functions outside the for-loop. Also, added a check if the > > fundecl is non-NULL. > OK. This looks good. Please install. > > As a follow-up, don't we need to do something with the test after the loop as > well: > > if (typetail != 0 && TREE_VALUE (typetail) != void_type_node) > { > /* If array notation is used and Cilk Plus is enabled, then we do not > worry about this error now. We will handle them in a later place. > */ > if (!flag_enable_cilkplus > || !is_cilkplus_reduce_builtin (fundecl)) > { > error_at (input_location, > "too few arguments to function %qE", function); > inform_declaration (fundecl); > return -1; > } > } > > ISTM we need to check for a NULL FUNDECL here too.
Actually, you can eliminate the entire if-statement (i.e. remove if-statement and make the body unconditional). This is because, if flag_enable_cilkplus is true and is_cilkplus_reduce_builtin (fundecl) is true, then it would have returned vec_safe_length(values) and will not even get to this point in the first place. So, this is technically equivalent to if (1). So, can I remove that and check it in also? It passes all my regression tests. Thanks, Balaji V. Iyer. > > jeff