[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-03-13 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Paul Thomas :

https://gcc.gnu.org/g:7987beec679898cfa75839551d55ae5234a216bd

commit r11-7657-g7987beec679898cfa75839551d55ae5234a216bd
Author: Paul Thomas 
Date:   Sat Mar 13 11:39:57 2021 +

Fortran: Fix for class defined operators [PR99125].

2021-03-13  Paul Thomas  

gcc/fortran
PR fortran/99125
* trans-array.c (gfc_conv_expr_descriptor): For deferred length
length components use the ss_info string length instead of
gfc_get_expr_charlen. Make sure that the deferred string length
is a variable before assigning to it. Otherwise use the expr.
* trans-expr.c (gfc_conv_string_length): Make sure that the
deferred string length is a variable before assigning to it.

gcc/testsuite/
PR fortran/99125
* gfortran.dg/alloc_deferred_comp_1.f90: New test.

[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-02-22 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

--- Comment #5 from G. Steinmetz  ---

I also checked this invalid (probably a known issue) :


$ cat za.f90
program p
   character(:), allocatable :: a(:)
   character(8) :: c(2) = '12 45 78'
   a = c
   print *, a(7:8)
end

$ gfortran-11-20210221 za.f90 && ./a.out   # surprising
 12 45 7812 45 78


Detected at runtime :

$ gfortran-11-20210221 za.f90 -Wall -fcheck=all && ./a.out
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
Warning: '.a' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.offset' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.dim[0].lbound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.dim[0].ubound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.dim[0].lbound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.dim[0].ubound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.dim[0].ubound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
za.f90:4:8:

4 |a = c
  |^
Warning: 'a.dim[0].lbound' may be used uninitialized [-Wmaybe-uninitialized]
za.f90:2:36:

2 |character(:), allocatable :: a(:)
  |^
note: 'a' declared here
At line 5 of file za.f90
Fortran runtime error: Index '7' of dimension 1 of array 'a' outside of
expected range (1:2)

Error termination. Backtrace:
#0  0x4025d1 in ???
#1  0x402738 in ???
#2  0x7fa0f5697f89 in ???
#3  0x4022b9 in ???
at ../sysdeps/x86_64/start.S:120
#4  0x in ???


---

The very basic simplification gives :

$ cat zc.f90
program p
   character(8) :: c(2) = '12 45 78'
   print *, c(7:8)
end

$ gfortran-11-20210221 zc.f90 -Wall -fcheck=all && ./a.out
zc.f90:3:14:

3 |print *, c(7:8)
  |  1
Warning: Lower array reference at (1) is out of bounds (7 > 2) in dimension 1
At line 3 of file zc.f90
Fortran runtime error: Index '7' of dimension 1 of array 'c' outside of
expected range (1:2)

Error termination. Backtrace:
#0  0x4023f7 in ???
#1  0x40242b in ???
#2  0x7fc15fc2af89 in ???
#3  0x4022b9 in ???
at ../sysdeps/x86_64/start.S:120
#4  0x in ???

[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-02-22 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

--- Comment #4 from G. Steinmetz  ---

> What was the reason for the (7:8) in the testcase?
If this question was directed at me, some background :

The problem occurred during verification tests, 
in other code constellation and with other numbers. 
(7:8) is simply beyond the array extension (1:2).

The example in comment #0 was the result of some 
simplifications in order to get a very simple test case.

I wondered about the ICE, and that it could be narrowed 
down to (well) a time range in the recent past.

In the case of a regression, there must be a trigger for 
the change, and knowing this trigger can be quite helpful.

It sometimes happens that there are gray zones where 
something "works" incorrectly with some numbers, 
or does not work with other numbers and remains undetected, 
or is detected with some combinations of options with again 
other numbers, or leads to an ICE with again other numbers.

Cheers,
Gerhard

[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-02-21 Thread pault at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

Paul Thomas  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |pault at gcc dot gnu.org

--- Comment #3 from Paul Thomas  ---
Created attachment 50229
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50229&action=edit
Provisional patch

This regtests OK but needs a small amount of reorganisation before submission.
It willl happen tomorrow.

BTW Although the ICE is a regression, the testcase never gave the intended
result.

What was the reason for the (7:8) in the testcase? -fcheck=all picks it up
correctly.

Cheers

Paul

[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-02-18 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |9.4
   Priority|P3  |P4

[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-02-16 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

Martin Liška  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2021-02-16
 CC||marxin at gcc dot gnu.org,
   ||pault at gcc dot gnu.org

--- Comment #2 from Martin Liška  ---
Confirmed, started with r9-6726-gd5f48c7c62d3d8cf.

[Bug fortran/99125] [9/10/11 Regression] ICE: gimplification failed (gimplify.c:15068)

2021-02-16 Thread gscfq--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99125

--- Comment #1 from G. Steinmetz  ---

Works with valid code :


$ cat z0.f90
program p
   type t
  character(:), allocatable :: c(:)
   end type
   character(8) :: a(2) = '12 45 78'
   type(t) :: x
   x%c = a
   print *, x%c
   print *, x%c(1)(7:8)
end


$ gfortran-11-20210214 z0.f90 && ./a.out
 12 45 7812 45 78
 78