public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/105345] New: [OpenMP] Wrong iteration loop count when mixing signed and unsigned
@ 2022-04-22 10:38 burnus at gcc dot gnu.org
0 siblings, 0 replies; only message in thread
From: burnus at gcc dot gnu.org @ 2022-04-22 10:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105345
Bug ID: 105345
Summary: [OpenMP] Wrong iteration loop count when mixing signed
and unsigned
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: openmp, wrong-code
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
CC: frederik at gcc dot gnu.org, jakub at gcc dot gnu.org
Target Milestone: ---
The following program has a loop count of 0 without OpenMP (-fno-openmp)
but is executed 1010 times with -fopenmp in GCC.
The problem is that the following is not honored:
"If var has a signed integer type and the var operand of test-expr after usual
arithmetic conversions has an unsigned integer type then the loop iteration
count
is computed from lb, test-expr and incr using an unsigned integer type
corresponding
to the type of var." (OpenMP 5.2, 4.4.2 OpenMP Loop-Iteration Spaces and
Vectors)
(Likewise: OpenMP 5.1, 2.11.1 Canonical Loop Nest Form)
The wording seems to be new since OpenMP 5.1 - and to ensure that the OpenMP
and C loop counts are the same:
int
main ()
{
#pragma omp for
for (int i = -1000; i < 10u; ++i) {
__builtin_printf("%d\n", i);
__builtin_abort ();
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-22 10:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-22 10:38 [Bug middle-end/105345] New: [OpenMP] Wrong iteration loop count when mixing signed and unsigned burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).