gcc should warn when a function that is declared with __attribute__((pure)) or __attribute__((const)) is defined in a way that appears to break those guarantees.
i.e. an __attribute__((const)) function should not be allowed to dereference pointers or call non-__attribute__((const)) functions (except perhaps __attribute__((pure)) functions with pointer arguments only allowed to be references to local variables?); __attribute__((pure)) similarly. -- Summary: Warn on incorrect __attribute__((pure)), __attribute__((const)) Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ed at catmur dot co dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33048