This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/64720] New: Provide strict check for pure attribute
- From: "fizzbooze at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 21 Jan 2015 22:01:31 +0000
- Subject: [Bug middle-end/64720] New: Provide strict check for pure attribute
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64720
Bug ID: 64720
Summary: Provide strict check for pure attribute
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: fizzbooze at gmail dot com
Currently an impure function can be attributed as 'pure' and still compile
correctly with no warnings or errors. i.e.:
// BEGIN CODE
int global = 0;
__attribute__((pure))
void foo() {
global += 1; // this obviously violates the pure attribute
}
int main() {
foo();
}
// END CODE
It would be nice to be able to enable some sort of warning or error for code
like this.