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: Possible bug with range checking


On Thu, Jan 27, 2011 at 04:09:03PM +0100, Arjen Markus wrote:
> Hi Steve,
> 
> now I get it - z'80000000' is evaluated as being an 8-bytes integer
> and as such it
> is positive, but too large to fit in a 4-byte integer.
> 
> I did read the message, but I did not understand where the reference
> to integer(8)
> was coming from - my bad (I have had enough cafeine today, so that is
> no excuse).
> 
> I have found a standard-conforming and portable way of achieving this
> bit pattern
> though:
> 
> integer, parameter :: value = ishft(1,31)
> 

It's standard conforming, but not necessarily portable.
See section 13.5.7, last sentence where the infamous
words 'processor dependent' appears.  There may also
be endian issues.
  
-- 
Steve


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