From: Eric Botcazou Date: Thu, 17 Apr 2008 12:45:53 +0000 (+0000) Subject: decl.c (gnat_to_gnu_entity): Promote the alignment of objects by default. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=90d6701ef8efaf2371bfa87ca70aee9ea69a9604;p=gcc.git decl.c (gnat_to_gnu_entity): Promote the alignment of objects by default. * decl.c (gnat_to_gnu_entity) : Promote the alignment of objects by default. * fe.h (Debug_Flag_Dot_A): Delete. * debug.adb (-gnatd.a): Update documentation. From-SVN: r134390 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e02847fe3de..6bffe2a0076 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2008-04-17 Eric Botcazou + + * decl.c (gnat_to_gnu_entity) : Promote the alignment of + objects by default. + * fe.h (Debug_Flag_Dot_A): Delete. + * debug.adb (-gnatd.a): Update documentation. + 2008-04-17 Samuel Tardieu * g-socket.ads, g-socket.adb (Get_Address): Make Stream a diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 94dc2198b78..3a6be98930a 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -93,7 +93,7 @@ package body Debug is -- dY Enable configurable run-time mode -- dZ Generate listing showing the contents of the dispatch tables - -- d.a Enable alignment promotion for non-scalar stand-alone objects + -- d.a -- d.b -- d.c -- d.d @@ -500,12 +500,6 @@ package body Debug is -- - In case of abstract subprograms the text "is abstract" is -- added at the end of the line. - -- d.a Enable alignment promotion for non-VMS targets. On VMS, by default - -- (in Optimize_Alignment (Off) mode), the alignment of stand-alone - -- objects is increased in some cases to enable the generation of - -- better code. Use of this debug flag enables this transformation - -- on non-VMS targets. - -- d.f Suppress folding of static expressions. This of course results -- in seriously non-conforming behavior, but is useful sometimes -- when tracking down handling of complex expressions. diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 2b2ec684668..d127ca76c87 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -680,8 +680,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) size, or to the biggest meaningful one, whichever is smaller. */ if (!gnu_size && align == 0 && (Is_Atomic (gnat_entity) - || (Debug_Flag_Dot_A - && !Optimize_Alignment_Space (gnat_entity) + || (!Optimize_Alignment_Space (gnat_entity) && kind == E_Variable && AGGREGATE_TYPE_P (gnu_type) && !const_flag && No (Renamed_Object (gnat_entity)) diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h index 2a038d58ffe..2e21af503de 100644 --- a/gcc/ada/fe.h +++ b/gcc/ada/fe.h @@ -47,10 +47,7 @@ extern char Fold_Lower[], Fold_Upper[]; /* debug: */ #define Debug_Flag_NN debug__debug_flag_nn -#define Debug_Flag_Dot_A debug__debug_flag_dot_a - extern Boolean Debug_Flag_NN; -extern Boolean Debug_Flag_Dot_A; /* einfo: We will be setting Esize for types, Component_Bit_Offset for fields, Alignment for types and objects, Component_Size for array types, and diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3723bcf7392..4b66c95efb5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-04-17 Eric Botcazou + + * gnat.dg/alignment4.adb: New test. + * gnat.dg/alignment5.adb: Likewise. + * gnat.dg/frame_overflow.adb: Adjust. + 2008-04-17 Richard Guenther * gcc.dg/tree-ssa/ssa-fre-17.c: New testcase. diff --git a/gcc/testsuite/gnat.dg/alignment4.adb b/gcc/testsuite/gnat.dg/alignment4.adb new file mode 100644 index 00000000000..ebc105367cb --- /dev/null +++ b/gcc/testsuite/gnat.dg/alignment4.adb @@ -0,0 +1,15 @@ +-- { dg-do compile } +-- { dg-options "-gnatws -fdump-tree-gimple" } + +procedure Alignment4 is + + type Stream is array (1..3) of Character; + + S1, S2 : Stream; + +begin + S1 := S2; +end; + +-- { dg-final { scan-tree-dump-not "VIEW_CONVERT_EXPR" "gimple" } } +-- { dg-final { cleanup-tree-dump "gimple" } } diff --git a/gcc/testsuite/gnat.dg/alignment5.adb b/gcc/testsuite/gnat.dg/alignment5.adb new file mode 100644 index 00000000000..4cc2d18db94 --- /dev/null +++ b/gcc/testsuite/gnat.dg/alignment5.adb @@ -0,0 +1,31 @@ +-- { dg-do compile } +-- { dg-options "-gnatws -fdump-tree-gimple" } + +procedure Alignment5 is + + type MY_REC is + record + A1 : INTEGER range -3 .. 3 ; -- symmetric + A2 : BOOLEAN ; + A3 : INTEGER range 0 .. 15 ; -- positive + A4 : INTEGER range 10 .. 100 ; -- arbitrary + A5 : BOOLEAN ; --5 + end record ; + + for MY_REC use + record + A1 at 0 range 0 .. 2 ; + A2 at 0 range 3 .. 3 ; + A3 at 0 range 4 .. 7 ; + A4 at 0 range 8 .. 15 ; + A5 at 0 range 16 .. 16 ; + end record ; + + A_REC, B_REC : MY_REC; + +begin + A_REC := B_REC; +end; + +-- { dg-final { scan-tree-dump-not "VIEW_CONVERT_EXPR" "gimple" } } +-- { dg-final { cleanup-tree-dump "gimple" } } diff --git a/gcc/testsuite/gnat.dg/frame_overflow.adb b/gcc/testsuite/gnat.dg/frame_overflow.adb index 286c93d5983..a20fdd73792 100644 --- a/gcc/testsuite/gnat.dg/frame_overflow.adb +++ b/gcc/testsuite/gnat.dg/frame_overflow.adb @@ -14,15 +14,14 @@ procedure frame_overflow is function -- { dg-error "too large" } Set_In (Bitmap : Bitmap_T; Bitpos : Bitpos_Range_T) return Bitmap_T is - Result: Bitmap_T := Bitmap; + Result: Bitmap_T := Bitmap; -- { dg-error "Storage_Error" } begin Result.Bits (Bitpos) := True; return Result; end; - function -- { dg-error "too large" } - Negate (Bitmap : Bitmap_T) return Bitmap_T is - Result: Bitmap_T; + function Negate (Bitmap : Bitmap_T) return Bitmap_T is + Result: Bitmap_T; -- { dg-error "Storage_Error" } begin for E in Bitpos_Range_T loop Result.Bits (E) := not Bitmap.Bits (E);