https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86093
Bug ID: 86093 Summary: volatile ignored on pointer in C Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Target Milestone: --- extern char*volatile i; int f(){return i-i;} gets simplified in C as 1 load and return 0. In C++ or if i has a non-pointer type (say int), we do have 2 loads and a subtraction.