https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100232
Bug ID: 100232 Summary: [OpenMP][nvptx] Reduction fails with optimization and 'loop'/'for simd' but not with 'for' Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: openmp, wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: vries at gcc dot gnu.org Target Milestone: --- Target: nvptx-none Created attachment 50661 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50661&action=edit Testcase: gcc -fopenmp -O1 (fails, -O0 works) - to be run with nvptx offloading (Based on https://github.com/SOLLVE/sollve_vv/ 's tests/5.0/loop/test_loop_reduction_{and,or}_device.c ) The code works with nvptx offloading with -O0 but fails with -O1 and higher. (It also works on AMD GCN or with host fallback.) A reduction of result &&= 1 will yield 0 instead of the expected 1. I note that it works with 'for' but fails with 'loop' and 'for simd', hence, I think it might related to SIMT (→ some other PRs about SIMT).