Commit c9549072 by Eric Botcazou Committed by Eric Botcazou

gimple.c (gimple_types_compatible_p): Return 0 for aggregate and pointer types…

gimple.c (gimple_types_compatible_p): Return 0 for aggregate and pointer types if they have different alignment or mode.

	* gimple.c (gimple_types_compatible_p): Return 0 for aggregate and
	pointer types if they have different alignment or mode.

From-SVN: r159896
parent db94b0d8
2010-05-26 Eric Botcazou <ebotcazou@adacore.com>
* gimple.c (gimple_types_compatible_p): Return 0 for aggregate and
pointer types if they have different alignment or mode.
2010-05-26 Anatoly Sokolov <aesok@post.ru> 2010-05-26 Anatoly Sokolov <aesok@post.ru>
* config/sparc/sparc.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE, * config/sparc/sparc.h (FUNCTION_VALUE, FUNCTION_OUTGOING_VALUE,
......
...@@ -3299,8 +3299,7 @@ gimple_types_compatible_p (tree t1, tree t2) ...@@ -3299,8 +3299,7 @@ gimple_types_compatible_p (tree t1, tree t2)
if (TREE_CODE (t1) == VOID_TYPE) if (TREE_CODE (t1) == VOID_TYPE)
return 1; return 1;
/* For numerical types do some simple checks before doing three /* Do some simple checks before doing three hashtable queries. */
hashtable queries. */
if (INTEGRAL_TYPE_P (t1) if (INTEGRAL_TYPE_P (t1)
|| SCALAR_FLOAT_TYPE_P (t1) || SCALAR_FLOAT_TYPE_P (t1)
|| FIXED_POINT_TYPE_P (t1) || FIXED_POINT_TYPE_P (t1)
...@@ -3334,6 +3333,14 @@ gimple_types_compatible_p (tree t1, tree t2) ...@@ -3334,6 +3333,14 @@ gimple_types_compatible_p (tree t1, tree t2)
/* For integral types fall thru to more complex checks. */ /* For integral types fall thru to more complex checks. */
} }
else if (AGGREGATE_TYPE_P (t1) || POINTER_TYPE_P (t1))
{
/* Can't be the same type if they have different alignment or mode. */
if (TYPE_ALIGN (t1) != TYPE_ALIGN (t2)
|| TYPE_MODE (t1) != TYPE_MODE (t2))
return 0;
}
/* If the hash values of t1 and t2 are different the types can't /* If the hash values of t1 and t2 are different the types can't
possibly be the same. This helps keeping the type-pair hashtable possibly be the same. This helps keeping the type-pair hashtable
small, only tracking comparisons for hash collisions. */ small, only tracking comparisons for hash collisions. */
......
2010-05-26 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/lto10.adb: New test.
* gnat.dg/lto10_pkg.ads: New helper.
2010-05-26 Kai Tietz <kai.tietz@onevision.com> 2010-05-26 Kai Tietz <kai.tietz@onevision.com>
* lib/target-supports.exp (check_effective_target_int128): New * lib/target-supports.exp (check_effective_target_int128): New
......
-- { dg-do run }
-- { dg-options "-flto" { target lto } }
with Lto10_Pkg; use Lto10_Pkg;
procedure Lto10 is
A : Integer := Minus_One;
Pos : Position;
begin
Pos := Pix.Pos;
if A /= Minus_One then
raise Program_Error;
end if;
end;
package Lto10_Pkg is
type U16 is mod 2 ** 16;
type Position is record
X, Y, Z : U16;
end record;
for Position'Size use 48;
type Pixel is record
Pos : Position;
end record;
pragma Pack (Pixel);
Minus_One : Integer := -1;
Pix : Pixel := (Pos => (X => 0, Y => 0, Z => 0));
end Lto10_Pkg;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment