On 10/03/14 08:08, Andi Kleen wrote:
From: Andi Kleen <a...@linux.intel.com>

_Cilk_spawn or Cilk array expressions are only allowed on their own,
but not in for(), if(), switch, do, while, goto, etc.
The C parser didn't always check for that, which lead to ICEs earlier
for invalid code.

Add a generic helper that checks this and call it where needed
in the C frontend.

I chose to allow spawn/array for for init and increment expressions.
While the Cilk spec could be interpreted to forbid it there too
there didn't seem any reason to not allow it.

One dark corner is spawn, array in statement expressions not at
the end. Right now that's forbidden too.

gcc/c-family/:

2014-09-30  Andi Kleen  <a...@linux.intel.com>

        PR c/60804
        * c-common.h (check_no_cilk): Declare.
        * cilk.c (get_error_location): New function.
        (check_no_cilk): Dito.

gcc/c/:

2014-09-30  Andi Kleen  <a...@linux.intel.com>

        PR c/60804
        * c-parser.c (c_parser_statement_after_labels): Call
        check_no_cilk.
        (c_parser_if_statement): Dito.
        (c_parser_switch_statement): Dito.
        (c_parser_while_statement): Dito.
        (c_parser_do_statement): Dito.
        (c_parser_for_statement): Dito.
        * c-typeck.c (c_finish_loop): Dito.
OK.
Jeff

Reply via email to