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,6c7dea22b75ba442 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!e34g2000pro.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: ada compiler? Date: Mon, 12 Nov 2007 08:38:44 -0800 Organization: http://groups.google.com Message-ID: <1194885524.120844.198840@e34g2000pro.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1194885524 17952 127.0.0.1 (12 Nov 2007 16:38:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 12 Nov 2007 16:38:44 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: e34g2000pro.googlegroups.com; posting-host=66.126.103.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news1.google.com comp.lang.ada:18320 Date: 2007-11-12T08:38:44-08:00 List-Id: On Nov 9, 9:08 pm, tmo...@acm.org wrote: > > >Note that "-gnato -fstack-check" is needed for GNAT to be an Ada compiler. > > > Where did you get that one! > > > I have never use "-gnato -fstack-check" and all programs that I have > > created have work. May be you have some wrong on your system. > > Try > with ada.text_io; > procedure isitada is > x : integer := integer'last-2; > begin > ada.text_io.put("it is"); > for i in 1 .. 3 loop > x := x+1; > end loop; > ada.text_io.put(" not Ada"); > exception > when constraint_error => > ada.text_io.put_line(" Ada"); > end isitada; I've noticed that in the argument that has ensued from this post (yes it works fine, no it doesn't, it's real Ada, it isn't, it's high- integrity or low-integrity mode blah blah blah), nobody has mentioned what platform they're running on. I'm not familiar with GNAT in great detail, but it would seem to me that this is the sort of option where the default would depend on the processor and OS. On some processor/ OS combinations, it's fairly easy to get programs to raise an exception when integer overflow occurs---because the processor is capable of faulting when overflow happens, and the OS has ways of letting the program trap the fault and map it to a Constraint_Error exception. On other processors or OS's, the facility isn't there, and you can't implement this overflow without additional code, such as doing a "branch if overflow bit is set in the condition code" after every addition or subtraction. (One processor I've worked with doesn't even have an integer overflow status; to check for overflow we had to perform two different kinds of additions and see if the results were the same.) On such platforms, the efficiency penalty for implementing the checks required by the language is significant. That's the reason for having an option like -gnato in the first place. But it would not surprise me that on some platforms, where there is no efficiency penalty, that the overflow checking would be in effect whether it's explicitly specified on the command line or not. There wouldn't be any reason to turn it off. -- Adam