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,e01fe1b326df26d4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Division by zero Date: 12 Jun 2005 08:21:04 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1118578864 20804 192.74.137.71 (12 Jun 2005 12:21:04 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 12 Jun 2005 12:21:04 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:11298 Date: 2005-06-12T08:21:04-04:00 List-Id: "Lurker" writes: > Hi, > > I'm curios about the problem which I discovered by accident. > The code below is of course very much reduced to show > the it: > > function x(a: integer) return integer is > > some_constant: constant := 0; > > begin > > -- return 1/some_constant; -- line 1 > > -- return a/some_constant; -- line 2 > > end; Static expressions that raise exceptions are illegal, so the compiler must give an error on line 1. The compiler should complain about line 2 (a "warning" or some such), but it is not required to by the Standard. > If line 1 is uncommented compiler (Gnat 3.15 for Widows) > > produces the expected error about division by zero. > > If line 2 is uncommented it passes compilation with no problem. > > Surely that's not right? Or did I miss something? This behavior conforms to the RM. But I suspect that if you sent a bug report about line 2, the implementer will fix it -- it's an obvious and easy-to-detect case that is most likely an error. - Bob