This is the mail archive of the gcc-bugs@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]

[Bug c++/27336] "this" pointer is not assumed to be not null



------- Comment #2 from guillaume dot melquiond at ens-lyon dot fr  2006-04-28 09:03 -------
I tried setting the nonnull attribute, it indeed allowed the optimization. In
particular, codes containing dynamic casts are now straight lines. This is a
nice improvement. Unfortunately GCC was not able to go further and use this
information in the caller in order to optimize it:

struct A { bool g() __attribute__((nonnull)); }
bool f(A *a) {
  a->g();
  return a;
}

Am I expecting too much from the nonnull attribute? (The documentation does not
seem to cover this point.) Or would it be reasonnable for the middle-end to
implement such an optimization?


-- 


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


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