[Bug middle-end/95499] ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER

2020-08-06 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95499

--- Comment #3 from Tobias Burnus  ---
For 'character(len=:),allocatable :: str' there is '_str' with the string
length. 

One can map it explicitly when mapping 'from(str)' by also mapping
'firstprivate(_str)' but the compiler will later remove it as '_str' is
(initially) unused.
Later, gfc_omp_clause_default_ctor is called for 'private(str) – the generated
tree uses "malloc(max(1, _str))", but at that point is too late for the mapping
analysis – hence, '_str' is not mapped. Note: gfc_omp_finish_clause is not
called for 'str' and '_str' is not yet used at this point.

This has to be supported for a scalar 'str', an array str, and either as
derived-type component. (For the latter, see also PR95837 for kind=4 issues.)

[Bug middle-end/95499] ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER

2020-06-03 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95499

Tobias Burnus  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #2 from Tobias Burnus  ---
See also PR 95506 which is vaguely related.

[Bug middle-end/95499] ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER

2020-06-03 Thread burnus at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95499

--- Comment #1 from Tobias Burnus  ---
Test case need the change (in line 40) to compile - sorry.
@@ -40 +40 @@
-if (any (array /= [(-2*i, i = 1, nn)])) error stop 2
+if (any (array /= [(-2*i, i = 1, 10)])) error stop 2

Shorter test case – but consider using the full one for the testsuite!

Remarks:
* As it, it fails as shown in comment 0
* When commenting the 'str = "…' it segfault in dominated_by_p  
* When commenting that line + removes/comments-out the 'map(from:str)' clause,
  it ICEs in expand_expr_real_1, at expr.c:10160

  subroutine bar_str(str)
integer :: i
character(len=:), allocatable :: str

!$omp target map(from:str)
str = "abcdefghij"
!$omp do private(str)
do i = 1, 10
  str(i:i) = achar(ichar('A') + i)
end do
!$omp end target
  end