https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122197

--- Comment #8 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Right, I understand the conflict between code optimizations vs. late
(middle-end) diagnostics, that this may introduce false-positive diagnostics.

Given that we (obviously) control the diagnostics of a specific version of GCC,
I consider it good practice to run bootstrap as well as generally target
library builds with '-Werror', so that we early and easily catch any spurious
diagnostics -- which here triggers: PR122498 for the bootstrap case, PR122334
for the target library case.  How do we solve this dichotomy?

Manually twisting the "faulty" original code until it's (for the moment)
warning-free again, doesn't appear to be the right solution.  (..., at least if
that translates into modifying the code so that it doesn't the "problematic"
compiler optimization applied anymore.)

Removing optimizations from '-O2' just to restore the GCC default bootstrap
also seems questionable.  (Even though it would "resolve" the underlying issue
here.)

Removing all late diagnostics (from '-Wall') seems a bit radical?

Tag GIMPLE IR to mute later diagnostics, when doing transformations that might
cause false-positive diagnostics?  Not sure whether that's generally feasible
and/or would effectively turn into the former "removing" idea?

Make such "maybe" diagnostics exempt from '-Werror'?  Defeats the purpose of
'-Werror', but at least we wouldn't mute them completely?

Improve the quality of the late diagnostics ("algorithmically")?  Sure, but
again, not sure to which extent that's feasible?

Any other clever ideas?

Reply via email to