https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83503
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> --- There is a valid use case, you have some public interface which you only want to guarantee to be pure, the result depends on the arguments and e.g. on some OSes or in some specific cases needs read-only access to global variables. So you add __attribute__((pure)) to the public header for the function, that is what you guarantee to outside users. Then, for a specific configuration/OS/specific case you actually don't need the access to global variables, so e.g. within the library or just with the TU with the definition or something similar you make the guarantee stronger and use __attribute__((const)). Uses that see just the pure attribute optimize based on that attribute, uses that see the const attribute or both optimize further.