https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70959
Bug ID: 70959 Summary: Invalid change of value conversion warning message Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: w.clodius at icloud dot com Target Milestone: --- Created attachment 38415 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38415&action=edit A simplified program generating the inappropriate error The file module test_int use, intrinsic:: iso_fortran_env integer(int64), parameter :: & e18 = 1000000000000000000_int64, & e19 = ( -huge(1_int64) + & (e18-223372036854775807_int64) & ) - 2 end module test_int when compiled using fortran -std=f2008 -fmax-errors=10 -Wall -Wimplicit-interface -O3 -fbacktrace -fwhole-file -I mod_dir -c -o test_int.o test_int.f90 on Mac OS X version 10.11.4 with version gfortran --version GNU Fortran (GCC) 6.1.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. produces the message test_int.f90:5:11: e18 = 1000000000000000000_int64, & 1 Warning: Change of value in conversion from ‘INTEGER(8)’ to ‘REAL(4)’ at (1) [-Wconversion] This suggests that the front end is assigning the wrong type to at least one of e18 e19 or the expression ( -huge(1_int64) + (e18-223372036854775807_int64) ) - 2 According to Dominique D'Humières the following simplified code has the result ! integer(8), parameter :: e18 = 10000000000_8 integer(8), parameter :: e18 = 100000000000_8 integer(8), parameter :: e19 = (e18) ! integer(8), parameter :: e19 = e18 print *, e18, e19 end warn_conv_db_3.f90:2:32: integer(8), parameter :: e18 = 100000000000_8 1 Warning: Change of value in conversion from 'INTEGER(8)' to 'REAL(4)' at (1) [-Wconversion] The warning is gone if I remove the parentheses in e19 = (e18) or if I replace 100000000000_8 with 10000000000_8. which suggests that e18 is being assigned the inappropriate type due to the appearance of (e18) in the definition of e19