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,d0310bb11aeb7260 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.42.158.4 with SMTP id f4mr33992414icx.4.1321488137392; Wed, 16 Nov 2011 16:02:17 -0800 (PST) Path: h5ni62975pba.0!nntp.google.com!news2.google.com!postnews.google.com!x10g2000prk.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: GNAT 4.4.5 order of conditional processing? Date: Wed, 16 Nov 2011 16:00:52 -0800 (PST) Organization: http://groups.google.com Message-ID: <5d60a8d2-b113-45c4-9096-fe3265518059@x10g2000prk.googlegroups.com> References: <9ig1t4F4uaU1@mid.individual.net> <87a589f9-e675-4672-a8c5-77e4a9db289e@g21g2000yqc.googlegroups.com> <22d4b4be-1a2e-435c-9b92-fbda6999a4f3@d17g2000yql.googlegroups.com> <8b60c7a5-8b9e-4573-9470-0c3aca099dbc@r9g2000vbw.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1321488137 31764 127.0.0.1 (17 Nov 2011 00:02:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 17 Nov 2011 00:02:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x10g2000prk.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: news2.google.com comp.lang.ada:14432 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-11-16T16:00:52-08:00 List-Id: On Nov 16, 2:40=A0pm, Adam Beneschan wrote: >=A0For instance: > > =A0 subtype Index_Subtype is Integer range 1 .. 10; > =A0 Arr : array (Index_Subtype) of Float; > =A0 Curr_Index : Index_Subtype; > > =A0 if Curr_Index_Initialized and Arr(Curr_Index) < -1.0 then ... > > Suppose Curr_Index_Initialized is FALSE and Curr_Index has never been > initialized to anything. =A0The result is that if the right side is > evaluated, Curr_Index's uninitialized value may be a value outside the > range 1..10, and then the code will read an element of Arr that is > outside the bounds of Arr. =A0Big deal. =A0That's not likely to make a > program fail. =A0(Unless the bit pattern it reads happens to be a > Signaling NaN, maybe!!) Clarification: Depending on how Curr_Index is represented (some compilers would fit it into an 8-bit byte while others would make it as big as an Integer), evaluating Arr(Curr_Index) could make the program fail if Curr_Index is big enough to put the element's address out of the program's memory space. So it's more likely to fail than I first claimed. Keep in mind that this is just my example and I don't know that the OP was doing any array indexing. -- Adam