Article View: gnu.gcc.help
Article #41526Re: gcc fails Paranoia (numeric) test under Linux
From: WE Metzenthen
Date: Sat, 16 Mar 1996 00:00
Date: Sat, 16 Mar 1996 00:00
60 lines
3216 bytes
3216 bytes
This is starting to get off the topic of 'paranoia', but Harald Anlauf
<anlauf@crunch.ikp.physik.th-darmstadt.de> wrote:
> Second, there is a real bug present at least in gcc versions 2.6.3 and
> 2.7.0, reported by Geoff Kuenning, that I'll append below. I cannot
> check newer releases right now, so please someone follow-up.
Is it really a "real bug"?
This is the problem of "wide function returns". I brought this matter
up with Tom Wood and Ron Guilmette in March and April 1993. The
discussion was not conclusive, the last word from Ron to my question:
> The issue is this: should a function which is declared to return a
> "double" always return a _strict_ "double" i.e. a value where all bits
> of the significand past some bit (the 53rd bit in the Intel FPU case)
> are zero (and similarly for "float", etc)? Indeed, is this the
> _definition_ of a "double" (or "float", etc)?
was:
> This is a grey area of the ANSI C standard (in my opinion). It depends
> upon whether or not you classify "returning" as a form of "assignment".
> The ANSI C standard requires that assignments and casts must force the
> type of the value being assigned or cast to the type of the destination
> variable or to the type indicated by the cast (respectively).
>
> My own opinion is that "returning" need not necessarily be considered to
> be a form of "assignment" (by ANSI conformant C compilers) and that such
> compilers may just return whatever type "seems" right, but I admit that
> I don't have all the facts in this case, and I'm going to ask some other
> people about it.
More recently, I found that the report of the NCEG specified pragmas
including:
#pragma fp_wide_function_returns on-off-switch
whose purpose is to allow "floating return values to be represented in
a wider format than (and not narrowed to) the declared type of the
function". However, these pragmas have not been retained in the
latest specification.
The discussion in the specification notes that "If the on-off-switch
is off then widening is disallowed. Standard C compatibility requires
that the default state for the pragmas be off." I am not sure about
the semantics of this statement, but I suspect that it means that the
default state for any pragma is 'off', not that widening is
necessarily disallowed in Standard C.
--
Bill Metzenthen
Mathematics Department
Monash University
Clayton, Victoria, Australia
email: billm@euler.maths.monash.edu.au
billm@jacobi.maths.monash.edu.au
Technical Details
Message-ID:
<4idvos$72b@harbinger.cc.monash.edu.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4hn916$ejs@news.ccit.arizona.edu> <ub20mx45l5.fsf@crunch.ikp.physik.th-darmstadt.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,fbe8ee8d82a9766b X-Google-Attributes: gid11318c,public X-Google-Thread: 1103af,fbe8ee8d82a9766b X-Google-Attributes: gid1103af,public From: billm@euler.maths.monash.edu.au (WE Metzenthen) Subject: Re: gcc fails Paranoia (numeric) test under Linux Date: 1996/03/16 Message-ID: <4idvos$72b@harbinger.cc.monash.edu.au> X-Deja-AN: 142912580 x-nntp-posting-user: billm references: <4hn916$ejs@news.ccit.arizona.edu> <ub20mx45l5.fsf@crunch.ikp.physik.th-darmstadt.de> followup-to: gnu.gcc.help,comp.os.linux.misc organization: Monash University newsgroups: gnu.gcc.help,comp.os.linux.misc