https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124362

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
BTW: The testcase is marked as C++, but it actually is plain C code.

* * *

The testcase seems to be indeed magic. There are 17 blocks of the kind:

#if 0
  // 15. dist_schedule static chunk, schedule guided chunk
  printf("dist_schedule static chunk, schedule guided chunk\n");
...
  printf("Succeeded\n");
#endif

differing only in the 'schedule' and 'dist_schedule' clauses to
'distribute parallel for'.


If I comment out any of the 17 blocks, the program succeeds. – If I leave in
all 17, it fails nearly* always earlier or later as reported in comment 0. (*A
very few times, it fails).


I also tried to wrap everything between after 'target enter data' and before
'target exit data' into a loop and running it multiple times, but that seemed
to have less effect than leaving all 17 blocks in there.
However, I have obviously not tried all combinations.

* * *

(The following is all about the GCN build.)

The miscompilation seems to happen in a runtime library: If I just revert the
patch + compile $build/gcc, it still fails. – If I also compile
$build/amdgcn-amdhsa, i.e. the runtime libraries, it starts passing.

Digging deeper: Re-apply the commit + re-building libgomp.a also does not cause
the fail. – But then rebuild newlib does.


=> Seems as if NEWLIB gets miscompiled.

Reply via email to