[Bug c++/27557] OpenMP threadprivate directive does not work with non-POD types

2018-06-18 Thread yves.vandriessche at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=27557

Yves Vandriessche  changed:

   What|Removed |Added

 CC||yves.vandriessche at intel dot 
com

--- Comment #18 from Yves Vandriessche  ---
As mentioned by Sameer, thread_local now works, but the threadprivate OpenMP
directive still fails with a "declared 'threadprivate' after first use" error.

My test fragment, is as follows. It should only print a single "ctor" and twice
the same set of distinct pointers:


#include 
#include 

struct Foo {
  Foo() {puts("ctor");}
  int a;
};

int bar() {
  int sum=0;
  // // alternative to omp threadprivate, works with gcc
  // thread_local Foo local;
#pragma omp parallel reduction(+:sum)
  {
static Foo local;
#pragma omp threadprivate(local)
local.a = omp_get_thread_num();
printf("%p\n", &local);
sum += local.a;
  }
  printf("%d\n", sum);
  return sum;
}

int main(int argc, char** argv) {
  bar();
  bar();
  return 0;
}

[Bug c/63336] cilkplus array notation ICE in find_rank

2016-04-06 Thread yves.vandriessche at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63336

Yves Vandriessche  changed:

   What|Removed |Added

 CC||yves.vandriessche at intel dot 
com

--- Comment #8 from Yves Vandriessche  ---
reconfirming for g++ (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010

compiling with -std-gnu++11 -fcilkplus

I did find a workaround: I do not get the error if I avoid using the array
notation extension on a member. Using a local variable that takes on the
pointer value of the member compiles perfectly.

> struct Test {
>   int nrows;
>   int * rows;
>   Test(int _nrows, int * in_rows): nrows(_nrows) {
> rows = new int[nrows + 1];
> 
> // internal compiler error: in find_rank, at 
> c-family/array-notation-common.c:244
> rows[0:nrows+1] = 0;
> 
> // // workaround
> // int * _rows = rows;
> // _rows[0:nrows+1] = 0;
>   }
> };
> 
> int main() {
>   Test t{1024*1024, nullptr};
> }

[Bug c++/70565] New: ICE at gimplify.c:8832 (cilkplus array extension)

2016-04-06 Thread yves.vandriessche at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70565

Bug ID: 70565
   Summary: ICE at gimplify.c:8832 (cilkplus array extension)
   Product: gcc
   Version: 5.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: yves.vandriessche at intel dot com
  Target Milestone: ---

Created attachment 38203
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38203&action=edit
test case producing ICE in gimplify_expr, at gimplify.c:8832

using: gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
running on: Ubuntu-5.10

Attached file produces the following ICE

> test.cpp:11:18: internal compiler error: in gimplify_expr, at 
> gimplify.c:8832

with the guilty code segment in question being:

> cilk_for ( int row = 0; row < nrows; row++ ) {
>   int row_nnz = nrows/2;
>   int col_offsets[row_nnz];
>   col_offsets[:] = __sec_implicit_index(0);
> }

Note that I do not get an ICE when using a regular 'for' instead of the above
'cilk_for'.

[Bug c++/70565] ICE at gimplify.c:8832 (cilkplus array extension)

2016-04-06 Thread yves.vandriessche at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70565

--- Comment #1 from Yves Vandriessche  ---
Additionally, the same internal compile error is produced when substituting:

>  cilk_for ( int row = 0; row < nrows; row++ ) {

with

>#pragma omp parallel scheduler(dynamic, 256)
>  for ( int row = 0; row < nrows; row++ ) {

[Bug c/63336] cilkplus array notation ICE in find_rank

2016-08-30 Thread yves.vandriessche at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63336

--- Comment #9 from Yves Vandriessche  ---
Created attachment 39518
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39518&action=edit
2D-array cilk array notation ICE test case

[Bug c/63336] cilkplus array notation ICE in find_rank

2016-08-30 Thread yves.vandriessche at intel dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63336

--- Comment #10 from Yves Vandriessche  ---
A similar internal compile error is triggered in find_rank when dealing with
two-dimensional array arguments, for both g++-5.2 and g++-6.1.1.

>void test(double Arr[][16]) {
>  double A[16]= {0};
>  for(int i=0; i<4; i++) {
>A[:] += Arr[i][:]; // internal compile error:
>   // in find_rank, at c-family/array-notation-common.c:232
>  }
>  printf("%f \n", A[0]);
>}

This only happens on two-dimensional arrays. Passing a regular array (e.g.
Arr[16]) correctly yields a normal compile error (not an ICE); start-index and
length cannot be determined as `double Arr[16]` degenerates into `double *Arr`.

Complete test code has been attached attached.