public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19967] New: built-in folding causes excess diagnostics
@ 2005-02-15 13:29 jsm28 at gcc dot gnu dot org
  2005-02-15 14:14 ` [Bug middle-end/19967] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-02-15 13:29 UTC (permalink / raw)
  To: gcc-bugs

The folding of built-in functions does not always yield results with
the correct return type, causing excess warnings (errors with -pedantic-errors).

char *strchr(const char *, int);
char *strrchr(const char *, int);
char *index(const char *, int);
char *rindex(const char *, int);
char *strpbrk(const char *, const char *);
char *strstr(const char *, const char *);
char *p;
void
f (void)
{
  p = strchr(__func__, 'f');
  p = strrchr(__func__, 'f');
  p = index(__func__, 'f');
  p = rindex(__func__, 'f');
  p = strpbrk(__func__, "f");
  p = strstr(__func__, "f");
}

should compile with no diagnostics, but instead each assignment
has "assignment discards qualifiers from pointer target type"
because optimizing the built-in function has wrongly changed the
return type to "const char *" instead of "char *".  This is a regression
in 4.0.

-- 
           Summary: built-in folding causes excess diagnostics
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, diagnostic
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19967


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-02-16 15:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-15 13:29 [Bug tree-optimization/19967] New: built-in folding causes excess diagnostics jsm28 at gcc dot gnu dot org
2005-02-15 14:14 ` [Bug middle-end/19967] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-02-15 15:46 ` pinskia at gcc dot gnu dot org
2005-02-15 15:50 ` joseph at codesourcery dot com
2005-02-15 15:54 ` pinskia at gcc dot gnu dot org
2005-02-15 17:24 ` kazu at cs dot umass dot edu
2005-02-16  7:01 ` [Bug tree-optimization/19967] " pinskia at gcc dot gnu dot org
2005-02-16 19:32 ` cvs-commit at gcc dot gnu dot org
2005-02-16 19:35 ` kazu at cs dot umass dot edu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).