This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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 @@

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;
> +}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]