On Mon, 1 Apr 2019, Patrick Palka wrote: > > > > A possibly related project is to "defer" output of diagnostics > > > > until we know the stmt/expression we emit it for survived dead > > > > code elimination. Here there's the question what to key the > > > > diagnostic off and how to move it (that is, detect if the code > > > > causing it really fully went dead). > > Interesting. Which diagnostics would you have in mind to defer in this way?
For example, where the C front end does folding early for diagnostics such as -Wsign-compare, and then makes its own limited attempt to see if e.g. an expression of signed type must have nonnegative value. It would be appropriate for the diagnostic to be done later (so more powerful optimizations can be used to tell if the value in fact is in a range meaning the diagnostic is not needed, or if it's in dead code), and that would reduce the number of places the C front end needs to call c_fully_fold (with a following call to c_wrap_maybe_const to avoid repeated recursive folding of the same trees). -- Joseph S. Myers jos...@codesourcery.com