http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56218
--- Comment #3 from janus at gcc dot gnu.org 2013-02-06 10:16:29 UTC ---
(In reply to comment #2)
> If I'm not missing anything, I think we should pass 'f' directly instead of
> '&f':
>
> do_stuff (struct foo_t * & restrict f)
> {
> if (f->a.data != 0B)
> {
> __builtin_free ((void *) f->a.data);
> }
> f->a.data = 0B;
> }
Or rather the generated code should read like this:
if ((*f)->a.data != 0B)
{
__builtin_free ((void *) (*f)->a.data);
}
(*f)->a.data = 0B;
Once we do this correctly, it should segfault as in the CLASS version, and we
also need to add a check for (*f) != OB