comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: What is the warning about builtin-function on gcc-4.6.0 ?
Date: Sun, 27 Mar 2011 13:56:25 -0400
Date: 2011-03-27T13:56:25-04:00	[thread overview]
Message-ID: <wccsju8ih12.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 87r59slbrs.fsf@mid.deneb.enyo.de

Florian Weimer <fw@deneb.enyo.de> writes:

> * Robert A. Duff:
>
>> Florian Weimer <fw@deneb.enyo.de> writes:
>>
>>> I'm bothered by this reasoning because it means that Ada compilers
>>> don't have to implement any overflow checks on integer arithmetic.
>>
>> Randy was talking about floating point.  I'm not sure why the
>> above follows from what Randy said, but anyway, the rules for
>> integer arithmetic are:
>
> Okay, back one step.  I can't find the language rule which allows
> floating point arithmetic to produce invalid values (or objects with
> invalid representation, if you will).
>
> Is this about 3.5.6(7/2)?
>
> | For the execution of a predefined operation of a real type, the
> | implementation need not raise Constraint_Error if the result is
> | outside the base range of the type, so long as the correct result is
> | produced, or the Machine_Overflows attribute of the type is False
> | (see*note G.2).
>
> In the typical i386 case, this simplifies to:
>
> | For the execution of a predefined operation of a real type, the
> | implementation need not raise Constraint_Error if the result is
> | outside the base range of the type.
>
> This means that my initial assessment that a false value for 'Valid
> indicates a compiler bug was wrong.

I think what you say above is correct, but I'm not an expert in floating
point.  I'm pretty sure the intent of Ada 95 was to allow infinities to be
returned on overflow.  I don't know about division by zero.

>>>...(You cannot detect values which are
>>> conceptually invalid by inspecting the 'Valid attribute at run time
>>> because it produces false negatives, but this is a different matter.)
>>
>> I'm not sure what you mean.  How can 'Valid produce false negatives?
>
> The language rules define that a certain point of execution, an object
> has an invalid representation (and a compiler may assume it has).  But
> this might not be visible on the hardware during actual execution
> because the invalid representation is, by sheer luck, valid for the
> type of the object.

Sorry, I still don't understand what you mean.  Maybe you could
give an example (preferably using integers, not floats).

- Bob



  reply	other threads:[~2011-03-27 17:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-26  6:32 What is the warning about builtin-function on gcc-4.6.0 ? ytomino
2011-03-26  8:45 ` Florian Weimer
2011-03-26  9:13   ` ytomino
2011-03-26  9:43     ` Florian Weimer
2011-03-26 10:07       ` ytomino
2011-03-26 10:24         ` Florian Weimer
2011-03-26 15:14           ` Dmitry A. Kazakov
2011-03-26 21:36             ` ytomino
2011-03-27  9:50               ` Dmitry A. Kazakov
2011-03-26 14:50         ` Simon Wright
2011-03-26 15:50           ` Florian Weimer
2011-03-26 16:32             ` Simon Wright
2011-03-26 17:02               ` Florian Weimer
2011-03-26 17:48                 ` Simon Wright
2011-03-26 18:48                   ` Florian Weimer
2011-03-27  2:08                 ` Randy Brukardt
2011-03-27  8:37                   ` Florian Weimer
2011-03-27 16:41                     ` Robert A Duff
2011-03-27 17:21                       ` Florian Weimer
2011-03-27 17:56                         ` Robert A Duff [this message]
2011-03-27 16:51                     ` Robert A Duff
2011-03-27 17:05                       ` Florian Weimer
2011-03-27 17:14                         ` Robert A Duff
2011-03-29  2:20                           ` Randy Brukardt
2011-03-29 18:35                             ` Robert A Duff
2011-03-29 23:35                               ` Randy Brukardt
2011-03-30  1:02                               ` Adam Beneschan
2011-03-30 12:57                                 ` Robert A Duff
2011-03-30 14:41                                   ` Adam Beneschan
2011-03-30 18:39                                     ` Robert A Duff
2011-03-30 19:28                                   ` Randy Brukardt
2011-03-26 21:58       ` ytomino
2011-03-26 22:00         ` Florian Weimer
2011-03-26 22:22 ` anon
2011-03-26 22:36   ` ytomino
2011-03-27 12:00     ` anon
2011-03-27 18:50       ` ytomino
2011-03-27 23:35         ` anon
2011-03-27 23:42         ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox