diff options
author | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-16 19:40:47 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@redhat.com> | 2014-12-16 19:40:47 +0530 |
commit | 0cd8552045aeb0537b4f1ab5d1b30ada8ae50076 (patch) | |
tree | c466784133086fcb0337f10e95a56cba41d86eec /resolv | |
parent | a0d424ef9d7fc34f7d1a516f38c8efb1e8692a03 (diff) | |
download | glibc-0cd8552045aeb0537b4f1ab5d1b30ada8ae50076.tar.gz |
Fix the 'array subscript is above array bounds' warning correctly
Use DIAG_IGNORE_NEEDS_COMMENT instead since the compiler should have
seen that NS never goes beyond MAXNS.
Diffstat (limited to 'resolv')
-rw-r--r-- | resolv/res_send.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c index 5a9882c6ad..c35fb66bda 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -429,9 +429,15 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen, while (ns < MAXNS && EXT(statp).nsmap[ns] != MAXNS) ns++; - if (ns >= MAXNS) + if (ns == MAXNS) break; + /* NS never exceeds MAXNS, but gcc 4.9 somehow + does not see this. */ + DIAG_PUSH_NEEDS_COMMENT; + DIAG_IGNORE_NEEDS_COMMENT (4.9, + "-Warray-bounds"); EXT(statp).nsmap[ns] = n; + DIAG_POP_NEEDS_COMMENT; map[n] = ns++; } EXT(statp).nscount = n; |