https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95007

            Bug ID: 95007
           Summary: RFE: -fanalyzer should complain about writes to string
                    literals
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
  Target Milestone: ---

(Motivated by PR analyzer/95000, which has a false-positive path to a write to
a string literal)

Consider:

void test (void)
{
  char *s = "foo";
  s[0] = 'g';
}

-fanalyzer should complain about the write to s[0], but currently doesn't

See e.g.
https://wiki.sei.cmu.edu/confluence/display/c/STR30-C.+Do+not+attempt+to+modify+string+literals

Reply via email to