re PR middle-end/48269 (Incorrect fortify warning for a packed struct member)
2011-03-24 Richard Guenther <rguenther@suse.de> PR middle-end/48269 * tree-object-size.c (addr_object_size): Do not double-account for MEM_REF offsets. * gcc.dg/builtin-object-size-10.c: New testcase. From-SVN: r171388
This commit is contained in:
parent
a183b5c7af
commit
190b2187b6
4 changed files with 37 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-03-24 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/48269
|
||||
* tree-object-size.c (addr_object_size): Do not double-account
|
||||
for MEM_REF offsets.
|
||||
|
||||
2011-03-24 Diego Novillo <dnovillo@google.com>
|
||||
|
||||
* lto-opts.c (input_data_block): Move to lto-streamer-in.c.
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-03-24 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/48269
|
||||
* gcc.dg/builtin-object-size-10.c: New testcase.
|
||||
|
||||
2011-03-24 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/46562
|
||||
|
|
26
gcc/testsuite/gcc.dg/builtin-object-size-10.c
Normal file
26
gcc/testsuite/gcc.dg/builtin-object-size-10.c
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-objsz-details" } */
|
||||
|
||||
typedef struct {
|
||||
char sentinel[4];
|
||||
char data[0];
|
||||
} drone_packet;
|
||||
typedef struct {
|
||||
char type_str[16];
|
||||
char channel_hop;
|
||||
} drone_source_packet;
|
||||
drone_packet *
|
||||
foo(char *x)
|
||||
{
|
||||
drone_packet *dpkt = __builtin_malloc(sizeof(drone_packet)
|
||||
+ sizeof(drone_source_packet));
|
||||
drone_source_packet *spkt = (drone_source_packet *) dpkt->data;
|
||||
__builtin___snprintf_chk (spkt->type_str, 16,
|
||||
1, __builtin_object_size (spkt->type_str, 1),
|
||||
"%s", x);
|
||||
return dpkt;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "maximum object size 21" "objsz" } } */
|
||||
/* { dg-final { scan-tree-dump "maximum subobject size 16" "objsz" } } */
|
||||
/* { dg-final { cleanup-tree-dump "objsz" } } */
|
|
@ -348,8 +348,6 @@ addr_object_size (struct object_size_info *osi, const_tree ptr,
|
|||
tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0), pt_var);
|
||||
if (bytes2 != error_mark_node)
|
||||
{
|
||||
bytes2 = size_binop (PLUS_EXPR, bytes2,
|
||||
TREE_OPERAND (pt_var, 1));
|
||||
if (TREE_CODE (bytes2) == INTEGER_CST
|
||||
&& tree_int_cst_lt (pt_var_size, bytes2))
|
||||
bytes2 = size_zero_node;
|
||||
|
|
Loading…
Add table
Reference in a new issue