It would be nice if GCC can issue warnings for pure or const functions
that are not actually pure or const.
int foo (int) __attribute__ ((pure));
int bar (int) __attribute__ ((const));
int g;
int
foo (int a)
{
g = a; /* A pure function is not supposed to write to memory. */
return 0;
}
int
bar (int a)
{
return g; /* A const function is not supposed to read memory. */
}
--
Summary: Warnings for pure and const functions that are not
actually pure or const
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kazu at cs dot umass dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18487