title: openacc struct in loop and if-statement
body: <p>I have the following code:</p>
  
  <pre><code>#pragma acc data present(listOfPolygons1, listOfPolygons2, polygon1, polygon2) copy(listOfBoolean[0:numOfPolygonsPair])
  #pragma acc parallel loop
      // do point-in-polygon in this nested loop
      for (i=0; i&lt;polygonCount1; i++){
  
          polygon1 = listOfPolygons1[i];
  
          for (j=0; j&lt;polygonCount2; j++){
  
              polygon2 = listOfPolygons2[j];
  
              idx = polygonCount2 * i + j;
  
              if (listOfBoolean[idx]==0){
                  // don't even have an intersection
                  continue;
              } else {
                  // do point-in-polygon test
  
                  for (k=0; k&lt;polygon2.num_vertices; k++){  // line 139
  
                  }
  
              }
          }
      }
  </code></pre>
  
  <p>"polygon1" and "polygon2" are struct.<br>
  "listOfPolygons1" and "listOfPolygons2" are struct array with a list of "polygon1" and "polygon2" correspondingly.<br>
  "listOfBoolean" is a array of int<br>
  both "listOfPolygons1" and "listOfPolygon2" are deep-copied to the accelerator and used successfully in previous loop (code not shown here)<br></p>
  
  <p>the code can be compiled but when run, it produces the following error message:</p>
  
  <pre><code>call to cuEventSynchronize returned error 716: Misaligned address
  </code></pre>
  
  <p><strong>My observation</strong><br>
  The problem seems to be in line 139. 
  When I use "k&lt;polygon2.num_vertices", it produced the error I mentioned. <br>
  But if I change the line to this:</p>
  
  <pre><code> for (k=0; k&lt;listOfPolygons2[j].num_vertices; k++) // not using struct "polygon2"
  </code></pre>
  
  <p>(update 1) or this:</p>
  
  <pre><code>for (k=0; k&lt;polygon1.num_vertices; k++) // use polygon1.num_vertices instead
  </code></pre>
  
  <p>The program can compile and run successfully</p>
  
  <p>Why is that and how can I use struct "polygon2" here?</p>