On 05/30/2013 10:00 PM, Iyer, Balaji V wrote:
Hello Everyone,
When I was looking at the erroneous test on PR 57452, I found out that
array notations in conditions were not expanded correctly. The rank for the
array notation condition must be same (or equal to zero) as the rank of the
array notations inside the else-block and then-block (or they could be zero). I
found out that GCC was not detecting these errors. I am very sorry for this
mishap. The attached patch should fix that issue. I have also enclosed a
test-suite code to make sure this gets caught in future.
It is tested on x86_64 and seem to work OK. The only test that it is
failing is the erronous test called if_test.c, and if patch specified in
(http://gcc.gnu.org/ml/gcc-patches/2013-05/msg01815.html) is applied, then that
test will pass.
Is this OK for trunk?
Here are the ChangeLog entries:
gcc/c/ChangeLog
2013-05-30 Balaji V. Iyer <balaji.v.i...@intel.com>
* c-typeck.c (c_finish_if_stmt): Added a check to see if the rank of
the
condition of the if-statement matches the rank of else-block and then-
block when array notations are used.
* c-parser.c (c_parser_declaration_or_fndef): Expanded array notation
expression after the entire function body is parsed.
(c_parser_expr_no_commas): Delayed creating array notation expressions
to the end of function parsing.
* c-array-notation.c (fix_conditional_array_notations_1): Expanded the
whole if-statement instead of just the condition.
(expand_array_notation_exprs): Added MODIFY_EXPR case.
gcc/testsuite/ChangeLog
2013-05-30 Balaji V. Iyer <balaji.v.i...@intel.com>
* c-c++-common/cilk-plus/AN/if_test_errors.c (main): New testcase.
* c-c++-common/cilk-plus/AN/rank_mismatch.c: Added a '-w' option to
dg-option and an header comment.
OK after fixing the new tests not to rely on argc/argv.
jeff