Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Inconsistent warnings for conflicting initializations

Harald1
New Contributor II
1,054 Views

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 Solution
Barbara_P_Intel
Employee
838 Views

ifx 2024.1 now prints a warning message for this reproducer. This version was released last week. Please try it out!


View solution in original post

0 Kudos
3 Replies
Barbara_P_Intel
Employee
1,019 Views

Thanks for reporting this. I filed a bug, COMPLRLLVM-50053. I'll let you know when a fix is available.



0 Kudos
Barbara_P_Intel
Employee
839 Views

ifx 2024.1 now prints a warning message for this reproducer. This version was released last week. Please try it out!


0 Kudos
Harald1
New Contributor II
822 Views

It's debatable which line to warn on - the declaration or the data statement - but now warnings are issued with -stand .

Thanks!

 

0 Kudos
Reply