https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899
--- Comment #21 from rguenther at suse dot de <rguenther at suse dot de> --- On Sat, 12 May 2018, glisse at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82899 > > --- Comment #20 from Marc Glisse <glisse at gcc dot gnu.org> --- > Created attachment 44122 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44122&action=edit > untested middle-end patch > > This works on the testcase, I need to add a comment and run it through the > testsuite. Looks good. Note that in the strict C semantic thing __restrict on this isn't valid as the following is valid C++: Foo() __restrict { Foo *x = this; x->a = 1; this->a = 2; ... } but for C restrict you'd have two pointers with same provenance here. The middle-end handles this situation conservatively and thus the middle-end approach of effectively handling it as restrict is fine.