[Bug fortran/31210] New: wrong code generated with gfortran
jv244 at cam dot ac dot uk
gcc-bugzilla@gcc.gnu.org
Fri Mar 16 11:29:00 GMT 2007
With a recent gfortran, the following compiles, but generates the wrong
results:
MODULE xml_markups
LOGICAL, PRIVATE :: should_write_tags=.TRUE.
CONTAINS
FUNCTION write_xml_tag(tag) RESULT(res)
CHARACTER(LEN=*), INTENT(IN) :: tag
CHARACTER(LEN=MERGE(LEN_TRIM(tag),0,should_write_tags)) :: res
res=tag
END FUNCTION write_xml_tag
SUBROUTINE set_write_xml_tags(should_write)
LOGICAL, INTENT(IN) :: should_write
should_write_tags=should_write
END SUBROUTINE
END MODULE xml_markups
USE xml_markups
REAL, PARAMETER :: val=3.1415
character(len=80) :: old,new,new2
! old style write
write(old,'(T2,F12.6)') val
! new style write
write(new,'(T2,A,F12.6,A)') write_xml_tag("<keword> "), &
val,write_xml_tag("</keyword> ")
! if the use has selected --no-xml-output this should be set early
CALL set_write_xml_tags(.FALSE.)
! new style write with old result
write(new2,'(T2,A,F12.6,A)') write_xml_tag("<keword> "), &
val,write_xml_tag("</keyword> ")
IF (old.NE.new2) CALL ABORT()
END
--
Summary: wrong code generated with gfortran
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jv244 at cam dot ac dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31210
More information about the Gcc-bugs
mailing list