[PATCH, OpenACC] Bug fix for processing OpenACC data clauses in C++

Sandra Loosemore sandra@codesourcery.com
Thu Mar 26 05:02:38 GMT 2020


The attached patch fixes a bug I found in the C++ front end's handling 
of OpenACC data clauses.  The problem here is that the C++ front end 
wraps the array bounds expressions in NON_LVALUE_EXPR tree nodes, and 
the code here (which appears to have been copied from similar code in 
the C front end) was failing to strip those before checking to see if 
they were INTEGER_CST nodes, etc.

Sadly, I have no test case for this because it was only triggering an 
error in conjunction with some other OpenACC patches that are not yet on 
trunk, and the tree dumps don't show anything useful.  I confirmed that 
the problem exists on trunk without those other patches by examining 
things in the debugger.  This is the example I was using for my 
hand-testing:

void f (float a[16][16], float b[16][16], float c[16][16])
{
   int i, j, k;

#pragma acc kernels copyin(a[0:16][0:16], b[0:16][0:16]) 
copyout(c[0:16][0:16])
   {
     for (i = 0; i < 16; i++) {
       for (j = 0; j < 16; j++) {
         float t = 0;
         for (k = 0; k < 16; k++)
           t += a[i][k] * b[k][j];
         c[i][j] = t;
       }
     }
   }

}

Is this patch OK to commit now, or in Stage 1?

-Sandra
-------------- next part --------------
A non-text attachment was scrubbed...
Name: strip-nops.patch
Type: text/x-patch
Size: 1943 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20200325/d6fad1ba/attachment.bin>


More information about the Gcc-patches mailing list