This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18487] New: Warnings for pure and const functions that are not actually pure or const
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Nov 2004 21:37:24 -0000
- Subject: [Bug tree-optimization/18487] New: Warnings for pure and const functions that are not actually pure or const
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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