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 tree-optimization/18487] New: Warnings for pure and const functions that are not actually pure or const


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


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