This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, C] Fix format warnings
- From: Paul Schlie <schlie at comcast dot net>
- To: Richard Guenther <rguenth at tat dot physik dot uni-tuebingen dot de>,<gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 Apr 2005 11:09:18 -0400
- Subject: Re: [PATCH, C] Fix format warnings
> Richard Guenther writes:
> This patch makes the C frontend not warn that a format string
> is not literal for things like
>
> char *a = "Foo";
> printf(&a[0]);
>
> This will trigger everywhere in the format testsuite if the
> C frontend starts emitting array-to-pointer decay as &a[0].
>
> Compiled and tested on i686-unknown-linux for C.
>
> Ok for mainline?
??? But of course it should, as it's referencing a literal character value.
which can't be portably modified as it's a static const READONLY object.
In general the problem seems to be that GCC is not properly
identifying, allocating and treating "string literals" as
a "static const char[]", as it likely should.
Why is/should it presumed otherwise?