This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/69423] New: Invalid optimization
- From: "antony at cosmologist dot info" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 21 Jan 2016 22:44:43 +0000
- Subject: [Bug fortran/69423] New: Invalid optimization
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69423
Bug ID: 69423
Summary: Invalid optimization
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: antony at cosmologist dot info
Target Milestone: ---
Using latest svn master branch, the follow code produces wrong results when
compiled with -O1 and higher optimizations:
program tester
character(LEN=:), allocatable :: S
S= test(2)
contains
function test(alen)
character(LEN=:), allocatable :: test
integer alen, i
do i = alen, 1, -1
test = 'test'
exit
end do
!This line prints nothing when compiled with -O1 and higher
print *, test
end function test
end program tester