comp.lang.ada
 help / color / mirror / Atom feed
From: Jesper Quorning <jesper.quorning@gmail.com>
Subject: Re: GNAT proposal: note on implicit exceptions insertion
Date: Mon, 11 Feb 2019 23:05:35 -0800 (PST)
Date: 2019-02-11T23:05:35-08:00	[thread overview]
Message-ID: <989ea6c7-b432-4214-beec-c0a50b76932c@googlegroups.com> (raw)
In-Reply-To: <q3t181$9rh$1@franka.jacob-sparre.dk>

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.


  reply	other threads:[~2019-02-12  7:05 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
2019-02-12  7:05       ` Jesper Quorning [this message]
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