This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47418] warning: array subscript is above array bounds at O2 with sin6_addr
- From: "dpmcgee at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 23 Jan 2011 00:15:34 +0000
- Subject: [Bug c/47418] warning: array subscript is above array bounds at O2 with sin6_addr
- Auto-submitted: auto-generated
- References: <bug-47418-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47418
--- Comment #1 from Dan McGee <dpmcgee at gmail dot com> 2011-01-23 00:15:29 UTC ---
Also of note is the commented bit in the test case- if you instead dereference
the s6_addr bit of the union, it all works without warnings.
In the preprocessed source, replace
ap = (char *)&u.sin6.sin6_addr;
with:
ap = (char *)&u.sin6.sin6_addr.__in6_u.__u6_addr8;