This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/64720] New: Provide strict check for pure attribute


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]