Commit 40d1f6af by Eric Botcazou

decl.c (gnat_to_gnu_entity): Branch to common code handling the alignment of discrete types.

	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Type>:
	Branch to common code handling the alignment of discrete types.
	<E_Signed_Integer_Type>: Likewise.
	<E_Modular_Integer_Type>: Likewise.

From-SVN: r161770
parent cb5eb94e
2010-07-03 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Type>:
Branch to common code handling the alignment of discrete types.
<E_Signed_Integer_Type>: Likewise.
<E_Modular_Integer_Type>: Likewise.
2010-07-02 Eric Botcazou <ebotcazou@adacore.com> 2010-07-02 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/misc.c (gnat_handle_option): Do not populate gnat_argv. * gcc-interface/misc.c (gnat_handle_option): Do not populate gnat_argv.
......
...@@ -1496,7 +1496,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1496,7 +1496,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Note that the bounds are updated at the end of this function /* Note that the bounds are updated at the end of this function
to avoid an infinite recursion since they refer to the type. */ to avoid an infinite recursion since they refer to the type. */
} }
break; goto discrete_type;
case E_Signed_Integer_Type: case E_Signed_Integer_Type:
case E_Ordinary_Fixed_Point_Type: case E_Ordinary_Fixed_Point_Type:
...@@ -1504,7 +1504,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1504,7 +1504,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* For integer types, just make a signed type the appropriate number /* For integer types, just make a signed type the appropriate number
of bits. */ of bits. */
gnu_type = make_signed_type (esize); gnu_type = make_signed_type (esize);
break; goto discrete_type;
case E_Modular_Integer_Type: case E_Modular_Integer_Type:
{ {
...@@ -1543,7 +1543,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1543,7 +1543,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_type = gnu_subtype; gnu_type = gnu_subtype;
} }
} }
break; goto discrete_type;
case E_Signed_Integer_Subtype: case E_Signed_Integer_Subtype:
case E_Enumeration_Subtype: case E_Enumeration_Subtype:
...@@ -1632,6 +1632,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1632,6 +1632,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnat_to_gnu_type gnat_to_gnu_type
(Original_Array_Type (gnat_entity))); (Original_Array_Type (gnat_entity)));
discrete_type:
/* We have to handle clauses that under-align the type specially. */ /* We have to handle clauses that under-align the type specially. */
if ((Present (Alignment_Clause (gnat_entity)) if ((Present (Alignment_Clause (gnat_entity))
|| (Is_Packed_Array_Type (gnat_entity) || (Is_Packed_Array_Type (gnat_entity)
...@@ -1685,9 +1687,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1685,9 +1687,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY); relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY);
/* Don't notify the field as "addressable", since we won't be taking /* Don't declare the field as addressable since we won't be taking
it's address and it would prevent create_field_decl from making a its address and this would prevent create_field_decl from making
bitfield. */ a bitfield. */
gnu_field gnu_field
= create_field_decl (get_identifier ("OBJECT"), gnu_field_type, = create_field_decl (get_identifier ("OBJECT"), gnu_field_type,
gnu_type, NULL_TREE, bitsize_zero_node, 1, 0); gnu_type, NULL_TREE, bitsize_zero_node, 1, 0);
...@@ -1736,9 +1738,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1736,9 +1738,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_ALIGN (gnu_type) = align; TYPE_ALIGN (gnu_type) = align;
relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY); relate_alias_sets (gnu_type, gnu_field_type, ALIAS_SET_COPY);
/* Don't notify the field as "addressable", since we won't be taking /* Don't declare the field as addressable since we won't be taking
it's address and it would prevent create_field_decl from making a its address and this would prevent create_field_decl from making
bitfield. */ a bitfield. */
gnu_field gnu_field
= create_field_decl (get_identifier ("F"), gnu_field_type, = create_field_decl (get_identifier ("F"), gnu_field_type,
gnu_type, NULL_TREE, bitsize_zero_node, 1, 0); gnu_type, NULL_TREE, bitsize_zero_node, 1, 0);
......
2010-07-03 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/modular3.adb: New test.
* gnat.dg/modular3_pkg.ads: New helper.
2010-07-03 Iain Sandoe <iains@gcc.gnu.org> 2010-07-03 Iain Sandoe <iains@gcc.gnu.org>
Mikael Pettersson <mikpe@it.uu.se> Mikael Pettersson <mikpe@it.uu.se>
...@@ -19,12 +24,12 @@ ...@@ -19,12 +24,12 @@
2010-07-02 Daniel Jacobowitz <dan@codesourcery.com> 2010-07-02 Daniel Jacobowitz <dan@codesourcery.com>
Julian Brown <julian@codesourcery.com> Julian Brown <julian@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com>
* gcc.c-torture/execute/20100416-1.c: New test case. * gcc.c-torture/execute/20100416-1.c: New test case.
2010-07-02 Julian Brown <julian@codesourcery.com> 2010-07-02 Julian Brown <julian@codesourcery.com>
Sandra Loosemore <sandra@codesourcery.com> Sandra Loosemore <sandra@codesourcery.com>
PR target/43703 PR target/43703
......
-- { dg-do run }
with Modular3_Pkg; use Modular3_Pkg;
procedure Modular3 is
function F1 (A : Int16_T) return Int16_T is
begin
return A + 128;
end;
function F2 (B : Mod16_T) return Mod16_T is
begin
return B + 128;
end;
A : Int16_T := 16384;
B : Mod16_T := 65504;
begin
A := F1 (A);
if A /= 16512 then
raise Program_Error;
end if;
B := F2 (B);
if B /= 96 then
raise Program_Error;
end if;
end Modular3;
package Modular3_Pkg is
type Int16_T is range -32768 .. 32767;
for Int16_T'Size use 16;
for Int16_T'Alignment use 1;
type Mod16_T is mod 2 ** 16;
for Mod16_T'Size use 16;
for Mod16_T'Alignment use 1;
end Modular3_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