[llvm-bugs] [Bug 33062] New: [OPENMP] positive loop step not recognized as such

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 16 14:09:41 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33062

            Bug ID: 33062
           Summary: [OPENMP] positive loop step not recognized as such
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: compile-fail
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: llvm-bugs at lists.llvm.org

The increment expression in the code below increases the loop counter by 1.
Clang generates diagnostics which claim otherwise.

### SOURCE (<stdin>):
int main(void) {
#pragma omp for
  for (unsigned i = 0; i < 10; i -= 0u - 1u) { }
}


### COMPILER INVOCATION:
clang -fsyntax-only -x c -std=c99 -fopenmp -


### OUTPUT:
<stdin>:3:40: error: increment expression must cause 'i' to increase on each
iteration of OpenMP for loop
  for (unsigned i = 0; i < 10; i -= 0u - 1u) { }
                                    ~~~^~~~
<stdin>:3:26: note: loop step is expected to be positive due to this condition
  for (unsigned i = 0; i < 10; i -= 0u - 1u) { }
                       ~~^~~~
1 error generated.


### EXPECTED OUTPUT:
(Compiles successfully).


### COMPILER VERSION INFO (clang -v):
clang version 5.0.0 (https://github.com/llvm-mirror/clang.git
600a9e6e11f067dbb921c742b6fb676e0ac045bd)
(https://github.com/llvm-mirror/llvm.git
f0a3e25eca945f00368b68c9aa006b95b92fafaf)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170516/df29e785/attachment.html>


More information about the llvm-bugs mailing list