[RFC] propagate malloc attribute in ipa-pure-const pass

Jan Hubicka hubicka@ucw.cz
Fri May 19 13:18:00 GMT 2017


> >   struct D: B {
> >     char buf[32];
> >     virtual void* f (unsigned n) {
> >       if (n < 32)
> >       return n <= 32 ? buf : B::f (n);
> >     }
> > 
> > Breaking foo's attribute malloc constraint.
> > 
> > In other words, I think virtual functions need to be excluded
> > from the list (unless they're defined in a class marked final,
> > or unless we know they're not overridden to break the constraint
> > like above).
> 
> But we are annotating the actual decl, not the type in the class
> struct.

Yep and we will be able to use the information in case we devirtualize
the call.  So this seems OK to me.

Honza
> 
> Richard.



More information about the Gcc-patches mailing list