This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, C] Fix format warnings


> Joseph S. Myers wrote:
>>On Tue, 26 Apr 2005, Richard Guenther wrote:
>> As soon as &a is canonicalized to &a[0] currently existing testcases
>> fail and get fixed by this patch.  Without a patch it is not possible
>> to construct a testcase with &a[0] or &a[1] as this is emitted by
>> the C frontend as &a and &a + 1 (which is handled explicitly in
>> c-format.c).
>
> It is possible to construct tests with &a[0] or &a[1] - they just wouldn't
> exercise the new code paths.  Because &a[0] and &a[1] being handled is a
> feature which is untested, my point is that it would also be useful to add
> such tests to make sure that the subsequent changes in this area don't
> break that feature.

Might there also be a way to properly construct a test (or a proper location
to insert an "assert" into the source code), to verify that all references
to string literals are also properly identified a "static const char []"?

(If so I'd be pleased to submit a patch to implement it, but can't
 figure out how to properly construct it other than by possibly scattering
 asserts throughout the code in expr.c to enable it's early detection?)

As presently the code handling STRING_CST copy/moves in expr.c seems to be
loosing the MEM_READONLY_P properly which should be retained and visible to
the back-end when copying string literals to initialize variable character
arrays, which is a problem for targets which may choose to allocate literal
data in ROM which may correspondingly require use of particular load
instruction to access.

(I.e. char x[] = {'a','b','c',0} properly MEM_READONLY_P == true
mem reference to {'a','b','c',0}; while char x[] = "abc" results
in MEM_READONLY_P == false for mem reference to "abc"?)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]