From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ecc38b3271b36b88 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: What is the warning about builtin-function on gcc-4.6.0 ? Date: Wed, 30 Mar 2011 08:57:51 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <87aagiclte.fsf@mid.deneb.enyo.de> <475d10ca-5d4e-490c-9b88-e12cd3cd3faa@b13g2000prf.googlegroups.com> <87d3lejjyv.fsf@mid.deneb.enyo.de> <6c748f70-7e75-49b4-a467-d1d2d6b24323@w9g2000prg.googlegroups.com> <87k4flhoeg.fsf@mid.deneb.enyo.de> <8762r5hl2u.fsf@mid.deneb.enyo.de> <87vcz5ot5z.fsf@mid.deneb.enyo.de> <87sju8lcis.fsf@mid.deneb.enyo.de> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls6.std.com 1301489871 20044 192.74.137.71 (30 Mar 2011 12:57:51 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 30 Mar 2011 12:57:51 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:zdukG1WAlmiKw9uNwLqIhF7fLT4= Xref: g2news2.google.com comp.lang.ada:19570 Date: 2011-03-30T08:57:51-04:00 List-Id: Adam Beneschan writes: > On Mar 29, 11:35�am, Robert A Duff > wrote: > >> > And if it didn't do that, the implementor could change the function to >> > include 'Valid on the operands to ensure that they're not invalid. >> >> Sure, EQUAL can raise C_E on invalid values. >> But I don't think it can return True for invalid values >> that are not mathematically equal. �(If it can, I think it's >> a mistake in the REPORT package.) �I'm too lazy to inspect it >> right now. > > The version of Report's body I'm looking at is from 3/29/01, but the > comments don't indicate any changes to EQUAL since the first version. > EQUAL can't propagate C_E because it has an exception handler for it: > it just reverts to "return X = Y" if any exception is raised. I see. But as Randy pointed out, passing an invalid value to EQUAL can raise C_E, even if abs(Integer'First) doesn not. >...If the > compiler's behavior is incorrect and doesn't raise C_E for > abs(Integer'First) when it's supposed to, then presumably > abs(Integer'First) will still be Integer'First (on a normal 2's > complement machine), and EQUAL will return TRUE. Right, that would be a compiler bug. I was imagining a compiler that returns the right answer for abs(Integer'First). It's not entirely unreasonable. Perhaps Integer is 32 bits, and the arithmetic is done in a 64-bit register, which can obviously represent 2**31 just fine. >...[If the compiler did > something interesting like reserving a bit pattern like 16#8000# or > 16#80000000# to be an invalid integer, then Integer'Last would be - > Integer'First and the interesting part of C45632A would never be > executed due to the first IF.] I've used compilers that did that. Not Ada compilers, though. - Bob