https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65502
Bug ID: 65502 Summary: pure-const should play well with clobbers. Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: hubicka at gcc dot gnu.org I just noticed that C++ destructors are not conisdered const/pure: local analysis of Smarts::IterateScheduler<Smarts::Stub>::~IterateScheduler() scanning: MEM[(struct &)this_2(D)] ={v} {CLOBBER}; Indirect ref write is not const/pure scanning: return; Smarts::IterateScheduler<Smarts::Stub>::~IterateScheduler() (struct IterateScheduler * const this) { <bb 2>: MEM[(struct &)this_2(D)] ={v} {CLOBBER}; return; } This is of course wrong, empty function is const. One issue however is that we want to preserve CLOBBER when inlining, so during early passes we may want to keep clobbers nonpure.