[Bug c/40172] [4.5 Regression] Revision 147596 breaks bootstrap

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue May 19 00:02:00 GMT 2009



------- Comment #21 from pinskia at gcc dot gnu dot org  2009-05-19 00:02 -------
(In reply to comment #16)
> Just to chime in, the warning is a useful warning, but the way rs6000 and mips
> define FRAME_GROWS_DOWNWARD, the test in toplev.c will never succeed.  

Yes and that is correct because we don't want that code to be involved at all. 
The whole if statement becomes false (which is a good thing we can detect it as
being always false).

> 
> I can see a couple of ways to fix this:
> 1) Revert the patch that moves this warning to -Wextra.  I think this is a bad
> idea, since the warning does seem to be useful.
> 
> 2) Disable the check in toplev.c.  Again, I think this is useful in general,
> but as an immediate palative, it can be useful.
>
> 3) Add a new macro to say not to do the test in #2, and define it in mips and
> rs6000.  This is doable, but in general it is not a good idea to add new global
> macros like this.

This is not a good option at all.  

a seperate option which I mentioned in an email rather than this bug report. 
So the current issue here is that we have:

if (!DEFINED && x != 0)

Where DEFINED is a macro which says (x != 0).
This gets expanded as:
if (!(x!=0) && x!=0)

Obviously to the trained eye this would be a good warning but guess what
DEFINED just happens to be based on x, it does not have to be.

It would be nice to say only warn for x1 && !x2 if (obviously x1 == x2) :
if either x1 or !x2 is from a macro but not both

Thanks,
Andrew Pinski


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40172



More information about the Gcc-bugs mailing list