From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: GNAT proposal: note on implicit exceptions insertion
Date: Mon, 11 Feb 2019 17:41:53 -0600
Date: 2019-02-11T17:41:53-06:00 [thread overview]
Message-ID: <q3t181$9rh$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 17375128-e016-4366-91ff-cd68f74689b3@googlegroups.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2576 bytes --]
"Jesper Quorning" <jesper.quorning@gmail.com> wrote in message
news:17375128-e016-4366-91ff-cd68f74689b3@googlegroups.com...
>søndag den 10. februar 2019 kl. 19.08.05 UTC+1 skrev Simon Wright:
>> Jesper Quorning <jesper.quorning@gmail.com> writes:
>>
>> Don't you already get a warning if a CE is going to be raised at
>> runtime?
>
>I would like a note from GCC when a there is an implicit (hidden) exception
>rise
>like array bunds checking. It would be a simple way of inspecting your
>quality of
>code. For instance if there is array bunds checks in a loop I may like to
>rewrite/design a part of the program.
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).
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).
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).
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.)
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.
Randy.
next prev parent reply other threads:[~2019-02-11 23:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-10 2:03 GNAT proposal: note on implicit exceptions insertion Jesper Quorning
2019-02-10 18:08 ` Simon Wright
2019-02-11 21:36 ` Jesper Quorning
2019-02-11 22:31 ` Anh Vo
2019-02-11 23:41 ` Randy Brukardt [this message]
2019-02-12 7:05 ` Jesper Quorning
2019-02-12 23:08 ` Randy Brukardt
2019-02-16 4:30 ` Brad Moore
2019-02-16 16:15 ` Jesper Quorning
2019-02-12 8:19 ` Dmitry A. Kazakov
2019-02-12 8:35 ` Jesper Quorning
2019-02-12 9:20 ` Dmitry A. Kazakov
2019-02-12 12:46 ` Jesper Quorning
2019-02-12 7:28 ` Mark Lorenzen
2019-02-12 8:34 ` Jesper Quorning
2019-02-12 22:31 ` Fedja Beader
2019-02-13 10:42 ` Simon Wright
2019-02-11 6:53 ` Mark Lorenzen
2019-02-11 8:13 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox