This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30381] New: ISHFTC() constant folding is broken.
- From: "brooks at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Jan 2007 06:04:44 -0000
- Subject: [Bug fortran/30381] New: ISHFTC() constant folding is broken.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
According to example in the F95 standard, this program should output 5, if
given inputs of 2 and 3. It does indeed do this.
program shiftcirc
integer i, j
read(*,*) i, j
write(*,*) ishftc( 3, i, j )
end program
However, if we replace i and j with constants, things start breaking. First:
program shiftcirc
write(*,*) ishftc( 3, 2, 3 )
end program
This outputs -3, which is incorrect. Worse, if we do this:
program shiftcirc
integer i
read(*,*) i
write(*,*) ishftc( 3, 2, i )
end program
This gives an error on compilation:
debian-gfortran:~/test> ../bin-trunk/bin/gfortran ishftc.f90 -o ishftc
ishftc.f90:4.26:
write(*,*) ishftc( 3, 2, i )
1
Error: Invalid third argument of ISHFTC at (1)
--
Summary: ISHFTC() constant folding is broken.
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: wrong-code, rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: brooks at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30381