This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] PR 30381, PR 30420: Fix constant-folding in bitwise intrinsics


Brooks Moses wrote:
2007-01-09 Brooks Moses <brooks.moses@codesourcery.com>

	* chkbits.f90: Added IBCLR tests; test calls for
	different integer kinds.
	* ishft.f90: Renamed to ishft_1.f90...
	* ishft_1.f90: ...Renamed from ishft.f90.
	* ishft_2.f90: New test.
	* ishft_3.f90: New test.
------------------------------------------------------------------------

! { dg-do run }
program ishft_2
  if ( ishftc(3, 2, 3) /= 5 ) call abort()
  if ( ishftc(256+3, 2, 3) /= 256+5 ) call abort()
  if ( ishftc(1_4, 31) /= (-huge(1_4) - 1) ) call abort()
end program

I sent the wrong version of this test file -- that last line should be:


if ( ishftc(1_4, 31) + 1 /= -huge(1_4) ) call abort()

Otherwise, with --pedantic, a warning is thrown about (-huge(1_4) - 1) being outside the symmetric range.

(I'm not at all convinced that this warning should be enabled unless someone specifically asks for it, but that's a separate issue.)

- Brooks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]