I have a strange issue with an embarrasingly parallel code.When I run it with -O0 or -O1 optimization flags my code throws segfault. However, with -O2 or -O3 flag it runs just fine. The debugger (gdb) says the error is at a OpenMP parallel for directive. I would appreciate if someone has an idea as to what could be the possible reason. I am also debugging in the meantime and will post if I find something. Thank you.