[Bug fortran/91728] New: Accepts array with wrong shape in a structure constructor
gscfq@t-online.de
gcc-bugzilla@gcc.gnu.org
Tue Sep 10 18:47:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91728
Bug ID: 91728
Summary: Accepts array with wrong shape in a structure
constructor
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gscfq@t-online.de
Target Milestone: ---
Affects versions down to at least gfortran-5.
Invalid constructor in z1.f90 should be rejected.
For reference :
$ cat z0_verify.f90
program p
type t
real :: a(3)
end type
type(t) :: x
x%a = [1.0]
end
$ gfortran-10-20190908 -c z0_verify.f90
z0_verify.f90:6:3:
6 | x%a = [1.0]
| 1
Error: Different shape for array assignment at (1) on dimension 1 (3 and 1)
$ cat z1.f90
program p
type t
real :: a(3)
end type
type(t) :: x
x = t([1.0])
print *, x
end
$ gfortran-10-20190908 z1.f90 && ./a.out
1.00000000 -4.27466052E-32 0.00000000
$
More information about the Gcc-bugs
mailing list