[Bug middle-end/106467] New: [OpenMP] Wrong code with collapse – tree sharing issue.

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 28 16:08:31 GMT 2022


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

            Bug ID: 106467
           Summary: [OpenMP] Wrong code with collapse – tree sharing
                    issue.
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: burnus at gcc dot gnu.org, jakub at gcc dot gnu.org,
                    sandra at gcc dot gnu.org
        Depends on: 106449
  Target Milestone: ---

Created attachment 53375
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53375&action=edit
Testcase, modified version of libgomp.c-c++-common/pr106449.c from attachment
53370 to PR 106449

+++ This bug was initially created as a clone of Bug #106449 +++

(In reply to Jakub Jelinek from bug 106449 comment #9)
> Created attachment 53370 [details]
> gcc13-pr106449-2.patch
> 
> Updated fix for this PR which fixes even the runtime case (it was caused by
> missing unsharing and regimplification clobbering a shared tree).

My potentially wrong impression is that the unshare_tree issue also exists
with a bare collapse.

At least, when converting the testcase from the patch to one which uses 'FOR'
instead of '(FOR) SIMD', it fails for BAR in a similar way as the SIMD version
with the initial version of the patch.

Namely, the result it the __builtin_abort call for i = 24 in bar (n=64, m=128):

33        for (i = 0; i < 32768; i++)
34          if (b[2 * i] != &a[i / 64] || b[2 * i + 1] != &a[(i / 64) + 64 + (i
% 64)])
35            __builtin_abort ();

The LHS of the is false (sub-LHS/sub-RHS are idential) but the RHS, i.e.
  b[2 * i + 1] != &a[(i / 64) + 64 + (i % 64)]
fails as 
  b[2 * i + 1] = 0x7fffffffd588
while
  &a[(i / 64) + 64 + (i % 64)] = 0x7fffffffd490


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106449
[Bug 106449] ICE in #pragma omp parallel for simd since
r6-4544-ge01d41e553aae245


More information about the Gcc-bugs mailing list