re PR tree-optimization/39343 (Wrong result for __builtin_object_size (x, 1))
PR tree-optimization/39343 * tree-ssa-ccp.c (maybe_fold_offset_to_address): Don't check if COMPONENT_REF t has ARRAY_TYPE. * gcc.dg/pr39343.c: New test. From-SVN: r144571
This commit is contained in:
parent
fc0ffad7cb
commit
f07049c8f1
4 changed files with 41 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2009-03-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/39343
|
||||
* tree-ssa-ccp.c (maybe_fold_offset_to_address): Don't check if
|
||||
COMPONENT_REF t has ARRAY_TYPE.
|
||||
|
||||
2009-03-02 Sebastian Pop <sebastian.pop@amd.com>
|
||||
|
||||
PR middle-end/39335
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2009-03-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/39343
|
||||
* gcc.dg/pr39343.c: New test.
|
||||
|
||||
2009-03-03 Ira Rosen <irar@il.ibm.com>
|
||||
|
||||
PR tree-optimization/39248
|
||||
|
|
29
gcc/testsuite/gcc.dg/pr39343.c
Normal file
29
gcc/testsuite/gcc.dg/pr39343.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* PR tree-optimization/39343 */
|
||||
/* { dg-do run } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
extern inline __attribute__ ((__always_inline__)) int
|
||||
foo (char *dest)
|
||||
{
|
||||
return __builtin_object_size (dest, 1);
|
||||
}
|
||||
|
||||
struct S
|
||||
{
|
||||
union
|
||||
{
|
||||
struct { int a, b; char c, d; } f;
|
||||
struct { struct { int a, b; char c, d[255]; } e; } g;
|
||||
} u;
|
||||
};
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
struct S s;
|
||||
if (foo (s.u.g.e.d) != 255)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
|
@ -1942,8 +1942,7 @@ maybe_fold_offset_to_address (tree addr, tree offset, tree orig_type)
|
|||
|| (TREE_CODE (orig) == COMPONENT_REF
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (orig, 1))) == ARRAY_TYPE))
|
||||
&& (TREE_CODE (t) == ARRAY_REF
|
||||
|| (TREE_CODE (t) == COMPONENT_REF
|
||||
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 1))) == ARRAY_TYPE))
|
||||
|| TREE_CODE (t) == COMPONENT_REF)
|
||||
&& !operand_equal_p (TREE_CODE (orig) == ARRAY_REF
|
||||
? TREE_OPERAND (orig, 0) : orig,
|
||||
TREE_CODE (t) == ARRAY_REF
|
||||
|
|
Loading…
Add table
Reference in a new issue