public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/104563] New: [OpenMP] ICE in install_var_field, at omp-low.cc:810 (multi map of same var)
@ 2022-02-16 10:05 burnus at gcc dot gnu.org
  2022-02-17 17:02 ` [Bug middle-end/104563] " jakub at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2022-02-16 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104563
           Summary: [OpenMP] ICE in install_var_field, at omp-low.cc:810
                    (multi map of same var)
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Found in
https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/target/test_target_mapping_before_alloc.F90
(See also https://github.com/SOLLVE/sollve_vv/issues/464 )

Compiling that testcase with GCC gfortran (7, 8, 9, 10, 11 and) mainline fails
as follows.

I think the problem is that scalar/a/test_struct appear multiple times, which
is invalid in OpenMP 4.5 but valid since 5.0.

Thus, the solution for 4.5 would be to diagnose this - and for 5.0 to accept
this.


tests/5.0/target/test_target_mapping_before_alloc.F90:51:43:

   51 |     !$omp& test_struct) map(tofrom: errors)
      |                                           ^
internal compiler error: in install_var_field, at omp-low.cc:810
0x732767 install_var_field
        ../../repos/gcc/gcc/omp-low.cc:810
0xeafbce scan_sharing_clauses
        ../../repos/gcc/gcc/omp-low.cc:1622
0xeb0feb scan_omp_target
        ../../repos/gcc/gcc/omp-low.cc:3050
0xeb221b scan_omp_1_stmt
        ../../repos/gcc/gcc/omp-low.cc:4241


Slightly reduced testcase:

SUBROUTINE foo
    INTEGER :: x, scalar
    INTEGER, DIMENSION(10) :: a

    TYPE structure
       INTEGER :: var
       INTEGER,DIMENSION(10) :: b
    END TYPE structure
    TYPE(structure) :: test_struct
    test_struct%var = 1
    a(:) = 42
    test_struct%b(:) = 42
    scalar = 80

    !$omp target map(alloc: scalar, a, test_struct) map(to: scalar, a,
test_struct)
      if (scalar /= 80 .OR. a(2) .ne. 42 .OR. test_struct%var /= 1 .OR.
test_struct%b(2) /= 42) stop 1
    !$omp end target
END

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug middle-end/104563] [OpenMP] ICE in install_var_field, at omp-low.cc:810 (multi map of same var)
  2022-02-16 10:05 [Bug middle-end/104563] New: [OpenMP] ICE in install_var_field, at omp-low.cc:810 (multi map of same var) burnus at gcc dot gnu.org
@ 2022-02-17 17:02 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-17 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Trying the hopefully matching rewrite of the test into C/C++:
void
foo (void)
{
  int x, scalar;
  int a[10];
  struct S { int var; int b[10]; } test_struct;
  int i;
  test_struct.var = 1;
  for (i = 0; i < 10; i++)
    {
      a[i] = 42;
      test_struct.b[i] = 42;
    }
  scalar = 80;
  #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar, a,
test_struct)
  if (scalar != 80 || a[1] != 42 || test_struct.var != 1 || test_struct.b[1] !=
42)
    __builtin_abort ();
}
is right now rejected by GCC:
pr104563.c: In function ‘void foo()’:
pr104563.c:15:44: error: ‘test_struct’ appears more than once in map clauses
   15 |   #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar,
a, test_struct)
      |                                            ^~~~~~~~~~~
pr104563.c:15:41: error: ‘a’ appears more than once in map clauses
   15 |   #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar,
a, test_struct)
      |                                         ^
pr104563.c:15:33: error: ‘scalar’ appears more than once in map clauses
   15 |   #pragma omp target map(alloc: scalar, a, test_struct) map(to: scalar,
a, test_struct)
      |                                 ^~~~~~
I agree it is invalid OpenMP 4.5, valid in OpenMP 5.0.
But as we clearly don't support it for C/C++, IMHO we shouldn't support it for
Fortran either,
especially when the support in the middle-end for it isn't there yet (otherwise
it wouldn't ICE).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-17 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 10:05 [Bug middle-end/104563] New: [OpenMP] ICE in install_var_field, at omp-low.cc:810 (multi map of same var) burnus at gcc dot gnu.org
2022-02-17 17:02 ` [Bug middle-end/104563] " jakub 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).