public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sgk at troutmask dot apl dot washington dot edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/29471] Warn with -std=f95/f2003 when BOZ is used at invalid places Date: Fri, 16 Mar 2007 04:07:00 -0000 [thread overview] Message-ID: <20070316040735.13552.qmail@sourceware.org> (raw) In-Reply-To: <bug-29471-1719@http.gcc.gnu.org/bugzilla/> ------- Comment #7 from sgk at troutmask dot apl dot washington dot edu 2007-03-16 04:07 ------- Subject: Re: Warn with -std=f95/f2003 when BOZ is used at invalid places On Fri, Mar 16, 2007 at 03:46:30AM -0000, jkrahn at nc dot rr dot com wrote: > > > ------- Comment #5 from jkrahn at nc dot rr dot com 2007-03-16 03:46 ------- > BOZ processing was recently broken in gfortran. No, it was fixed. > I assume it relates to the issues here. > > The current problem is shown in this bit of code: > > write(*,*)'NaN(8)=',real(z'FFF8000000000000',8) > end > > gfortran, even with -std=f2003, claims that the BOZ data is too big. Do you have an INTEGER(16)? > Apparently, it is first converting to an UNSIGNED integer, then trying to cast > to a SIGNED Fortran integer. Not even close to the truth. > With F2003, this form of BOZ should do a > 'reinterpret-cast' of raw binary bits directly to the destination type. gfortran implements the F95 behavior and extensions. The extension conflict with F2003. > Even without the reinterpret cast problem, integer BOZ is not handled > correctly. This expression also claims the BOZ is too large: > int(z'FFFFFFFFFFFFFFFF',8) Do you have INTEGER(16)? > Again, it is being intepreted as an UNSIGNED int then static-cast to a signed > in, thus overflowing. Not even close to the truth. > The traditional behavior is for all BOZ to be initially interpreted as the > largets integer type supported. Do you have an INTEGER(16)? > F95 dropped BOZ because of the lame definition Huh? > but F2003 brought it back for use mainly within REAL() and INT(), > which allow the raw initial interpretation in a sensible way. No, it isn't sensible. It is *processor dependent*. Think big versus little endian to start. Next consider that F2003 does not define the underlying floating representation. This was a very broken attempt to fix TRANSFER. > A related problem is that I am trying to create a NaN constant (parameter). I > can't use REAL+BOZ, but I also cannot define "real :: NaN = 0.0/0.0". In this > case, divide-by-zero is invalid math, but should only be a warning and not an > error. (I am speaking practically; I don't know what the standards say.) program rtfm x = 0. / 0. end program rtfm gfc -fno-range-check -o z rtfm.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29471
next prev parent reply other threads:[~2007-03-16 4:07 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-10-14 19:20 [Bug fortran/29471] New: " tobias dot burnus at physik dot fu-berlin dot de 2006-10-16 13:34 ` [Bug fortran/29471] " tobias dot burnus at physik dot fu-berlin dot de 2006-10-16 16:51 ` kargl at gcc dot gnu dot org 2006-10-16 17:12 ` tobias dot burnus at physik dot fu-berlin dot de 2006-10-16 17:23 ` kargl at gcc dot gnu dot org 2007-03-16 3:46 ` jkrahn at nc dot rr dot com 2007-03-16 3:54 ` jkrahn at nc dot rr dot com 2007-03-16 4:07 ` sgk at troutmask dot apl dot washington dot edu [this message] 2007-03-16 4:09 ` sgk at troutmask dot apl dot washington dot edu 2007-03-16 9:45 ` burnus at gcc dot gnu dot org 2007-08-12 20:10 ` fxcoudert at gcc dot gnu dot org 2007-12-08 21:47 ` burnus at gcc dot gnu dot org 2007-12-08 22:08 ` burnus at gcc dot gnu dot org 2007-12-08 22:10 ` burnus at gcc dot gnu dot org 2007-12-11 19:40 ` jkrahn at nc dot rr dot com 2007-12-11 23:15 ` burnus at gcc dot gnu dot org 2007-12-12 1:04 ` jkrahn at nc dot rr dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20070316040735.13552.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).