[Ada] Do not set a bogus Esize on subtype built for Component_Size clause

Message ID 20191216103826.GA39487@adacore.com
State New
Headers show
Series
  • [Ada] Do not set a bogus Esize on subtype built for Component_Size clause
Related show

Commit Message

Pierre-Marie de Rodat Dec. 16, 2019, 10:38 a.m.
This fixes a small glitch in the handling of Component_Size clauses:
when the component type is a biased integer type, the compiler builds
a subtype with the size prescribed by the clause, but sets it both as
the Esize and the RM_Size of this subtype.  Now this size might not be
a multiple of the storage unit, which is problematic for the Esize.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-12-16  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Set only
	the RM_Size on the subtype built for a Component_Size clause
	when the component type is a biased integer type.

Patch

--- gcc/ada/sem_ch13.adb
+++ gcc/ada/sem_ch13.adb
@@ -5476,7 +5476,7 @@  package body Sem_Ch13 is
                   Analyze (Decl, Suppress => All_Checks);
 
                   Set_Has_Delayed_Freeze        (New_Ctyp, False);
-                  Set_Esize                     (New_Ctyp, Csize);
+                  Init_Esize                    (New_Ctyp);
                   Set_RM_Size                   (New_Ctyp, Csize);
                   Init_Alignment                (New_Ctyp);
                   Set_Is_Itype                  (New_Ctyp, True);