This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/48269] New: Incorrect fortify warning for a packed struct member
- From: "ismail at namtrac dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2011 09:54:08 -0000
- Subject: [Bug middle-end/48269] New: Incorrect fortify warning for a packed struct member
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48269
Summary: Incorrect fortify warning for a packed struct member
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ismail@namtrac.org
[~]> g++-4.6 -m32 -O2 -fstack-protector -c kis_droneframe.ii
In file included from packet.h:37:0,
from kis_droneframe.cc:28:
packet_ieee80211.h:248:40: warning: âpackedâ attribute ignored [-Wattributes]
packet_ieee80211.h:253:43: warning: âpackedâ attribute ignored [-Wattributes]
packet_ieee80211.h:273:43: warning: âpackedâ attribute ignored [-Wattributes]
In file included from /usr/include/stdio.h:912:0,
from util.h:24,
from kis_droneframe.cc:25:
In function âint snprintf(char*, size_t, const char*, ...)â,
inlined from âvirtual int KisDroneFramework::SendSource(int,
pst_packetsource*, int)â at kis_droneframe.cc:507:49:
/usr/include/bits/stdio2.h:66:75: warning: call to int
__builtin___snprintf_chk(char*, unsigned int, int, unsigned int, const char*,
...) will always overflow destination buffer [enabled by default]
Now the said line is;
snprintf((char *) spkt->type_str, 16, "%s",
in_int->strong_source->FetchType().c_str());
where spkt is defined as;
struct drone_source_packet {
uint16_t source_hdr_len;
uint32_t source_content_bitmap;
drone_trans_uuid uuid;
// Kill this source, the rest of the data is empty
uint16_t invalidate;
// Null-terminated strings
uint8_t name_str[16];
uint8_t interface_str[16];
uint8_t type_str[16];
uint8_t channel_hop;
uint16_t channel_dwell;
uint16_t channel_rate;
} __attribute__((__packed__));
Using gcc version 4.6.0 20110314 [gcc-4_6-branch revision 170941] (SUSE Linux)