re PR middle-end/69643 (Address space discarded)
PR c/69643 * tree.c (tree_nop_conversion_p): Do not strip casts into or out of non-standard address spaces. testsuite/ * gcc.target/i386/addr-space-4.c: New. * gcc.target/i386/addr-space-5.c: New. From-SVN: r233189
This commit is contained in:
parent
711d7c231f
commit
be2083eab7
5 changed files with 61 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2016-02-06 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR c/69643
|
||||
* tree.c (tree_nop_conversion_p): Do not strip casts into or
|
||||
out of non-standard address spaces.
|
||||
|
||||
2016-02-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR rtl-optimization/69691
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2016-02-06 Richard HEnderson <rth@redhat.com>
|
||||
|
||||
PR c/69643
|
||||
* gcc.target/i386/addr-space-4.c: New.
|
||||
* gcc.target/i386/addr-space-5.c: New.
|
||||
|
||||
2016-02-05 Mikael Morin <mikael@gcc.gnu.org>
|
||||
|
||||
PR fortran/66089
|
||||
|
|
16
gcc/testsuite/gcc.target/i386/addr-space-4.c
Normal file
16
gcc/testsuite/gcc.target/i386/addr-space-4.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O" } */
|
||||
/* { dg-final { scan-assembler "gs:" } } */
|
||||
|
||||
#define uintptr_t __SIZE_TYPE__
|
||||
|
||||
struct S { int a, b, c; };
|
||||
|
||||
extern struct S __seg_gs s;
|
||||
|
||||
int foo (void)
|
||||
{
|
||||
int r;
|
||||
r = s.c;
|
||||
return r;
|
||||
}
|
16
gcc/testsuite/gcc.target/i386/addr-space-5.c
Normal file
16
gcc/testsuite/gcc.target/i386/addr-space-5.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O" } */
|
||||
/* { dg-final { scan-assembler "gs:" } } */
|
||||
|
||||
#define uintptr_t __SIZE_TYPE__
|
||||
|
||||
struct S { int a, b, c; };
|
||||
|
||||
extern struct S s;
|
||||
|
||||
int ct_state3 (void)
|
||||
{
|
||||
int r;
|
||||
r = *((int __seg_gs *) (uintptr_t) &s.c);
|
||||
return r;
|
||||
}
|
17
gcc/tree.c
17
gcc/tree.c
|
@ -12219,6 +12219,23 @@ block_ultimate_origin (const_tree block)
|
|||
bool
|
||||
tree_nop_conversion_p (const_tree outer_type, const_tree inner_type)
|
||||
{
|
||||
/* Do not strip casts into or out of differing address spaces. */
|
||||
if (POINTER_TYPE_P (outer_type)
|
||||
&& TYPE_ADDR_SPACE (TREE_TYPE (outer_type)) != ADDR_SPACE_GENERIC)
|
||||
{
|
||||
if (!POINTER_TYPE_P (inner_type)
|
||||
|| (TYPE_ADDR_SPACE (TREE_TYPE (outer_type))
|
||||
!= TYPE_ADDR_SPACE (TREE_TYPE (inner_type))))
|
||||
return false;
|
||||
}
|
||||
else if (POINTER_TYPE_P (inner_type)
|
||||
&& TYPE_ADDR_SPACE (TREE_TYPE (inner_type)) != ADDR_SPACE_GENERIC)
|
||||
{
|
||||
/* We already know that outer_type is not a pointer with
|
||||
a non-generic address space. */
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Use precision rather then machine mode when we can, which gives
|
||||
the correct answer even for submode (bit-field) types. */
|
||||
if ((INTEGRAL_TYPE_P (outer_type)
|
||||
|
|
Loading…
Add table
Reference in a new issue