Is this a bug for icc

Is this a bug for icc

The following program causes a runtime crash reducer_impl.cpp:527: cilk assertion failed: h

My compiler is icc 13.1.1 on Ubuntu 12.04. 

#include <cilk/reducer.h>
#include <cilk/reducer_opadd.h> 
#include <cilk/cilk.h> 
#include void empty() {} 
std::atomic n; 
int test(int *x) { 
  cilk::reducer_opadd r; 
  n = 40000; 
  while (n--) { 
    cilk_spawn empty(); 
  } 
  return 0;
} 
int main() { 
  int x = 1; 
  return test(&x); 
} 

5 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

There are some missing pieces due to the formating
std::atomic should be std::atmoic<unsigned>

and

cilk::reducer_opadd should be cilk::reducer_opadd<unsigned> 

Ritratto di Arch D. Robison (Intel)

Thanks for reporting this bug.  I was able to reproduce the problem even without using an atomic variable (see below)   I'll forward it to the right folk.  

- Arch

#include <cilk/reducer_opadd.h>
#include <cilk/cilk.h>
void empty() {}
int main() {
  cilk::reducer_opadd<unsigned> r;
  int n = 40000;
  while (n--) {
    cilk_spawn empty();
  }
  return 0;
}

Ritratto di Arch D. Robison (Intel)

A work-around for now is to insert a cilk_sync right before the destructor for r runs.  

Thanks! I was not sure if there is a limit on the number of spawns and confirms this is a bug or not.

Accedere per lasciare un commento.