public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Delayed warning
@ 2019-04-29 14:24 Thomas Koenig
  2019-04-29 14:40 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Koenig @ 2019-04-29 14:24 UTC (permalink / raw)
  To: fortran, gcc mailing list

Hi!

Is there a way to mark a TREE statement (or a variable) so that
a warning is issued at a later stage if the statement has not been
removed in the meantime?

I am thinking, for example, of Fortran's -Warray-temporaries, which
issues a warning in the front end even though the whole temporary
array may be optimized away later.  We could, for example, mark
a call to malloc in such a way.

Regards

	Thomas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Delayed warning
  2019-04-29 14:24 Delayed warning Thomas Koenig
@ 2019-04-29 14:40 ` Jeff Law
  2019-04-29 16:15   ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2019-04-29 14:40 UTC (permalink / raw)
  To: Thomas Koenig, fortran, gcc mailing list

On 4/29/19 8:24 AM, Thomas Koenig wrote:
> Hi!
> 
> Is there a way to mark a TREE statement (or a variable) so that
> a warning is issued at a later stage if the statement has not been
> removed in the meantime?
> 
> I am thinking, for example, of Fortran's -Warray-temporaries, which
> issues a warning in the front end even though the whole temporary
> array may be optimized away later.  We could, for example, mark
> a call to malloc in such a way.
I'm not aware of one, but I recently suggested the concept of
__builtin_warning which would allow us to effectively delay a warning.

The goal was to have the warning explicitly in the IL so that if the
path to the warning was later determined infeasible the warning would
just get removed by the standard unreachable code elimination optimization.

This would allow us to avoid false positives due to the IL not being
well enough optimized at the point where we discover something is
potentially amiss.

Jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Delayed warning
  2019-04-29 14:40 ` Jeff Law
@ 2019-04-29 16:15   ` Marek Polacek
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2019-04-29 16:15 UTC (permalink / raw)
  To: Jeff Law; +Cc: Thomas Koenig, fortran, gcc mailing list

On Mon, Apr 29, 2019 at 08:39:57AM -0600, Jeff Law wrote:
> On 4/29/19 8:24 AM, Thomas Koenig wrote:
> > Hi!
> > 
> > Is there a way to mark a TREE statement (or a variable) so that
> > a warning is issued at a later stage if the statement has not been
> > removed in the meantime?
> > 
> > I am thinking, for example, of Fortran's -Warray-temporaries, which
> > issues a warning in the front end even though the whole temporary
> > array may be optimized away later.  We could, for example, mark
> > a call to malloc in such a way.
> I'm not aware of one, but I recently suggested the concept of
> __builtin_warning which would allow us to effectively delay a warning.
> 
> The goal was to have the warning explicitly in the IL so that if the
> path to the warning was later determined infeasible the warning would
> just get removed by the standard unreachable code elimination optimization.
> 
> This would allow us to avoid false positives due to the IL not being
> well enough optimized at the point where we discover something is
> potentially amiss.

FYI, I also raised the idea of delayed warnings in the C FE some time ago:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193#c3

Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-29 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 14:24 Delayed warning Thomas Koenig
2019-04-29 14:40 ` Jeff Law
2019-04-29 16:15   ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).