[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Re: Delayed warning
From:       Marek Polacek <polacek () redhat ! com>
Date:       2019-04-29 16:15:51
Message-ID: 20190429161551.GV4324 () redhat ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic