Bug 514748
| Summary: | Spurious 'array subscript is above array bounds' warning. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | David Woodhouse <dwmw2> | ||||
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
| Status: | CLOSED UPSTREAM | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | medium | Docs Contact: | |||||
| Priority: | low | ||||||
| Version: | 11 | CC: | chemobejk, jakub | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | powerpc | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2009-08-03 08:32:35 UTC | Type: | --- | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
David Woodhouse
2009-07-30 15:57:07 UTC
Sorry, that should be bug #512170 David: You forgot to add the pre-processed file... Created attachment 355708 [details]
test case
FYI: looks like this is not a ppc architecture bug. arm-unknown-linux-gnueabi on Ubuntu reports the same error: <https://launchpad.net/ubuntu/+source/pidgin-sipe/1.5.0-0ubuntu1> <http://launchpadlibrarian.net/29699481/buildlog_ubuntu-karmic-armel.pidgin-sipe_1.5.0-0ubuntu1_FAILEDTOBUILD.txt.gz> cc1: warnings being treated as errors sip-sec-ntlm.c: In function 'sip_sec_init_sec_context__ntlm': sip-sec-ntlm.c:507: error: array subscript is above array bounds make[2]: *** [libsipe_la-sip-sec-ntlm.lo] Error 1 Simplified testcase:
struct A
{
unsigned char a1[8];
unsigned short a2, a3, a4, a5, a6, a7;
};
int bar (void *, const char *, int);
char *foo (void *, int);
char *
baz (const char *x, const char *y)
{
int a = sizeof (struct A) + 2 * (__builtin_strlen (y)
+ __builtin_strlen (x) + 24) + 16;
struct A *b = __builtin_malloc (a);
char *c;
int d;
b->a4 = sizeof (struct A);
c = ((char *) b) + b->a4;
d = ((char *) b) + a - c;
b->a2 = b->a3 = (unsigned short) bar (c, y, d);
c += b->a2;
d = ((char *) b) + a - c;
b->a7 = b->a4 + b->a2;
b->a5 = b->a6 = (unsigned short) bar (c, x, d);
c = foo (b, a);
return c;
}
Tracking upstream. As a workaround, either use one of the above mentioned workarounds, or make sure the first field in the struct isn't a char array. If you drop the 'unsigned' and use just 'char a1[8]' in your test case, in the definition of 'struct A', then it'll occur on architectures where 'char' is signed by default too. |