From: reinert <reinkor@gmail.com>
Subject: Re: Strange warning message
Date: Mon, 27 Nov 2017 02:47:12 -0800 (PST)
Date: 2017-11-27T02:47:12-08:00 [thread overview]
Message-ID: <19ca49f7-fa8c-49d9-a4b8-8a77546ef3b5@googlegroups.com> (raw)
In-Reply-To: <ovgq61$cu4$1@dont-email.me>
On Monday, November 27, 2017 at 11:42:11 AM UTC+1, Jeffrey R. Carter wrote:
> On 11/27/2017 09:40 AM, reinert wrote:
> >
> > when I compile the enclosed program with option "-gnatwa" (i.e. "gnatmake -gnatwa test1k.adb", I get the following annoying warning:
> >
> > "warning: useless assignment to "test1", value never referenced"
>
> In order to produce warnings like this, the compiler has to do some data-flow
> analysis. The amount of data-flow analysis required by the ARM is zero. So GNAT
> is making an extra effort to be helpful. That the warning is annoying in this
> case is the price you pay for it being correct in most others.
>
> Clearly GNAT's data-flow analysis is incomplete, or it would also flag the
> assignment in the loop. Complete data-flow analysis is possible (SPARK does it).
> but apparently it's hard, and possibly not really compatible with a compiler's
> main purpose, but even if GNAT did have complete data-flow analysis, you'd still
> get the warning.
>
> I found that even if I change the loop to
>
> for I in Test1'range loop
> Test1 (I) := new Test1_T;
> end loop;
>
> GNAT (7.2) still doesn't flag the assignment in the loop, so it's not just that
> GNAT's analysis hasn't caught up with the new "for E of" construct.
>
> --
> Jeff Carter
> "We burst our pimples at you."
> Monty Python & the Holy Grail
> 16
This clarifies, reinert
next prev parent reply other threads:[~2017-11-27 10:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-27 8:40 Strange warning message reinert
2017-11-27 9:00 ` Jacob Sparre Andersen
2017-11-27 9:13 ` reinert
2017-11-27 9:45 ` Jacob Sparre Andersen
2017-11-27 10:43 ` reinert
2017-11-27 9:01 ` gautier_niouzes
2017-11-27 9:09 ` gautier_niouzes
2017-11-27 9:27 ` reinert
2017-11-27 10:42 ` Jeffrey R. Carter
2017-11-27 10:47 ` reinert [this message]
2017-11-27 11:52 ` reinert
2017-11-29 0:43 ` Robert Eachus
2017-11-29 10:39 ` reinert
2017-11-29 20:47 ` Randy Brukardt
2017-11-30 14:11 ` reinert
2017-12-01 22:53 ` Robert Eachus
2017-12-02 8:47 ` Simon Wright
2017-12-02 9:47 ` Niklas Holsti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox