Hello,
the following non-conforming code is accepted by ifort/ifx, but gives a warning only with "ifort -stand" (not with ifx) and only for one variant:
program p
implicit none
type t1
integer :: g = 0
end type t1
type t2
integer :: g
end type t2
type(t1) :: u1 = t1(1)
type(t2) :: u2 = t2(2) ! <- Warning only here, w/ ifort -stand
data u1%g /3/ ! <- conflicting initialization
data u2%g /4/ ! <- conflicting initialization
print *, u1%g, u2%g
end program p
While NAG rejects both data statements (with slightly different error messages), Intel gives:
% ifx ifort-data2.f90 -stand
(silent = no warning at all)
% ifort ifort-data2.f90 -stand
ifort-data2.f90(10): warning #5436: Overlapping storage initializations encountered with U2
type(t2) :: u2 = t2(2) ! <- Warning only here, w/ ifort -stand
----------------------^
While it is nice to have at least one warning here, it points to the wrong place: it is not the declaration that is at fault, it is the data statement.
1 解決方案
ifx 2024.1 now prints a warning message for this reproducer. This version was released last week. Please try it out!
連結已複製
3 回應
