public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* Warning not catched
@ 2017-09-17 10:20 Angelo Graziosi
  2017-09-17 10:37 ` Janus Weil
  2017-09-17 14:25 ` Thomas Koenig
  0 siblings, 2 replies; 5+ messages in thread
From: Angelo Graziosi @ 2017-09-17 10:20 UTC (permalink / raw)
  To: fortran

Consider this simple test case:

program test_warn
  implicit none

  integer, parameter :: DP = selected_real_kind(12,60)
  real(DP), parameter :: Z0 = 0

  integer :: b(5)

  b(1:5) = Z0
end program test_warn

and compile it with:

gfortran -Wall -O2 -c test_warn.f90

Now, only with gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) it prints the warning:

   test_warn.f90:9:11:
   b(1:5) = Z0
           1
   Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion]

Instead the following more recent versions of gfortran do NOT emit any warning:

1) (on MSYS2, msys2 shell)
Target: x86_64-pc-msys
gcc version 6.3.0 (GCC)

2) (on MSYS2, mingw32 shell)
Target: i686-w64-mingw32
gcc version 7.2.0 (Rev1, Built by MSYS2 project)

3) (on MSYS2, mingw64 shell)
Target: x86_64-w64-mingw32
gcc version 7.2.0 (Rev1, Built by MSYS2 project)

4) (Win10 - Windows Subsystem for Linux)
Target: x86_64-pc-linux-gnu
gcc version 7.1.0 (GCC)

5) (on macOS 10.12 + MacPorts)
Target: x86_64-apple-darwin16
gcc version 6.4.0 (MacPorts gcc6 6.4.0_0)

(all Thread model: posix).

Is this to be expected? (My mind says no..)

Thanks,
 Angelo.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-17 20:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-17 10:20 Warning not catched Angelo Graziosi
2017-09-17 10:37 ` Janus Weil
2017-09-17 10:44   ` Angelo Graziosi
2017-09-17 14:25 ` Thomas Koenig
2017-09-17 20:11   ` Angelo Graziosi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).