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: C++ PATCH: PR 25895, 25856, 25858


Andrew Pinski <pinskia@physics.uc.edu> writes:

| > 
| > 
| > | > Andrew Pinski wrote:
| > | >
| > | > > Actually the optimization is invalid as
| > | > >
| > | > > struct a
| > | > > {
| > | > >   int t;
| > | > > };
| > | > >
| > | > > bool f(void)
| > | > > {
| > | > >   a *b = 0;
| > | > >   return &b->t == 0;
| > | > > }
| > | > >
| > | > > that should return 1 as it is a null pointer.
| > 
| > If the middle-end optimizer is coherent, I don't quite understand why
| > it *should* return 1.  The bug Mark fixed came from the fact that the
| > middle-end still thinks dereferencing implies b not being null.  Given
| > that a::t resides at same address as the containing object, if b
| > is supposed nonnull, it follows that &b->t cannot be null.
| > And I'm sure you know your example is invalid.
| 
| If you consider c-common.c middle-end.

s/middle-end/c-common.c/g if that helps.

I still no do not understand the reasoning that led you to your
statement. 

-- Gaby


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