[Bug middle-end/19967] [4.0 Regression] built-in folding causes excess diagnostics
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 15 15:50:00 GMT 2005
------- 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
More information about the Gcc-bugs
mailing list