[llvm-bugs] [Bug 48387] New: Signed loop variables get implicitly casted to unsigned (clang version >=11)
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Dec 4 04:22:43 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48387
Bug ID: 48387
Summary: Signed loop variables get implicitly casted to
unsigned (clang version >=11)
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: christoph.schwarzmeier at fau.de
CC: llvm-bugs at lists.llvm.org
Compiling the following code snippet with `clang++ -fopenmp -Wsign-conversion`
generates warnings about the implicit conversion of the loop variables'
signedness:
warning: implicit conversion changes signedness: 'int' to 'unsigned int'
[-Wsign-conversion]
However, according to the OpenMP 5.0 standard, a loop variable can be "a
variable of a signed or unsigned integer type" [1], such that there should be
no type conversion required in the provided example.
This issue was initially observed with clang 11.0 on Ubuntu 18.04, but can also
be reproduced with the current clang x86-64 trunk version (tested on
"goodbolt.org").
#include <iostream>
int main() {
int min = -10;
int max = 10;
#pragma omp parallel for
for (int i = min; i <= max; ++i) {
std::cout << i << std::endl;
}
return 0;
}
[1] https://www.openmp.org/spec-html/5.0/openmpsu40.html#x63-1260002.9.1
--
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/20201204/3ed7d8f6/attachment.html>
More information about the llvm-bugs
mailing list