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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a5e:d918:: with SMTP id n24mr1539308iop.3.1549955135843; Mon, 11 Feb 2019 23:05:35 -0800 (PST) X-Received: by 2002:a05:6830:1212:: with SMTP id r18mr47745otp.0.1549955135713; Mon, 11 Feb 2019 23:05:35 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!k10no108071itk.0!news-out.google.com!v141ni293ita.0!nntp.google.com!k10no108069itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 11 Feb 2019 23:05:35 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=5.186.124.106; posting-account=hMbstgoAAAAIa4kxFYtvUVUHbE1RcZzT NNTP-Posting-Host: 5.186.124.106 References: <21f5f1ca-eabe-4ce6-9ee0-5d308d7676ff@googlegroups.com> <17375128-e016-4366-91ff-cd68f74689b3@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <989ea6c7-b432-4214-beec-c0a50b76932c@googlegroups.com> Subject: Re: GNAT proposal: note on implicit exceptions insertion From: Jesper Quorning Injection-Date: Tue, 12 Feb 2019 07:05:35 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:55497 Date: 2019-02-11T23:05:35-08:00 List-Id: tirsdag den 12. februar 2019 kl. 00.41.54 UTC+1 skrev Randy Brukardt: > This sounds like a great idea, in that many people (including me) have had > this one over the years. (The first time I remember hearing about it was at > the very first AdaTec (which later become SigAda) meeting that we went to - > circa 1984). Ideas takes time to become reality. > Anyway, this depends on what you mean by such a switch. A switch that simply > reported every place where the language semantics requires a > language-defined check wouldn't be useful, because the language requires a > check almost everywhere (for every subtype conversion, for instance, > including those that don't actually do anything). 1: subtype Index_Type is range 1 .. Integer'Last; 2: My_Array : array (Index_Type) of Boolean; 3: ... 4: My_Index : Integer := Get_Intege; -- Get integrer frome somewhere 5: ... 6: My_Array (My_Index) := True; Should yield something like: program.adb:6: (note) CONSTRAINT_ERRORE may be raise on array lower bound check > A switch that only reports places that the compiler inserts checks is quite > expensive in practice to build, as it has to be associated with expensive > check elimination code to be useful. That can be especially difficult if the > check elimination code happens well after the code that handles warnings (as > in Janus/Ada). It is just at note to the user of the compiler. Low optimisation mode gives more notes than high optimisation modes. > I've been playing with such a switch in Janus/Ada lately (in a *very* > limited set of checks), and it just tends to prove that one's compiler isn't > as good at eliminating checks as one previously thought. :-) There are lots > of cases of checks being left that are "obviously" not needed, and all of > those provide noise in using such a switch for quality improvement. Having > such an obvious look is bad if only because it encourages spending effort on > check elimination (because of visibility) over other possible places to > spend effort. (This switch will be available in the current version of > Janus/Ada as soon as I get it released -- which will have to wait until my > Ada Standard work is done -- but I'm not planning on publicizing it as it > has too many false positives to be useful to most at this time.) That this switch could lead to impoved compilers; I had not thougt of. > In the case of AdaCore, they have other tools for finding quality problems > in Ada code (like CodePeer), and they may very well want to put new effort > into those rather than into the compiler. You will reduce the need for other tools as the promary tool, GCC just reports as notes, what it is doing anyway. Jesper.