[Bug tree-optimization/18487] Warnings for pure and const functions that are not actually pure or const

dberlin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Sep 4 12:55:42 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18487

--- Comment #25 from Daniel Berlin <dberlin at gcc dot gnu.org> ---
This seems like a bad idea, and is impossible in general.

The whole point of the attributes is to tell the compiler things are pure/const
in cases it can't already prove.

It can already prove a lot, and doesn't need help in most of the simple
examples being given (in other bugs). 

You are basically going to warn in the cases the compiler can't prove it (IE
sees something it thinks makes the function not pure/const), and those are
*exactly* the cases the attribute exists for - where the compiler doesn't know,
but you do.


More information about the Gcc-bugs mailing list