Patchwork Fix for PR c/57490

login
register
mail settings
Submitter Iyer, Balaji V
Date July 1, 2013, 5:55 p.m.
Message ID <BF230D13CA30DD48930C31D4099330003A43C8C0@FMSMSX101.amr.corp.intel.com>
Download mbox | patch
Permalink /patch/256195/
State New
Headers show

Comments

Iyer, Balaji V - July 1, 2013, 5:55 p.m.
> -----Original Message-----
> From: Jakub Jelinek [mailto:jakub@redhat.com]
> Sent: Monday, July 01, 2013 1:09 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org; Rainer Orth
> Subject: Re: [PATCH] Fix for PR c/57490
> 
> On Mon, Jul 01, 2013 at 05:02:57PM +0000, Iyer, Balaji V wrote:
> > OK. The fixed patch is attached. Here are the ChangeLog entries:
> >
> > gcc/cp/ChangeLog
> > 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
> >
> 
> Still
> 	PR c/57490
> hasn't been added to cp/ChangeLog and c/ChangeLog entries.
> > --- /dev/null
> > +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
> > @@ -0,0 +1,25 @@
> 

Fixed as you suggested. Here is the fixed Changelogs and patch is attached.

gcc/cp/ChangeLog
2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        PR c/57490
        * cp-array-notation.c (cp_expand_cond_array_notations): Added a
        check for truth values.
        (expand_array_notation_exprs): Added truth values case.  Removed an
        unwanted else.  Added for-loop to walk through subtrees in default
        case.

gcc/c/ChangeLog
2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        PR c/57490
        * c-array-notation.c (fix_conditional_array_notations_1): Added a
        check for truth values.
        (expand_array_notation_exprs): Added truth values case.  Removed an
        unwanted else.  Added for-loop to walk through subtrees in default
        case.


gcc/testsuite/ChangeLog
2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>

        PR c/57490
        * c-c++-common/cilk-plus/AN/pr57490.c: New test.


> Do you want the testcase just as a compile time test (dunno what is the default
> for cilk-plus.exp)?  If it would be usable as a runtime test, it would be better to
> just convert it into a runtime test (then of course you can't use __assert, but do
> something like:
> #define assert(x) do { if (!(x)) __builtin_abort () } while (0) and use assert
> (__sec_reduce_add(x[0:n]) == 3.0f * n); etc. in the testcase, or just write the
> conditionals plus __builtin_abort etc.  And add /* { dg-do run } */.
> 
> > +extern void __assert(const char *, const char *, int); const int n =
> > +8; float x[8], y[8], z[8]; int main() {
> > +    int i = 0;
> > +    float x_sum =0;
> > +    for(i=1; i<=5; i+=4 ) {
> > +        x[0:n] = 3;
> > +        y[0:n] = i;
> > +        z[0:n] = 0;
> > +        (void)((__sec_reduce_add(x[0:n])==(float)3*n) ||
> (__assert("__sec_reduce_add(x[0:n])==3*n", "an-if.c", 28), 0));
> > +        (void)((__sec_reduce_add(y[0:n])==(float)i*n) ||
> (__assert("__sec_reduce_add(y[0:n])==i*n", "an-if.c", 29), 0));
> > +        (void)((__sec_reduce_add(z[0:n])==(float)0) ||
> > +(__assert("__sec_reduce_add(z[0:n])==0", "an-if.c", 30), 0));
> > +
> > +        if (x[0:n] >= y[0:n]) {
> > +            z[0:n] = x[0:n] - y[0:n];
> > +        } else {
> > +            z[0:n] = x[0:n] + y[0:n];
> > +        }
> > +        (void)((__sec_reduce_add(x[0:n])==(float)3*n) ||
> (__assert("__sec_reduce_add(x[0:n])==3*n", "an-if.c", 43), 0));
> > +        (void)((__sec_reduce_add(y[0:n])==(float)i*n) ||
> (__assert("__sec_reduce_add(y[0:n])==i*n", "an-if.c", 44), 0));
> > +        (void)((__sec_reduce_add(z[0:n])==(float)(3>=i?3-i:3+i)*n) ||
> (__assert("__sec_reduce_add(z[0:n])==(3>=i?3-i:3+i)*n", "an-if.c", 45), 0));
> > +    }
> > +    return 0;
> > +}
> 

I want it to be a runtime assert. This is fixed as you suggested also.


-Balaji V. Iyer.

> 	Jakub
Rainer Orth - July 3, 2013, 9:11 a.m.
"Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:

>> -----Original Message-----
>> From: Jakub Jelinek [mailto:jakub@redhat.com]
>> Sent: Monday, July 01, 2013 1:09 PM
>> To: Iyer, Balaji V
>> Cc: gcc-patches@gcc.gnu.org; Rainer Orth
>> Subject: Re: [PATCH] Fix for PR c/57490
>> 
>> On Mon, Jul 01, 2013 at 05:02:57PM +0000, Iyer, Balaji V wrote:
>> > OK. The fixed patch is attached. Here are the ChangeLog entries:
>> >
>> > gcc/cp/ChangeLog
>> > 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>> >
>> 
>> Still
>> 	PR c/57490
>> hasn't been added to cp/ChangeLog and c/ChangeLog entries.
>> > --- /dev/null
>> > +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
>> > @@ -0,0 +1,25 @@
>> 
>
> Fixed as you suggested. Here is the fixed Changelogs and patch is attached.
>
> gcc/cp/ChangeLog
> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>
>         PR c/57490
>         * cp-array-notation.c (cp_expand_cond_array_notations): Added a
>         check for truth values.
>         (expand_array_notation_exprs): Added truth values case.  Removed an
>         unwanted else.  Added for-loop to walk through subtrees in default
>         case.
>
> gcc/c/ChangeLog
> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>
>         PR c/57490
>         * c-array-notation.c (fix_conditional_array_notations_1): Added a
>         check for truth values.
>         (expand_array_notation_exprs): Added truth values case.  Removed an
>         unwanted else.  Added for-loop to walk through subtrees in default
>         case.
>
>
> gcc/testsuite/ChangeLog
> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>
>         PR c/57490
>         * c-c++-common/cilk-plus/AN/pr57490.c: New test.

I've just tested this patch on i386-pc-solaris2.10:

The c-c++-common/cilk-plus/AN/an-if.c test still FAILs for C++:

FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (internal compiler error)
FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (test for excess errors)
Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: error: mismatching comparison operand types
float
int
if (D.2198 == 24) goto <D.2270>; else goto <D.2273>;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: error: mismatching comparison operand types
float
int
if (D.2200 == D.2282) goto <D.2279>; else goto <D.2283>;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: error: mismatching comparison operand types
float
int
if (D.2202 == 0) goto <D.2289>; else goto <D.2292>;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: error: mismatching comparison operand types
float
int
if (D.2205 == 24) goto <D.2326>; else goto <D.2329>;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: error: mismatching comparison operand types
float
int
if (D.2207 == D.2338) goto <D.2335>; else goto <D.2339>;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: error: mismatching comparison operand types
float
int
if (D.2209 == iftmp.16) goto <D.2345>; else goto <D.2354>;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5: internal compiler error: verify_gimple failed
0x87f1a27 verify_gimple_in_seq(gimple_statement_d*)
	/vol/gcc/src/hg/trunk/local/gcc/tree-cfg.c:4474
0x863ce54 gimplify_body(tree_node*, bool)
	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8240
0x863d19a gimplify_function_tree(tree_node*)
	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8325
0x84a9437 analyze_function
	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:631
0x84ac97a analyze_functions
	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:914
0x84ae029 finalize_compilation_unit()
	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:2097
0x829255f cp_write_global_declarations()
	/vol/gcc/src/hg/trunk/local/gcc/cp/decl2.c:4356

WARNING: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus compilation failed to produce executable

While the C an-if.c test now passes, the new pr57490.c test (which is
identical to an-if.c modulo the assert to __builtin_abort change) FAILs:

FAIL: c-c++-common/cilk-plus/AN/pr57490.c  -fcilkplus -std=c99 (internal compiler error)
FAIL: c-c++-common/cilk-plus/AN/pr57490.c  -fcilkplus -std=c99 (test for excess errors)
Excess errors:
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5: error: invalid types in conversion to floating point
long double
float
D.1656 = (long double) D.1604;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5: error: invalid types in conversion to floating point
long double
float
D.1671 = (long double) D.1609;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5: error: invalid types in conversion to floating point
long double
float
D.1731 = (long double) D.1619;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5: error: invalid types in conversion to floating point
long double
float
D.1746 = (long double) D.1624;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5: error: invalid types in conversion to floating point
long double
float
D.1763 = (long double) D.1629;
/vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5: internal compiler error: verify_gimple failed
0x8612127 verify_gimple_in_seq(gimple_statement_d*)
	/vol/gcc/src/hg/trunk/local/gcc/tree-cfg.c:4474
0x845ca04 gimplify_body(tree_node*, bool)
	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8240
0x845cd4a gimplify_function_tree(tree_node*)
	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8325
0x82c8de7 analyze_function
	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:631
0x82cc32a analyze_functions
	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:914
0x82cd9d9 finalize_compilation_unit()
	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:2097
0x8196d8c c_write_global_declarations()
	/vol/gcc/src/hg/trunk/local/gcc/c/c-decl.c:10119

WARNING: c-c++-common/cilk-plus/AN/pr57490.c  -fcilkplus -std=c99 compilation failed to produce executable

	Rainer
Rainer Orth - July 23, 2013, 8:26 a.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> "Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:
>
>>> -----Original Message-----
>>> From: Jakub Jelinek [mailto:jakub@redhat.com]
>>> Sent: Monday, July 01, 2013 1:09 PM
>>> To: Iyer, Balaji V
>>> Cc: gcc-patches@gcc.gnu.org; Rainer Orth
>>> Subject: Re: [PATCH] Fix for PR c/57490
>>> 
>>> On Mon, Jul 01, 2013 at 05:02:57PM +0000, Iyer, Balaji V wrote:
>>> > OK. The fixed patch is attached. Here are the ChangeLog entries:
>>> >
>>> > gcc/cp/ChangeLog
>>> > 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>> >
>>> 
>>> Still
>>> 	PR c/57490
>>> hasn't been added to cp/ChangeLog and c/ChangeLog entries.
>>> > --- /dev/null
>>> > +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
>>> > @@ -0,0 +1,25 @@
>>> 
>>
>> Fixed as you suggested. Here is the fixed Changelogs and patch is attached.
>>
>> gcc/cp/ChangeLog
>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>
>>         PR c/57490
>>         * cp-array-notation.c (cp_expand_cond_array_notations): Added a
>>         check for truth values.
>>         (expand_array_notation_exprs): Added truth values case.  Removed an
>>         unwanted else.  Added for-loop to walk through subtrees in default
>>         case.
>>
>> gcc/c/ChangeLog
>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>
>>         PR c/57490
>>         * c-array-notation.c (fix_conditional_array_notations_1): Added a
>>         check for truth values.
>>         (expand_array_notation_exprs): Added truth values case.  Removed an
>>         unwanted else.  Added for-loop to walk through subtrees in default
>>         case.
>>
>>
>> gcc/testsuite/ChangeLog
>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>
>>         PR c/57490
>>         * c-c++-common/cilk-plus/AN/pr57490.c: New test.
>
> I've just tested this patch on i386-pc-solaris2.10:
>
> The c-c++-common/cilk-plus/AN/an-if.c test still FAILs for C++:
>
> FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (internal compiler error)
> FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (test for excess errors)
> Excess errors:
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> error: mismatching comparison operand types
> float
> int
> if (D.2198 == 24) goto <D.2270>; else goto <D.2273>;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> error: mismatching comparison operand types
> float
> int
> if (D.2200 == D.2282) goto <D.2279>; else goto <D.2283>;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> error: mismatching comparison operand types
> float
> int
> if (D.2202 == 0) goto <D.2289>; else goto <D.2292>;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> error: mismatching comparison operand types
> float
> int
> if (D.2205 == 24) goto <D.2326>; else goto <D.2329>;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> error: mismatching comparison operand types
> float
> int
> if (D.2207 == D.2338) goto <D.2335>; else goto <D.2339>;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> error: mismatching comparison operand types
> float
> int
> if (D.2209 == iftmp.16) goto <D.2345>; else goto <D.2354>;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/an-if.c:13:5:
> internal compiler error: verify_gimple failed
> 0x87f1a27 verify_gimple_in_seq(gimple_statement_d*)
> 	/vol/gcc/src/hg/trunk/local/gcc/tree-cfg.c:4474
> 0x863ce54 gimplify_body(tree_node*, bool)
> 	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8240
> 0x863d19a gimplify_function_tree(tree_node*)
> 	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8325
> 0x84a9437 analyze_function
> 	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:631
> 0x84ac97a analyze_functions
> 	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:914
> 0x84ae029 finalize_compilation_unit()
> 	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:2097
> 0x829255f cp_write_global_declarations()
> 	/vol/gcc/src/hg/trunk/local/gcc/cp/decl2.c:4356
>
> WARNING: c-c++-common/cilk-plus/AN/an-if.c -fcilkplus compilation failed to
> produce executable
>
> While the C an-if.c test now passes, the new pr57490.c test (which is
> identical to an-if.c modulo the assert to __builtin_abort change) FAILs:
>
> FAIL: c-c++-common/cilk-plus/AN/pr57490.c -fcilkplus -std=c99 (internal
> compiler error)
> FAIL: c-c++-common/cilk-plus/AN/pr57490.c -fcilkplus -std=c99 (test for
> excess errors)
> Excess errors:
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5:
> error: invalid types in conversion to floating point
> long double
> float
> D.1656 = (long double) D.1604;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5:
> error: invalid types in conversion to floating point
> long double
> float
> D.1671 = (long double) D.1609;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5:
> error: invalid types in conversion to floating point
> long double
> float
> D.1731 = (long double) D.1619;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5:
> error: invalid types in conversion to floating point
> long double
> float
> D.1746 = (long double) D.1624;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5:
> error: invalid types in conversion to floating point
> long double
> float
> D.1763 = (long double) D.1629;
> /vol/gcc/src/hg/trunk/local/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c:6:5:
> internal compiler error: verify_gimple failed
> 0x8612127 verify_gimple_in_seq(gimple_statement_d*)
> 	/vol/gcc/src/hg/trunk/local/gcc/tree-cfg.c:4474
> 0x845ca04 gimplify_body(tree_node*, bool)
> 	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8240
> 0x845cd4a gimplify_function_tree(tree_node*)
> 	/vol/gcc/src/hg/trunk/local/gcc/gimplify.c:8325
> 0x82c8de7 analyze_function
> 	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:631
> 0x82cc32a analyze_functions
> 	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:914
> 0x82cd9d9 finalize_compilation_unit()
> 	/vol/gcc/src/hg/trunk/local/gcc/cgraphunit.c:2097
> 0x8196d8c c_write_global_declarations()
> 	/vol/gcc/src/hg/trunk/local/gcc/c/c-decl.c:10119
>
> WARNING: c-c++-common/cilk-plus/AN/pr57490.c -fcilkplus -std=c99
> compilation failed to produce executable

This is still unfixed almost three weeks later.  Balaji, could you
please have a look?

Thanks.
	Rainer
Rainer Orth - Aug. 9, 2013, 11:54 a.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
>
>> "Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:
>>
>>>> -----Original Message-----
>>>> From: Jakub Jelinek [mailto:jakub@redhat.com]
>>>> Sent: Monday, July 01, 2013 1:09 PM
>>>> To: Iyer, Balaji V
>>>> Cc: gcc-patches@gcc.gnu.org; Rainer Orth
>>>> Subject: Re: [PATCH] Fix for PR c/57490
>>>> 
>>>> On Mon, Jul 01, 2013 at 05:02:57PM +0000, Iyer, Balaji V wrote:
>>>> > OK. The fixed patch is attached. Here are the ChangeLog entries:
>>>> >
>>>> > gcc/cp/ChangeLog
>>>> > 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>>> >
>>>> 
>>>> Still
>>>> 	PR c/57490
>>>> hasn't been added to cp/ChangeLog and c/ChangeLog entries.
>>>> > --- /dev/null
>>>> > +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
>>>> > @@ -0,0 +1,25 @@
>>>> 
>>>
>>> Fixed as you suggested. Here is the fixed Changelogs and patch is attached.
>>>
>>> gcc/cp/ChangeLog
>>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>>
>>>         PR c/57490
>>>         * cp-array-notation.c (cp_expand_cond_array_notations): Added a
>>>         check for truth values.
>>>         (expand_array_notation_exprs): Added truth values case.  Removed an
>>>         unwanted else.  Added for-loop to walk through subtrees in default
>>>         case.
>>>
>>> gcc/c/ChangeLog
>>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>>
>>>         PR c/57490
>>>         * c-array-notation.c (fix_conditional_array_notations_1): Added a
>>>         check for truth values.
>>>         (expand_array_notation_exprs): Added truth values case.  Removed an
>>>         unwanted else.  Added for-loop to walk through subtrees in default
>>>         case.
>>>
>>>
>>> gcc/testsuite/ChangeLog
>>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
>>>
>>>         PR c/57490
>>>         * c-c++-common/cilk-plus/AN/pr57490.c: New test.
>>
>> I've just tested this patch on i386-pc-solaris2.10:
>>
>> The c-c++-common/cilk-plus/AN/an-if.c test still FAILs for C++:
>>
>> FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (internal compiler error)
>> FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (test for excess errors)
[...]
> This is still unfixed almost three weeks later.  Balaji, could you
> please have a look?

This bug is now unfixed for two months, and no reaction whatsoever on
the report.  This is getting annoying since it generates large amount of
testsuite noise.

Please fix ASAP!

	Rainer
Iyer, Balaji V - Aug. 9, 2013, 2:38 p.m.
> -----Original Message-----
> From: Rainer Orth [mailto:ro@CeBiTec.Uni-Bielefeld.DE]
> Sent: Friday, August 09, 2013 7:54 AM
> To: Iyer, Balaji V
> Cc: Jakub Jelinek; gcc-patches@gcc.gnu.org; Marek Polacek
> (polacek@redhat.com)
> Subject: Re: [PATCH] Fix for PR c/57490
> 
> Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> 
> > Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:
> >
> >> "Iyer, Balaji V" <balaji.v.iyer@intel.com> writes:
> >>
> >>>> -----Original Message-----
> >>>> From: Jakub Jelinek [mailto:jakub@redhat.com]
> >>>> Sent: Monday, July 01, 2013 1:09 PM
> >>>> To: Iyer, Balaji V
> >>>> Cc: gcc-patches@gcc.gnu.org; Rainer Orth
> >>>> Subject: Re: [PATCH] Fix for PR c/57490
> >>>>
> >>>> On Mon, Jul 01, 2013 at 05:02:57PM +0000, Iyer, Balaji V wrote:
> >>>> > OK. The fixed patch is attached. Here are the ChangeLog entries:
> >>>> >
> >>>> > gcc/cp/ChangeLog
> >>>> > 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
> >>>> >
> >>>>
> >>>> Still
> >>>> 	PR c/57490
> >>>> hasn't been added to cp/ChangeLog and c/ChangeLog entries.
> >>>> > --- /dev/null
> >>>> > +++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
> >>>> > @@ -0,0 +1,25 @@
> >>>>
> >>>
> >>> Fixed as you suggested. Here is the fixed Changelogs and patch is attached.
> >>>
> >>> gcc/cp/ChangeLog
> >>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
> >>>
> >>>         PR c/57490
> >>>         * cp-array-notation.c (cp_expand_cond_array_notations): Added a
> >>>         check for truth values.
> >>>         (expand_array_notation_exprs): Added truth values case.  Removed an
> >>>         unwanted else.  Added for-loop to walk through subtrees in default
> >>>         case.
> >>>
> >>> gcc/c/ChangeLog
> >>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
> >>>
> >>>         PR c/57490
> >>>         * c-array-notation.c (fix_conditional_array_notations_1): Added a
> >>>         check for truth values.
> >>>         (expand_array_notation_exprs): Added truth values case.  Removed an
> >>>         unwanted else.  Added for-loop to walk through subtrees in default
> >>>         case.
> >>>
> >>>
> >>> gcc/testsuite/ChangeLog
> >>> 2013-07-01  Balaji V. Iyer  <balaji.v.iyer@intel.com>
> >>>
> >>>         PR c/57490
> >>>         * c-c++-common/cilk-plus/AN/pr57490.c: New test.
> >>
> >> I've just tested this patch on i386-pc-solaris2.10:
> >>
> >> The c-c++-common/cilk-plus/AN/an-if.c test still FAILs for C++:
> >>
> >> FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (internal
> >> compiler error)
> >> FAIL: c-c++-common/cilk-plus/AN/an-if.c  -fcilkplus (test for excess
> >> errors)
> [...]
> > This is still unfixed almost three weeks later.  Balaji, could you
> > please have a look?
> 
> This bug is now unfixed for two months, and no reaction whatsoever on the
> report.  This is getting annoying since it generates large amount of testsuite
> noise.
> 
> Please fix ASAP!
> 

Ok. I will get on this this Monday. I am away from office today and this weekend.

-Balaji V. Iyer.

> 	Rainer
> 
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University

Patch

diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 7788f7b..5747bcb 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -906,6 +906,8 @@  fix_conditional_array_notations_1 (tree stmt)
     cond = COND_EXPR_COND (stmt);
   else if (TREE_CODE (stmt) == SWITCH_EXPR)
     cond = SWITCH_COND (stmt);
+  else if (truth_value_p (TREE_CODE (stmt)))
+    cond = TREE_OPERAND (stmt, 0);
   else
     /* Otherwise dont even touch the statement.  */
     return stmt;
@@ -1232,6 +1234,12 @@  expand_array_notation_exprs (tree t)
     case BIND_EXPR:
       t = expand_array_notation_exprs (BIND_EXPR_BODY (t));
       return t;
+    case TRUTH_ORIF_EXPR:
+    case TRUTH_ANDIF_EXPR:
+    case TRUTH_OR_EXPR:
+    case TRUTH_AND_EXPR:
+    case TRUTH_XOR_EXPR:
+    case TRUTH_NOT_EXPR:
     case COND_EXPR:
       t = fix_conditional_array_notations (t);
 
@@ -1246,8 +1254,6 @@  expand_array_notation_exprs (tree t)
 	    COND_EXPR_ELSE (t) =
 	      expand_array_notation_exprs (COND_EXPR_ELSE (t));
 	}
-      else
-	t = expand_array_notation_exprs (t);
       return t;
     case STATEMENT_LIST:
       {
@@ -1284,6 +1290,10 @@  expand_array_notation_exprs (tree t)
 	 Replace those with just void zero node.  */
       t = void_zero_node;
     default:
+      for (int ii = 0; ii < TREE_CODE_LENGTH (TREE_CODE (t)); ii++)
+	if (contains_array_notation_expr (TREE_OPERAND (t, ii)))
+	  TREE_OPERAND (t, ii) =
+	    expand_array_notation_exprs (TREE_OPERAND (t, ii));
       return t;
     }
   return t;
diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index d279ddd..164106f 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -857,6 +857,19 @@  cp_expand_cond_array_notations (tree orig_stmt)
 	  return error_mark_node;
 	}
     }
+  else if (truth_value_p (TREE_CODE (orig_stmt)))
+    {
+      size_t left_rank = 0, right_rank = 0;
+      tree left_expr = TREE_OPERAND (orig_stmt, 0);
+      tree right_expr = TREE_OPERAND (orig_stmt, 1);
+      if (!find_rank (EXPR_LOCATION (left_expr), left_expr, left_expr, true,
+		      &left_rank)
+	  || !find_rank (EXPR_LOCATION (right_expr), right_expr, right_expr,
+			 true, &right_rank))
+	return error_mark_node;
+      if (right_rank == 0 && left_rank == 0)
+	return orig_stmt;
+    }
 
   if (!find_rank (EXPR_LOCATION (orig_stmt), orig_stmt, orig_stmt, true,
 		  &rank))
@@ -1213,6 +1226,12 @@  expand_array_notation_exprs (tree t)
       if (TREE_OPERAND (t, 0) == error_mark_node)
 	return TREE_OPERAND (t, 0); 
       return t;
+    case TRUTH_ANDIF_EXPR:
+    case TRUTH_ORIF_EXPR:
+    case TRUTH_AND_EXPR:
+    case TRUTH_OR_EXPR:
+    case TRUTH_XOR_EXPR:
+    case TRUTH_NOT_EXPR:
     case COND_EXPR:
       t = cp_expand_cond_array_notations (t);
       if (TREE_CODE (t) == COND_EXPR)
@@ -1222,8 +1241,6 @@  expand_array_notation_exprs (tree t)
 	  COND_EXPR_ELSE (t) =
 	    expand_array_notation_exprs (COND_EXPR_ELSE (t));
 	}
-      else
-	t = expand_array_notation_exprs (t);
       return t;
     case FOR_STMT:
       if (contains_array_notation_expr (FOR_COND (t)))
diff --git a/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
new file mode 100644
index 0000000..fbbd918
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cilk-plus/AN/pr57490.c
@@ -0,0 +1,33 @@ 
+/* { dg-do run } */
+/* { dg-options "-fcilkplus" } */
+
+const int n = 8;
+float x[8], y[8], z[8];
+int main() {
+    int i = 0;
+    float x_sum =0;
+    for(i=1; i<=5; i+=4 ) {
+        x[0:n] = 3;
+        y[0:n] = i;
+        z[0:n] = 0;
+        (void)((__sec_reduce_add(x[0:n])==(float)3*n) 
+	       || (__builtin_abort (), 0));
+        (void)((__sec_reduce_add(y[0:n])==(float)i*n) 
+	       || (__builtin_abort (), 0));
+        (void)((__sec_reduce_add(z[0:n])==(float)0) 
+	       || (__builtin_abort (), 0));
+
+        if (x[0:n] >= y[0:n]) {
+            z[0:n] = x[0:n] - y[0:n];
+        } else {
+            z[0:n] = x[0:n] + y[0:n];
+        }
+        (void)((__sec_reduce_add(x[0:n])==(float)3*n) 
+	       || (__builtin_abort (), 0));
+        (void)((__sec_reduce_add(y[0:n])==(float)i*n) 
+	       || (__builtin_abort (), 0));
+        (void)((__sec_reduce_add(z[0:n])==(float)(3>=i?3-i:3+i)*n) 
+	       || (__builtin_abort (), 0));
+    }
+    return 0;
+}