decl.c (gnat_to_gnu_entity): Really strip only useless conversions around renamed objects.
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Really strip only useless conversions around renamed objects. From-SVN: r143303
This commit is contained in:
parent
406c72ce52
commit
3b9c1abd29
@ -1,3 +1,8 @@
|
||||
2009-01-12 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Really strip
|
||||
only useless conversions around renamed objects.
|
||||
|
||||
2009-01-11 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Put
|
||||
|
@ -843,7 +843,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|
||||
== RECORD_TYPE
|
||||
&& TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0))))
|
||||
/* Strip useless conversions around the object. */
|
||||
|| TREE_CODE (gnu_expr) == NOP_EXPR)
|
||||
|| (TREE_CODE (gnu_expr) == NOP_EXPR
|
||||
&& gnat_types_compatible_p
|
||||
(TREE_TYPE (gnu_expr),
|
||||
TREE_TYPE (TREE_OPERAND (gnu_expr, 0)))))
|
||||
{
|
||||
gnu_expr = TREE_OPERAND (gnu_expr, 0);
|
||||
gnu_type = TREE_TYPE (gnu_expr);
|
||||
|
@ -1,3 +1,7 @@
|
||||
2009-01-12 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* gnat.dg/unchecked_convert3.adb: New test.
|
||||
|
||||
2009-01-12 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/38794
|
||||
|
22
gcc/testsuite/gnat.dg/unchecked_convert3.adb
Normal file
22
gcc/testsuite/gnat.dg/unchecked_convert3.adb
Normal file
@ -0,0 +1,22 @@
|
||||
-- { dg-do run }
|
||||
-- { dg-options "-gnatVa" }
|
||||
|
||||
with Unchecked_Conversion;
|
||||
|
||||
procedure Unchecked_Convert3 is
|
||||
|
||||
type Word is range -(2**15) .. (2**15) - 1;
|
||||
type UWord is mod (2**16);
|
||||
|
||||
function To_Word is new unchecked_conversion (UWord, Word);
|
||||
|
||||
function F return UWord is
|
||||
begin
|
||||
return 65036;
|
||||
end;
|
||||
|
||||
W : Word := To_Word(F);
|
||||
|
||||
begin
|
||||
null;
|
||||
end;
|
Loading…
Reference in New Issue
Block a user