[PATCH] Fix for PR c/57490

Iyer, Balaji V balaji.v.iyer@intel.com
Mon Jul 1 18:00:00 GMT 2013



> -----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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr57490.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130701/ec486924/attachment.txt>


More information about the Gcc-patches mailing list