This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19967] [4.0 Regression] built-in folding causes excess diagnostics
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Feb 2005 01:37:11 -0000
- Subject: [Bug middle-end/19967] [4.0 Regression] built-in folding causes excess diagnostics
- References: <20050215012312.19967.jsm28@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joseph at codesourcery dot com 2005-02-15 01:37 -------
Subject: Re: [4.0 Regression] built-in folding causes
excess diagnostics
On Tue, 15 Feb 2005, pinskia at gcc dot gnu dot org wrote:
> Caused by:
> 2004-09-15 Jakub Jelinek <jakub@redhat.com>
>
> * expr.c (string_constant): Handle also read-only variables
> initialized to string literals.
I'm not sure how useful it is to treat that patch as the cause. I used
__func__ to keep the example within ISO C (apart from the cases of the
non-standard functions index and rindex). You can get the same effect
with "f" in place of __func__ and -Wwrite-strings (though the constant is
const char * with -Wwrite-strings, these standard functions remove
constness found in their argument in C). I suspect you'll find a
different causing patch for
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("f", 'f');
p = strrchr("f", 'f');
p = index("f", 'f');
p = rindex("f", 'f');
p = strpbrk("f", "f");
p = strstr("f", "f");
}
with -Wwrite-strings, although the underlying bug is the same.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19967