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