This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: New implementation of -Wstrict-aliasing


Silvius Rus <rus@google.com> writes:

| Gabriel Dos Reis wrote:
| > | Let me know what you think of this:
| > | Keep the current check in the front-end, but give it two flavors:
| > | 1. Only warn when the converted pointer is dereferenced immediately:
| > | *(int*)&float_var.
| > | 2. The original, which warns even if it is not dereferenced:
| > | (int*)&float_var.
| > | One of the two versions would be selected based on the value of
| > | --param wstrict-aliasing-accuracy.  I would go for version 1 included
| > | by default, because 2 gives false positives.
| >
| > The aliasing warning is less of the compiler internals tinkering than
| > general statements about user codes, so the use of --param is
| > inappropriate.  If necessary, please consider extending
| > -Wstrict-aliasing to take an argument, e.g.
| >
| >    -Wstrict-aliasing=level
| >
| Can you please advise on the following choice of warning levels.
| Please let me know which of the following levels you would like to see
| in 4.3, in which order.  In all cases, the warnings are conditioned by
| -fstrict-aliasing.
| Thank you,
| Silvius

Hi Silvius,

  Thanks for taking time for expanding on this.

All of the levels seem good to me.  However I would appreciate an
explanation about the choice of the levels.

First I thought that the accuracy of the diagnostics improves as
the level increases, meaning less false positives and less false 
negatives.  However, I'm under the impression that under your
proposal, the accuracy decreases as the level increases.  Is that
reading correct?

My general thinking was that, the compile-time consumed by warning 
about non-conforming aliasing will increase with the level.  So, for
example level=1 will be quick but not very precise, and level=4 might
be slow but more accurate.  Just like with optimization levels.
What motivates your choice in the other direction?

Thanks,

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]