public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/95499] New: ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER
@ 2020-06-03 13:29 burnus at gcc dot gnu.org
  2020-06-03 15:44 ` [Bug middle-end/95499] " burnus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-03 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95499
           Summary: ICE: during GIMPLE pass: ssa / segfault in verify_ssa
                    / OpenMP target with deferred-length CHARACTER
           Product: gcc
           Version: 10.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
  Target Milestone: ---

Created attachment 48668
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48668&action=edit
Test case - compile with "gfortran -fopenmp"

The attached testcase, found when trying to test something else.

The following bit causes the problem:

    character(len=:), allocatable :: str    
    !$omp target map(from:str)


Fails with GCC trunk as:

during GIMPLE pass: ssa
test.f90:15:0:

   15 |   deallocate (A, my_str)
      | 
internal compiler error: Segmentation fault
0xeb42af crash_signal
        ../../repos/gcc/gcc/toplev.c:328
0x10d8c14 verify_ssa(bool, bool)
        ../../repos/gcc/gcc/tree-ssa.c:1070
0xdda8d5 execute_function_todo
        ../../repos/gcc/gcc/passes.c:1992
0xddb57e execute_todo
        ../../repos/gcc/gcc/passes.c:2039


With the distro's GCC 7 + 9 + 10, I get ("gfortran-10 -foffload=disable
-fopenmp"):

during IPA pass: fnsummary
test.f90:15: internal compiler error: tree code ‘ssa_name’ is not supported in
LTO streams


In the debugger, I see:

Program received signal SIGSEGV, Segmentation fault.
verify_ssa (check_modified_stmt=check_modified_stmt@entry=true,
check_ssa_operands=check_ssa_operands@entry=true) at
../../repos/gcc/gcc/gimple.h:6626
6626      return gimple_code (g) == GIMPLE_NOP;

(gdb) list
6621    /* Returns TRUE if statement G is a GIMPLE_NOP.  */
6622
6623    static inline bool
6624    gimple_nop_p (const gimple *g)
6625    {
6626      return gimple_code (g) == GIMPLE_NOP;
6627    }

(gdb) bt
#0  verify_ssa (check_modified_stmt=check_modified_stmt@entry=true,
check_ssa_operands=check_ssa_operands@entry=true) at
../../repos/gcc/gcc/gimple.h:6626
#1  0x0000000000d604a6 in execute_function_todo (fn=0x7ffff78cf0b0,
data=<optimized out>) at ../../repos/gcc/gcc/passes.c:1992
#2  0x0000000000d611dd in do_per_function (data=0x8040, callback=0xd60230
<execute_function_todo(function*, void*)>) at ../../repos/gcc/gcc/passes.c:1640
#3  execute_todo (flags=32832) at ../../repos/gcc/gcc/passes.c:2039
#4  0x0000000000d639a3 in execute_one_pass (pass=0x25b23d0) at
../../repos/gcc/gcc/passes.c:2539

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

* [Bug middle-end/95499] ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER
  2020-06-03 13:29 [Bug middle-end/95499] New: ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER burnus at gcc dot gnu.org
@ 2020-06-03 15:44 ` burnus at gcc dot gnu.org
  2020-06-03 16:28 ` burnus at gcc dot gnu.org
  2020-08-06 12:36 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-03 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
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

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

* [Bug middle-end/95499] ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER
  2020-06-03 13:29 [Bug middle-end/95499] New: ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER burnus at gcc dot gnu.org
  2020-06-03 15:44 ` [Bug middle-end/95499] " burnus at gcc dot gnu.org
@ 2020-06-03 16:28 ` burnus at gcc dot gnu.org
  2020-08-06 12:36 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-06-03 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
See also PR 95506 which is vaguely related.

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

* [Bug middle-end/95499] ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER
  2020-06-03 13:29 [Bug middle-end/95499] New: ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER burnus at gcc dot gnu.org
  2020-06-03 15:44 ` [Bug middle-end/95499] " burnus at gcc dot gnu.org
  2020-06-03 16:28 ` burnus at gcc dot gnu.org
@ 2020-08-06 12:36 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2020-08-06 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
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.)

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

end of thread, other threads:[~2020-08-06 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03 13:29 [Bug middle-end/95499] New: ICE: during GIMPLE pass: ssa / segfault in verify_ssa / OpenMP target with deferred-length CHARACTER burnus at gcc dot gnu.org
2020-06-03 15:44 ` [Bug middle-end/95499] " burnus at gcc dot gnu.org
2020-06-03 16:28 ` burnus at gcc dot gnu.org
2020-08-06 12:36 ` 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).