https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79312
Bug ID: 79312
Summary: Empty array in assignment not correctly type-checked
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: john.harper at vuw dot ac.nz
Target Milestone: ---
This program violates f2008 syntax rule 7.2.1.2(4) but gfortran 6.1.1 on an
x86-64 system compiles and runs it, printing 0
program emptyarray5
implicit none
real a(0)
a = [logical::]
print *,size(a)
end program emptyarray5
! f2008 7.2.1.2 (4) if the variable is polymorphic it shall be type
! compatible with expr ; otherwise the declared types of the variable and
! expr shall conform as specified in Table 7.8,
!
! Table 7.8: Type conformance for the intrinsic assignment statement
!
! Type of the variable | Type of expr
!-----------------------------------------------------------+
! integer | integer, real, complex |
! real | integer, real, complex |
! complex | integer, real, complex |
! character | character |
! logical | logical |
! derived type | same derived type as the variable |
!-----------------------------------------------------------+