"Jesper Quorning" 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 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.