diff mbox

[6/6] scalar-storage-order merge: testsuite

Message ID 10101084.M44DF2QoKb@polaris
State New
Headers show

Commit Message

Eric Botcazou Oct. 6, 2015, 11:07 a.m. UTC
This is the testsuite part.

testsuite/
	* c-c++-common/sso-1.c: New test.
	* c-c++-common/sso-2.c: Likewise.
	* c-c++-common/sso-3.c: Likewise.
	* c-c++-common/sso-4.c: Likewise.
	* c-c++-common/sso-5.c: Likewise.
	* c-c++-common/sso-6.c: Likewise.
	* c-c++-common/sso-7.c: Likewise.
        * c-c++-common/sso: New directory.
        * gcc.dg/sso-1.c: New test.
        * g++.dg/sso-1.C: Likewise.
        * gcc.dg/sso: New directory.
        * g++.dg/sso: Likewise.
	* gcc.target/i386/movbe-3.c: New test.
        * gnat.dg/sso1.adb: New test.
        * gnat.dg/sso2.ad[sb]: Likewise.
        * gnat.dg/sso3.adb: Likewise.
        * gnat.dg/sso4.adb: Likewise.
        * gnat.dg/sso5.adb: Likewise.
        * gnat.dg/sso6.adb: Likewise.
        * gnat.dg/sso7.adb: Likewise.
        * gnat.dg/specs/sso1.ads: Likewise.
        * gnat.dg/specs/sso2.ads: Likewise.
        * gnat.dg/sso: New directory.

 c-c++-common/sso-1.c      |   94 +++++++++++++++++++++++++++++++++++
 c-c++-common/sso-2.c      |   94 +++++++++++++++++++++++++++++++++++
 c-c++-common/sso-3.c      |   21 +++++++
 c-c++-common/sso-4.c      |   24 ++++++++
 c-c++-common/sso-5.c      |   72 ++++++++++++++++++++++++++
 c-c++-common/sso-6.c      |   44 ++++++++++++++++
 c-c++-common/sso-7.c      |   44 ++++++++++++++++
 c-c++-common/sso/dump.h   |   23 ++++++++
 c-c++-common/sso/init1.h  |   12 ++++
 c-c++-common/sso/init13.h |   15 +++++
 c-c++-common/sso/init2.h  |   24 ++++++++
 c-c++-common/sso/init3.h  |   34 ++++++++++++
 c-c++-common/sso/init4.h  |   14 +++++
 c-c++-common/sso/init5.h  |   14 +++++
 c-c++-common/sso/init6.h  |   24 ++++++++
 c-c++-common/sso/init7.h  |   28 ++++++++++
 c-c++-common/sso/init8.h  |   28 ++++++++++
 c-c++-common/sso/init9.h  |   14 +++++
 c-c++-common/sso/p1.c     |   64 +++++++++++++++++++++++
 c-c++-common/sso/p13.c    |   64 +++++++++++++++++++++++
 c-c++-common/sso/p2.c     |   88 ++++++++++++++++++++++++++++++++
 c-c++-common/sso/p3.c     |   88 ++++++++++++++++++++++++++++++++
 c-c++-common/sso/p4.c     |   64 +++++++++++++++++++++++
 c-c++-common/sso/p5.c     |   74 +++++++++++++++++++++++++++
 c-c++-common/sso/p6.c     |   74 +++++++++++++++++++++++++++
 c-c++-common/sso/p7.c     |   74 +++++++++++++++++++++++++++
 c-c++-common/sso/p8.c     |   74 +++++++++++++++++++++++++++
 c-c++-common/sso/p9.c     |   64 +++++++++++++++++++++++
 c-c++-common/sso/q1.c     |   50 ++++++++++++++++++
 c-c++-common/sso/q13.c    |   50 ++++++++++++++++++
 c-c++-common/sso/q2.c     |   54 ++++++++++++++++++++
 c-c++-common/sso/q3.c     |   54 ++++++++++++++++++++
 c-c++-common/sso/q4.c     |   50 ++++++++++++++++++
 c-c++-common/sso/q5.c     |   46 +++++++++++++++++
 c-c++-common/sso/q6.c     |   45 ++++++++++++++++
 c-c++-common/sso/q7.c     |   46 +++++++++++++++++
 c-c++-common/sso/q8.c     |   46 +++++++++++++++++
 c-c++-common/sso/q9.c     |   50 ++++++++++++++++++
 c-c++-common/sso/r3.c     |   65 ++++++++++++++++++++++++
 c-c++-common/sso/r5.c     |   65 ++++++++++++++++++++++++
 c-c++-common/sso/r6.c     |   65 ++++++++++++++++++++++++
 c-c++-common/sso/r7.c     |   65 ++++++++++++++++++++++++
 c-c++-common/sso/r8.c     |   65 ++++++++++++++++++++++++
 c-c++-common/sso/s3.c     |   79 +++++++++++++++++++++++++++++
 c-c++-common/sso/s5.c     |   91 ++++++++++++++++++++++++++++++++++
 c-c++-common/sso/s6.c     |   81 ++++++++++++++++++++++++++++++
 c-c++-common/sso/s7.c     |   79 +++++++++++++++++++++++++++++
 c-c++-common/sso/s8.c     |   79 +++++++++++++++++++++++++++++
 c-c++-common/sso/t1.c     |   56 ++++++++++++++++++++
 c-c++-common/sso/t13.c    |   56 ++++++++++++++++++++
 c-c++-common/sso/t2.c     |   92 ++++++++++++++++++++++++++++++++++
 c-c++-common/sso/t3.c     |   92 ++++++++++++++++++++++++++++++++++
 c-c++-common/sso/t4.c     |   56 ++++++++++++++++++++
 c-c++-common/sso/t5.c     |   72 ++++++++++++++++++++++++++
 c-c++-common/sso/t6.c     |   72 ++++++++++++++++++++++++++
 c-c++-common/sso/t7.c     |   72 ++++++++++++++++++++++++++
 c-c++-common/sso/t8.c     |   72 ++++++++++++++++++++++++++
 c-c++-common/sso/t9.c     |   56 ++++++++++++++++++++
 c-c++-common/sso/u5.c     |   52 +++++++++++++++++++
 c-c++-common/sso/u6.c     |   52 +++++++++++++++++++
 g++.dg/sso-1.C            |   17 ++++++
 g++.dg/sso/sso.exp        |   40 ++++++++++++++
 gcc.dg/sso-1.c            |   17 ++++++
 gcc.dg/sso/sso.exp        |   40 ++++++++++++++
 gcc.target/i386/movbe-3.c |   19 +++++++
 gnat.dg/specs/sso1.ads    |   22 ++++++++
 gnat.dg/specs/sso2.ads    |   26 +++++++++
 gnat.dg/sso/conv1.adb     |   50 ++++++++++++++++++
 gnat.dg/sso/dump.adb      |   17 ++++++
 gnat.dg/sso/dump.ads      |    3 +
 gnat.dg/sso/init1.ads     |   26 +++++++++
 gnat.dg/sso/init10.ads    |   23 ++++++++
 gnat.dg/sso/init11.ads    |   34 ++++++++++++
 gnat.dg/sso/init12.ads    |   25 +++++++++
 gnat.dg/sso/init13.ads    |   33 ++++++++++++
 gnat.dg/sso/init2.ads     |   69 +++++++++++++++++++++++++
 gnat.dg/sso/init3.ads     |   78 +++++++++++++++++++++++++++++
 gnat.dg/sso/init4.ads     |   27 ++++++++++
 gnat.dg/sso/init5.ads     |   39 ++++++++++++++
 gnat.dg/sso/init6.ads     |   39 ++++++++++++++
 gnat.dg/sso/init7.ads     |   59 ++++++++++++++++++++++
 gnat.dg/sso/init8.ads     |   59 ++++++++++++++++++++++
 gnat.dg/sso/init9.ads     |   27 ++++++++++
 gnat.dg/sso/p1.adb        |   62 +++++++++++++++++++++++
 gnat.dg/sso/p10.adb       |   63 +++++++++++++++++++++++
 gnat.dg/sso/p11.adb       |   68 +++++++++++++++++++++++++
 gnat.dg/sso/p12.adb       |  122 ++++++++++++++++++++++++++++++++++++++++++++
 gnat.dg/sso/p13.adb       |   63 +++++++++++++++++++++++
 gnat.dg/sso/p2.adb        |   80 +++++++++++++++++++++++++++++
 gnat.dg/sso/p3.adb        |   80 +++++++++++++++++++++++++++++
 gnat.dg/sso/p4.adb        |   63 +++++++++++++++++++++++
 gnat.dg/sso/p5.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/p6.adb        |   61 ++++++++++++++++++++++
 gnat.dg/sso/p7.adb        |   61 ++++++++++++++++++++++
 gnat.dg/sso/p8.adb        |   61 ++++++++++++++++++++++
 gnat.dg/sso/p9.adb        |   63 +++++++++++++++++++++++
 gnat.dg/sso/q1.adb        |   52 +++++++++++++++++++
 gnat.dg/sso/q10.adb       |   53 +++++++++++++++++++
 gnat.dg/sso/q11.adb       |   44 ++++++++++++++++
 gnat.dg/sso/q12.adb       |   43 ++++++++++++++++
 gnat.dg/sso/q13.adb       |   53 +++++++++++++++++++
 gnat.dg/sso/q2.adb        |   60 ++++++++++++++++++++++
 gnat.dg/sso/q3.adb        |   60 ++++++++++++++++++++++
 gnat.dg/sso/q4.adb        |   53 +++++++++++++++++++
 gnat.dg/sso/q5.adb        |   44 ++++++++++++++++
 gnat.dg/sso/q6.adb        |   44 ++++++++++++++++
 gnat.dg/sso/q7.adb        |   44 ++++++++++++++++
 gnat.dg/sso/q8.adb        |   44 ++++++++++++++++
 gnat.dg/sso/q9.adb        |   53 +++++++++++++++++++
 gnat.dg/sso/r11.adb       |   68 +++++++++++++++++++++++++
 gnat.dg/sso/r12.adb       |  123 ++++++++++++++++++++++++++++++++++++++++++++
 gnat.dg/sso/r3.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/r5.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/r6.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/r7.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/r8.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/s11.adb       |   78 +++++++++++++++++++++++++++++
 gnat.dg/sso/s12.adb       |   77 ++++++++++++++++++++++++++++
 gnat.dg/sso/s3.adb        |   79 +++++++++++++++++++++++++++++
 gnat.dg/sso/s5.adb        |   78 +++++++++++++++++++++++++++++
 gnat.dg/sso/s6.adb        |   79 +++++++++++++++++++++++++++++
 gnat.dg/sso/s7.adb        |   79 +++++++++++++++++++++++++++++
 gnat.dg/sso/s8.adb        |   79 +++++++++++++++++++++++++++++
 gnat.dg/sso/sso.exp       |   40 ++++++++++++++
 gnat.dg/sso/t1.adb        |   55 ++++++++++++++++++++
 gnat.dg/sso/t10.adb       |   56 ++++++++++++++++++++
 gnat.dg/sso/t11.adb       |   67 +++++++++++++++++++++++++
 gnat.dg/sso/t12.adb       |   66 ++++++++++++++++++++++++
 gnat.dg/sso/t13.adb       |   56 ++++++++++++++++++++
 gnat.dg/sso/t2.adb        |   84 +++++++++++++++++++++++++++++++
 gnat.dg/sso/t3.adb        |   84 +++++++++++++++++++++++++++++++
 gnat.dg/sso/t4.adb        |   56 ++++++++++++++++++++
 gnat.dg/sso/t5.adb        |   67 +++++++++++++++++++++++++
 gnat.dg/sso/t6.adb        |   67 +++++++++++++++++++++++++
 gnat.dg/sso/t7.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/t8.adb        |   68 +++++++++++++++++++++++++
 gnat.dg/sso/t9.adb        |   56 ++++++++++++++++++++
 gnat.dg/sso/u11.adb       |   44 ++++++++++++++++
 gnat.dg/sso/u5.adb        |   44 ++++++++++++++++
 gnat.dg/sso/u6.adb        |   44 ++++++++++++++++
 gnat.dg/sso1.adb          |   77 ++++++++++++++++++++++++++++
 gnat.dg/sso2.adb          |   14 +++++
 gnat.dg/sso2.ads          |   13 ++++
 gnat.dg/sso3.adb          |   52 +++++++++++++++++++
 gnat.dg/sso4.adb          |   55 ++++++++++++++++++++
 gnat.dg/sso5.adb          |   52 +++++++++++++++++++
 gnat.dg/sso6.adb          |   54 ++++++++++++++++++++
 gnat.dg/sso7.adb          |   52 +++++++++++++++++++
 148 files changed, 8198 insertions(+)

Comments

Jeff Law Oct. 12, 2015, 10:26 p.m. UTC | #1
On 10/06/2015 05:07 AM, Eric Botcazou wrote:
> This is the testsuite part.
>
> testsuite/
> 	* c-c++-common/sso-1.c: New test.
> 	* c-c++-common/sso-2.c: Likewise.
> 	* c-c++-common/sso-3.c: Likewise.
> 	* c-c++-common/sso-4.c: Likewise.
> 	* c-c++-common/sso-5.c: Likewise.
> 	* c-c++-common/sso-6.c: Likewise.
> 	* c-c++-common/sso-7.c: Likewise.
>          * c-c++-common/sso: New directory.
>          * gcc.dg/sso-1.c: New test.
>          * g++.dg/sso-1.C: Likewise.
>          * gcc.dg/sso: New directory.
>          * g++.dg/sso: Likewise.
> 	* gcc.target/i386/movbe-3.c: New test.
>          * gnat.dg/sso1.adb: New test.
>          * gnat.dg/sso2.ad[sb]: Likewise.
>          * gnat.dg/sso3.adb: Likewise.
>          * gnat.dg/sso4.adb: Likewise.
>          * gnat.dg/sso5.adb: Likewise.
>          * gnat.dg/sso6.adb: Likewise.
>          * gnat.dg/sso7.adb: Likewise.
>          * gnat.dg/specs/sso1.ads: Likewise.
>          * gnat.dg/specs/sso2.ads: Likewise.
>          * gnat.dg/sso: New directory.
And this is OK once the prerequisites have gone in.

Jeff
diff mbox

Patch

Index: testsuite/gcc.target/i386/movbe-3.c
===================================================================
--- testsuite/gcc.target/i386/movbe-3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/gcc.target/i386/movbe-3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,19 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O -mmovbe" } */
+
+struct __attribute__((scalar_storage_order("big-endian"))) S
+{
+  int i;
+};
+
+int get (struct S *s)
+{
+  return s->i;
+}
+
+void set (struct S *s, int i)
+{
+  s->i = i;
+}
+
+/* { dg-final { scan-assembler-times "movbe\[ \t\]" 2 } } */
Index: testsuite/gnat.dg/sso6.adb
===================================================================
--- testsuite/gnat.dg/sso6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,54 @@ 
+-- { dg-do run }
+
+with System;
+
+procedure SSO6 is
+
+   type Short_Int is mod 2**16;
+
+   type Rec1 is record
+      F1 : Short_Int;
+      F2 : Short_Int;
+   end record;
+   for Rec1 use record
+      F1 at 0 range  0 .. 15;
+      F2 at 0 range 16 .. 31;
+   end record;
+   for Rec1'Bit_Order use System.High_Order_First;
+   for Rec1'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec2 is record
+      I1 : Integer;
+      R1 : Rec1;
+   end record;
+   for Rec2 use record
+      I1 at 0 range 0 .. 31; 
+      R1 at 4 range 0 .. 31;
+   end record;
+   for Rec2'Bit_Order use System.High_Order_First;
+   for Rec2'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec3 is record
+      Data : Rec1;
+   end record;
+   for Rec3 use record
+      Data at 0 range 1 .. 32;
+   end record;
+   for Rec3'Bit_Order use System.High_Order_First;
+   for Rec3'Scalar_Storage_Order use System.High_Order_First;
+
+   procedure Copy (Message : in Rec3) is
+      Local : Rec2;
+   begin
+      Local := (I1 => 1, R1 => Message.Data);
+      if Local.R1 /= Message.Data then
+         raise Program_Error;
+      end if;
+   end;
+
+   Message : Rec3;
+
+begin
+   Message := (Data => (2, 3));
+   Copy(Message);
+end;
Index: testsuite/gnat.dg/sso/t7.adb
===================================================================
--- testsuite/gnat.dg/sso/t7.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t7.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init7; use Init7;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T7 is
+  Verbose : constant Boolean := False;
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I    := My_R1.I + 1;
+  Local_R1.N.C1 := My_R1.N.C1 + 1;
+  Local_R1.N.C2 := My_R1.N.C2 + 1;
+  Local_R1.N.C3 := My_R1.N.C3 + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R2.I    := My_R2.I + 1;
+  Local_R2.N.C1 := My_R2.N.C1 + 1;
+  Local_R2.N.C2 := My_R2.N.C2 + 1;
+  Local_R2.N.C3 := My_R2.N.C3 + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+-- 
+  Local_R1 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.N.C1 := Local_R1.N.C1 + 1;
+  Local_R1.N.C2 := Local_R1.N.C2 + 1;
+  Local_R1.N.C3 := Local_R1.N.C3 + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.N.C1 := Local_R2.N.C1 + 1;
+  Local_R2.N.C2 := Local_R2.N.C2 + 1;
+  Local_R2.N.C3 := Local_R2.N.C3 + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+end;
Index: testsuite/gnat.dg/sso/t8.adb
===================================================================
--- testsuite/gnat.dg/sso/t8.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t8.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init8; use Init8;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T8 is
+  Verbose : constant Boolean := False;
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I    := My_R1.I + 1;
+  Local_R1.N.C1 := My_R1.N.C1 + 1;
+  Local_R1.N.C2 := My_R1.N.C2 + 1;
+  Local_R1.N.C3 := My_R1.N.C3 + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+  Local_R2.I    := My_R2.I + 1;
+  Local_R2.N.C1 := My_R2.N.C1 + 1;
+  Local_R2.N.C2 := My_R2.N.C2 + 1;
+  Local_R2.N.C3 := My_R2.N.C3 + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R1 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.N.C1 := Local_R1.N.C1 + 1;
+  Local_R1.N.C2 := Local_R1.N.C2 + 1;
+  Local_R1.N.C3 := Local_R1.N.C3 + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.N.C1 := Local_R2.N.C1 + 1;
+  Local_R2.N.C2 := Local_R2.N.C2 + 1;
+  Local_R2.N.C3 := Local_R2.N.C3 + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+end;
Index: testsuite/gnat.dg/sso/t9.adb
===================================================================
--- testsuite/gnat.dg/sso/t9.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t9.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+-- { dg-do run }
+
+with Init9; use Init9;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T9 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.F := My_R1.F + 1.0;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40\n" }
+
+  Local_R2.F := My_R2.F + 1.0;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c\n" }
+
+  Local_R1.F := Pi;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" }
+
+  Local_R2.F := Pi;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" }
+
+  Local_R1.F := Local_R1.F + 1.0;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40\n" }
+
+  Local_R2.F := Local_R2.F + 1.0;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c\n" }
+
+end;
Index: testsuite/gnat.dg/sso/q10.adb
===================================================================
--- testsuite/gnat.dg/sso/q10.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q10.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,53 @@ 
+-- { dg-do run }
+-- { dg-options "-gnatws" }
+
+with Init10; use Init10;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q10 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78\n" }
+
+  if A1.I /= B1.I then
+    raise Program_Error;
+  end if;
+
+  if A1.I /= 16#12345678# then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= 16#12345678# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/q11.adb
===================================================================
--- testsuite/gnat.dg/sso/q11.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q11.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init11; use Init11;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q11 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n"} 
+
+  if A1.I /= B1.I or A1.A(1) /= B1.A(1) then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.A(1) /= B2.A(1) then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/q12.adb
===================================================================
--- testsuite/gnat.dg/sso/q12.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q12.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,43 @@ 
+-- { dg-do run }
+
+with Init12; use Init12;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q12 is
+
+  A1  : Arr1  := My_A1;
+  A11 : Arr11 := My_A11;
+
+  A2  : Arr2  := My_A2;
+  A22 : Arr22 := My_A22;
+
+begin
+  Put ("A1  :");
+  Dump (A1'Address, Arr1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1  : 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A11 :");
+  Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Put ("A2  :");
+  Dump (A2'Address, Arr2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2  : 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A22 :");
+  Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  if A1(1) /= A11(1,1) then
+    raise Program_Error;
+  end if;
+
+  if A2(1) /= A22(1,1) then
+    raise Program_Error;
+  end if;
+end;
Index: testsuite/gnat.dg/sso/q13.adb
===================================================================
--- testsuite/gnat.dg/sso/q13.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q13.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,53 @@ 
+-- { dg-do run }
+
+with Init13; use Init13;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q13 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : db 0f 49 40 db 0f 49 c0\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : db 0f 49 40 db 0f 49 c0\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 40 49 0f db c0 49 0f db\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 40 49 0f db c0 49 0f db\n" }
+
+  if A1.F /= B1.F then
+    raise Program_Error;
+  end if;
+
+  if A1.F /= (Pi, -Pi) then
+    raise Program_Error;
+  end if;
+
+  if A2.F /= B2.F then
+    raise Program_Error;
+  end if;
+
+  if A2.F /= (Pi, -Pi) then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/s11.adb
===================================================================
--- testsuite/gnat.dg/sso/s11.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s11.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,78 @@ 
+-- { dg-do run }
+
+with Init11; use Init11;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S11 is
+
+  A1 : R1 := My_R1;
+  A2 : R2 := My_R2;
+
+  AA1 : Arr1;
+  AA2 : Arr2;
+
+  C1 : My_Integer;
+  C2 : My_Integer;
+  C3 : My_Integer;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  AA1 := A1.A;
+  C1 := AA1(1);
+  C2 := AA1(2);
+  C3 := AA1(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  AA1(1) := C1;
+  AA1(2) := C2;
+  AA1(3) := C3;
+  A1.A := AA1;
+
+  AA2 := A2.A;
+  C1 := AA2(1);
+  C2 := AA2(2);
+  C3 := AA2(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  AA2(1) := C1;
+  AA2(2) := C2;
+  AA2(3) := C3;
+  A2.A := AA2;
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+end;
Index: testsuite/gnat.dg/sso/s12.adb
===================================================================
--- testsuite/gnat.dg/sso/s12.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s12.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,77 @@ 
+-- { dg-do run }
+
+with Init12; use Init12;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S12 is
+
+  A11 : Arr11 := My_A11;
+  A22 : Arr22 := My_A22;
+
+  A1 : Arr1;
+  A2 : Arr2;
+
+  C1 : Integer;
+  C2 : Integer;
+  C3 : Integer;
+
+begin
+  Put ("A11 :");
+  Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Put ("A22 :");
+  Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  A1 := (A11(1,1), A11(1,2), A11(2,1));
+  C1 := A1(1);
+  C2 := A1(2);
+  C3 := A1(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 11206674\n" }
+
+  A1(1) := C1;
+  A1(2) := C2;
+  A1(3) := C3;
+  A11(1,1) := A1(1); A11(1,2) := A1(2); A11(2,1) := A1(3);
+
+  A2 := (A22(1,1), A22(1,2), A22(2,1));
+  C1 := A2(1);
+  C2 := A2(2);
+  C3 := A2(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 11206674\n" }
+
+  A2(1) := C1;
+  A2(2) := C2;
+  A2(3) := C3;
+  A22(1,1) := A2(1); A22(1,2) := A2(2); A22(2,1) := A2(3);
+
+  Put ("A11 :");
+  Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Put ("A22 :");
+  Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+end;
Index: testsuite/gnat.dg/sso/u11.adb
===================================================================
--- testsuite/gnat.dg/sso/u11.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/u11.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init11; use Init11;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure U11 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+  C1 : My_Integer;
+  C2 : My_Integer;
+
+begin
+  Local_R1 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 01 00 00 00 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 00 00 00 01 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  C1 := Local_R1.A (Integer(Local_R1.I));
+  Put_Line ("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Local_R1.I := Local_R1.I + 1;  
+  C1 := Local_R1.A (Integer(Local_R1.I));
+  Put_Line ("C1 :" & C1'Img);
+  -- { dg-output "C1 : 13434932\n" }
+
+  C2 := Local_R2.A (Integer(Local_R2.I));
+  Put_Line ("C2 :" & C2'Img);
+  -- { dg-output "C2 : 11206674\n" }
+
+  Local_R2.I := Local_R2.I + 1;  
+  C2 := Local_R2.A (Integer(Local_R2.I));
+  Put_Line ("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+end;
Index: testsuite/gnat.dg/sso/q1.adb
===================================================================
--- testsuite/gnat.dg/sso/q1.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q1.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,52 @@ 
+-- { dg-do run }
+
+with Init1; use Init1;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q1 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78\n" }
+
+  if A1.I /= B1.I then
+    raise Program_Error;
+  end if;
+
+  if A1.I /= 16#12345678# then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= 16#12345678# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/q2.adb
===================================================================
--- testsuite/gnat.dg/sso/q2.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q2.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,60 @@ 
+-- { dg-do run }
+
+with Init2; use Init2;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q2 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  if A1.S1 /= B1.S1 then
+    raise Program_Error;
+  end if;
+
+  if A1.S1 /= 2 then
+    raise Program_Error;
+  end if;
+
+  if A2.S1 /= B2.S1 then
+    raise Program_Error;
+  end if;
+
+  if A2.S1 /= 2 then
+    raise Program_Error;
+  end if;
+
+  if A1.I /= B1.I or A1.A(1) /= B1.A(1) then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.A(1) /= B2.A(1) then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/q3.adb
===================================================================
--- testsuite/gnat.dg/sso/q3.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q3.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,60 @@ 
+-- { dg-do run }
+
+with Init3; use Init3;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q3 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  if A1.S1 /= B1.S1 then
+    raise Program_Error;
+  end if;
+
+  if A1.S1 /= 2 then
+    raise Program_Error;
+  end if;
+
+  if A2.S1 /= B2.S1 then
+    raise Program_Error;
+  end if;
+
+  if A2.S1 /= 2 then
+    raise Program_Error;
+  end if;
+
+  if A1.I /= B1.I or A1.N.C1 /= B1.N.C1 then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.N.C1 /= B2.N.C1 then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/q4.adb
===================================================================
--- testsuite/gnat.dg/sso/q4.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q4.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,53 @@ 
+-- { dg-do run }
+
+with Init4; use Init4;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q4 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : db 0f 49 40\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : db 0f 49 40\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 40 49 0f db\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 40 49 0f db\n" }
+
+  if A1.F /= B1.F then
+    raise Program_Error;
+  end if;
+
+  if A1.F /= Pi then
+    raise Program_Error;
+  end if;
+
+  if A2.F /= B2.F then
+    raise Program_Error;
+  end if;
+
+  if A2.F /= Pi then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/init10.ads
===================================================================
--- testsuite/gnat.dg/sso/init10.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init10.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,23 @@ 
+with System;
+
+package Init10 is
+
+  type My_Integer is new Integer;
+  for My_Integer'Alignment use 1;
+
+  type R1 is record
+    I : My_Integer;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type R2 is record
+    I : My_Integer;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+
+  My_R1 : constant R1 := (I => 16#12345678#);
+  My_R2 : constant R2 := (I => 16#12345678#);
+
+end Init10;
Index: testsuite/gnat.dg/sso/q5.adb
===================================================================
--- testsuite/gnat.dg/sso/q5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init5; use Init5;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q5 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n"} 
+
+  if A1.I /= B1.I or A1.A(1) /= B1.A(1) then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.A(1) /= B2.A(1) then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/q6.adb
===================================================================
--- testsuite/gnat.dg/sso/q6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init6; use Init6;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q6 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  if A1.I /= B1.I or A1.A(1) /= B1.A(1) then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.A(1) /= B2.A(1) then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/init11.ads
===================================================================
--- testsuite/gnat.dg/sso/init11.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init11.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,34 @@ 
+with System;
+
+package Init11 is
+
+  type My_Integer is new Integer;
+  for My_Integer'Alignment use 1;
+
+  type Arr1 is array (1 .. 3) of My_Integer;
+  for Arr1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type R1 is record
+    I : My_Integer;
+    A : Arr1;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type Arr2 is array (1 .. 3) of My_Integer;
+  for Arr2'Scalar_Storage_Order use System.High_Order_First;
+
+  type R2 is record
+    I : My_Integer;
+    A : Arr2;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+
+  My_R1 : constant R1 := (I => 16#12345678#,
+                          A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+  My_R2 : constant R2 := (I => 16#12345678#,
+                          A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+end Init11;
Index: testsuite/gnat.dg/sso/conv1.adb
===================================================================
--- testsuite/gnat.dg/sso/conv1.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/conv1.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,50 @@ 
+-- { dg-do run }
+
+with System; use System;
+with Ada.Text_IO; use Ada.Text_IO;
+
+procedure Conv1 is
+   type Short is mod 2**16;
+
+   type R_L is record
+      S : Short;
+      C : Character;
+   end record;
+   for R_L'Bit_Order use Low_Order_First;
+   for R_L'Scalar_Storage_Order use Low_Order_First;
+   for R_L use record
+      S at 0 range 0 .. 15;
+      C at 2 range 0 .. 7;
+   end record;
+
+   type R_H is new R_L;
+   for R_H'Bit_Order use High_Order_First;
+   for R_H'Scalar_Storage_Order use High_Order_First;
+   for R_H use record
+      S at 0 range 0 .. 15;
+      C at 2 range 0 .. 7;
+   end record;
+
+   procedure Dump (Name : String; S : Short; C : Character) is
+   begin
+      Put_Line (Name & " = (S =>" & S'Img & ", C => '" & C & "')");
+   end Dump;
+
+   X_L : R_L;
+   X_H : R_H;
+begin
+   X_L.S := 12345;
+   X_L.C := 'a';
+   Dump ("X_L", X_L.S, X_L.C);
+   -- { dg-output "X_L = \\(S => 12345, C => 'a'\\)\n" }
+
+   X_H.S := 23456;
+   X_H.C := 'b';
+   Dump ("X_H", X_H.S, X_H.C);
+   -- { dg-output "X_H = \\(S => 23456, C => 'b'\\)\n" }
+
+   X_H := R_H (X_L);
+   Dump ("X_H", X_H.S, X_H.C);
+   -- { dg-output "X_H = \\(S => 12345, C => 'a'\\)\n" }
+
+end;
Index: testsuite/gnat.dg/sso/q7.adb
===================================================================
--- testsuite/gnat.dg/sso/q7.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q7.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init7; use Init7;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q7 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  if A1.I /= B1.I or A1.N.C1 /= B1.N.C1 then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.N.C1 /= B2.N.C1 then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/init12.ads
===================================================================
--- testsuite/gnat.dg/sso/init12.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init12.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,25 @@ 
+with System;
+
+package Init12 is
+
+  type Arr1 is array (1 .. 3) of Integer;
+  for Arr1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type Arr11 is array (1 .. 2, 1 .. 2) of Integer;
+  for Arr11'Scalar_Storage_Order use System.Low_Order_First;
+
+  type Arr2 is array (1 .. 3) of Integer;
+  for Arr2'Scalar_Storage_Order use System.High_Order_First;
+
+  type Arr22 is array (1 .. 2, 1 .. 2) of Integer;
+  for Arr22'Scalar_Storage_Order use System.High_Order_First;
+
+  My_A1   : constant Arr1   := (16#AB0012#, 16#CD0034#, 16#EF0056#);
+  My_A11  : constant Arr11  := (1 => (16#AB0012#, 16#CD0034#),
+                                2 => (16#AB0012#, 16#CD0034#));
+
+  My_A2   : constant Arr2   := (16#AB0012#, 16#CD0034#, 16#EF0056#);
+  My_A22  : constant Arr22  := (1 => (16#AB0012#, 16#CD0034#),
+                                2 => (16#AB0012#, 16#CD0034#));
+
+end Init12;
Index: testsuite/gnat.dg/sso/q8.adb
===================================================================
--- testsuite/gnat.dg/sso/q8.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q8.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init8; use Init8;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q8 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  if A1.I /= B1.I or A1.N.C1 /= B1.N.C1 then
+    raise Program_Error;
+  end if;
+
+  if A2.I /= B2.I or A2.N.C1 /= B2.N.C1 then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/init13.ads
===================================================================
--- testsuite/gnat.dg/sso/init13.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init13.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,33 @@ 
+with Ada.Numerics; use Ada.Numerics;
+with System;
+
+package Init13 is
+
+  type Complex is record
+    R : Float;
+    I : Float;
+  end record;
+  pragma Complex_Representation (Complex);
+
+  type R1 is record
+    F : Complex;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    F at 0 range 0 .. 63;
+  end record;
+
+  type R2 is record
+    F : Complex;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    F at 0 range 0 .. 63;
+  end record;
+
+  My_R1 : constant R1 := (F => (Pi, -Pi));
+  My_R2 : constant R2 := (F => (Pi, -Pi));
+
+end Init13;
Index: testsuite/gnat.dg/sso/q9.adb
===================================================================
--- testsuite/gnat.dg/sso/q9.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/q9.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,53 @@ 
+-- { dg-do run }
+
+with Init9; use Init9;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure Q9 is
+
+  A1 : R1 := My_R1;
+  B1 : R1 := My_R1;
+
+  A2 : R2 := My_R2;
+  B2 : R2 := My_R2;
+
+begin
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 18 2d 44 54 fb 21 09 40\n" }
+
+  Put ("B1 :");
+  Dump (B1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B1 : 18 2d 44 54 fb 21 09 40\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 40 09 21 fb 54 44 2d 18\n" }
+
+  Put ("B2 :");
+  Dump (B2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "B2 : 40 09 21 fb 54 44 2d 18\n" }
+
+  if A1.F /= B1.F then
+    raise Program_Error;
+  end if;
+
+  if A1.F /= Pi then
+    raise Program_Error;
+  end if;
+
+  if A2.F /= B2.F then
+    raise Program_Error;
+  end if;
+
+  if A2.F /= Pi then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/u5.adb
===================================================================
--- testsuite/gnat.dg/sso/u5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/u5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init5; use Init5;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure U5 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+  C1 : Integer;
+  C2 : Integer;
+
+begin
+  Local_R1 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 01 00 00 00 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 00 00 00 01 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  C1 := Local_R1.A (Local_R1.I);
+  Put_Line ("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Local_R1.I := Local_R1.I + 1;  
+  C1 := Local_R1.A (Local_R1.I);
+  Put_Line ("C1 :" & C1'Img);
+  -- { dg-output "C1 : 13434932\n" }
+
+  C2 := Local_R2.A (Local_R2.I);
+  Put_Line ("C2 :" & C2'Img);
+  -- { dg-output "C2 : 11206674\n" }
+
+  Local_R2.I := Local_R2.I + 1;  
+  C2 := Local_R2.A (Local_R2.I);
+  Put_Line ("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+end;
Index: testsuite/gnat.dg/sso/u6.adb
===================================================================
--- testsuite/gnat.dg/sso/u6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/u6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+-- { dg-do run }
+
+with Init6; use Init6;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure U6 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+  C1 : Integer;
+  C2 : Integer;
+
+begin
+  Local_R1 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 01 00 00 00 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R2 := (I => 1, A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 00 00 00 01 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  C1 := Local_R1.A (Local_R1.I);
+  Put_Line ("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Local_R1.I := Local_R1.I + 1;  
+  C1 := Local_R1.A (Local_R1.I);
+  Put_Line ("C1 :" & C1'Img);
+  -- { dg-output "C1 : 13434932\n" }
+
+  C2 := Local_R2.A (Local_R2.I);
+  Put_Line ("C2 :" & C2'Img);
+  -- { dg-output "C2 : 11206674\n" }
+
+  Local_R2.I := Local_R2.I + 1;  
+  C2 := Local_R2.A (Local_R2.I);
+  Put_Line ("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+end;
Index: testsuite/gnat.dg/sso/r3.adb
===================================================================
--- testsuite/gnat.dg/sso/r3.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r3.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init3; use Init3;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R3 is
+
+  function Get_Elem (R : R1) return Integer is
+    Tmp : R1 := R;
+  begin
+    return Tmp.I;
+  end;
+
+  procedure Set_Elem (R : access R1; I : Integer) is
+    Tmp : R1 := R.all;
+  begin
+    Tmp.I := I;
+    R.all := Tmp;
+  end;
+
+  function Get_Elem (R : R2) return Integer is
+    Tmp : R2 := R;
+  begin
+    return Tmp.I;
+  end;
+
+  procedure Set_Elem (R : access R2; I : Integer) is
+    Tmp : R2 := R.all;
+  begin
+    Tmp.I := I;
+    R.all := Tmp;
+  end;
+
+  A1 : aliased R1 := My_R1;
+  A2 : aliased R2 := My_R2;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  --  { dg-output "A1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  if Get_Elem (A1) /= 16#12345678# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#12345678# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/r5.adb
===================================================================
--- testsuite/gnat.dg/sso/r5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init5; use Init5;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R5 is
+
+  function Get_Elem (R : R1) return Integer is
+    Tmp : R1 := R;
+  begin
+    return Tmp.A(1);
+  end;
+
+  procedure Set_Elem (R : access R1; I : Integer) is
+    Tmp : R1 := R.all;
+  begin
+    Tmp.A(1) := I;
+    R.all := Tmp;
+  end;
+
+  function Get_Elem (R : R2) return Integer is
+    Tmp : R2 := R;
+  begin
+    return Tmp.A(1);
+  end;
+
+  procedure Set_Elem (R : access R2; I : Integer) is
+    Tmp : R2 := R.all;
+  begin
+    Tmp.A(1) := I;
+    R.all := Tmp;
+  end;
+
+  A1 : aliased R1 := My_R1;
+  A2 : aliased R2 := My_R2;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  if Get_Elem (A1) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/r6.adb
===================================================================
--- testsuite/gnat.dg/sso/r6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init6; use Init6;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R6 is
+
+  function Get_Elem (R : R1) return Integer is
+    Tmp : R1 := R;
+  begin
+    return Tmp.A(1);
+  end;
+
+  procedure Set_Elem (R : access R1; I : Integer) is
+    Tmp : R1 := R.all;
+  begin
+    Tmp.A(1) := I;
+    R.all := Tmp;
+  end;
+
+  function Get_Elem (R : R2) return Integer is
+    Tmp : R2 := R;
+  begin
+    return Tmp.A(1);
+  end;
+
+  procedure Set_Elem (R : access R2; I : Integer) is
+    Tmp : R2 := R.all;
+  begin
+    Tmp.A(1) := I;
+    R.all := Tmp;
+  end;
+
+  A1 : aliased R1 := My_R1;
+  A2 : aliased R2 := My_R2;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  if Get_Elem (A1) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/r7.adb
===================================================================
--- testsuite/gnat.dg/sso/r7.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r7.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init7; use Init7;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R7 is
+
+  function Get_Elem (R : R1) return Integer is
+    Tmp : R1 := R;
+  begin
+    return Tmp.N.C1;
+  end;
+
+  procedure Set_Elem (R : access R1; I : Integer) is
+    Tmp : R1 := R.all;
+  begin
+    Tmp.N.C1 := I;
+    R.all := Tmp;
+  end;
+
+  function Get_Elem (R : R2) return Integer is
+    Tmp : R2 := R;
+  begin
+    return Tmp.N.C1;
+  end;
+
+  procedure Set_Elem (R : access R2; I : Integer) is
+    Tmp : R2 := R.all;
+  begin
+    Tmp.N.C1 := I;
+    R.all := Tmp;
+  end;
+
+  A1 : aliased R1 := My_R1;
+  A2 : aliased R2 := My_R2;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  if Get_Elem (A1) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/r8.adb
===================================================================
--- testsuite/gnat.dg/sso/r8.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r8.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init8; use Init8;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R8 is
+
+  function Get_Elem (R : R1) return Integer is
+    Tmp : R1 := R;
+  begin
+    return Tmp.N.C1;
+  end;
+
+  procedure Set_Elem (R : access R1; I : Integer) is
+    Tmp : R1 := R.all;
+  begin
+    Tmp.N.C1 := I;
+    R.all := Tmp;
+  end;
+
+  function Get_Elem (R : R2) return Integer is
+    Tmp : R2 := R;
+  begin
+    return Tmp.N.C1;
+  end;
+
+  procedure Set_Elem (R : access R2; I : Integer) is
+    Tmp : R2 := R.all;
+  begin
+    Tmp.N.C1 := I;
+    R.all := Tmp;
+  end;
+
+  A1 : aliased R1 := My_R1;
+  A2 : aliased R2 := My_R2;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  if Get_Elem (A1) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/p10.adb
===================================================================
--- testsuite/gnat.dg/sso/p10.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p10.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,63 @@ 
+-- { dg-do run }
+-- { dg-options "-gnatws" }
+
+with Init10; use Init10;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P10 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+
+  Local_R1.I := 16#12345678#;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2.I := 16#12345678#;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+
+  Local_R1.I := Local_R2.I;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2.I := Local_R1.I;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+end;
Index: testsuite/gnat.dg/sso/p11.adb
===================================================================
--- testsuite/gnat.dg/sso/p11.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p11.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init11; use Init11;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P11 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1.I    := Local_R2.I;
+  Local_R1.A(1) := Local_R2.A(1);
+  Local_R1.A(2) := Local_R2.A(2);
+  Local_R1.A(3) := Local_R2.A(3);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2.I    := Local_R1.I;
+  Local_R2.A(1) := Local_R1.A(1);
+  Local_R2.A(2) := Local_R1.A(2);
+  Local_R2.A(3) := Local_R1.A(3);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+end;
Index: testsuite/gnat.dg/sso/p12.adb
===================================================================
--- testsuite/gnat.dg/sso/p12.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p12.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,122 @@ 
+-- { dg-do run }
+
+with Init12; use Init12;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P12 is
+
+  Local_A1  : Arr1;
+  Local_A11 : Arr11;
+  Local_A2  : Arr2;
+  Local_A22 : Arr22;
+
+begin
+  Put ("My_A1     :");
+  Dump (My_A1'Address, Arr1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_A1     : 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("My_A11    :");
+  Dump (My_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_A11    : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Put ("My_A2     :");
+  Dump (My_A2'Address, Arr2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_A2     : 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("My_A22    :");
+  Dump (My_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_A22    : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  Local_A1 := My_A1;
+  Put ("Local_A1  :");
+  Dump (Local_A1'Address, Arr1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A1  : 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_A11 := My_A11;
+  Put ("Local_A11 :");
+  Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Local_A2 := My_A2;
+  Put ("Local_A2  :");
+  Dump (Local_A2'Address, Arr2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A2  : 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_A22 := My_A22;
+  Put ("Local_A22 :");
+  Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  Local_A1 := (16#AB0012#, 16#CD0034#, 16#EF0056#);
+  Put ("Local_A1  :");
+  Dump (Local_A1'Address, Arr1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A1  : 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_A11 := (1 => (16#AB0012#, 16#CD0034#),
+                2 => (16#AB0012#, 16#CD0034#));
+  Put ("Local_A11 :");
+  Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Local_A2 := (16#AB0012#, 16#CD0034#, 16#EF0056#);
+  Put ("Local_A2  :");
+  Dump (Local_A2'Address, Arr2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A2  : 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_A22 := (1 => (16#AB0012#, 16#CD0034#),
+                2 => (16#AB0012#, 16#CD0034#));
+  Put ("Local_A22 :");
+  Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  Local_A1(1) := Local_A2(1);
+  Local_A1(2) := Local_A2(2);
+  Local_A1(3) := Local_A2(3);
+
+  Put ("Local_A1  :");
+  Dump (Local_A1'Address, Arr1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A1  : 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_A11(1,1) := Local_A22(1,1);
+  Local_A11(1,2) := Local_A22(1,2);
+  Local_A11(2,1) := Local_A22(2,1);
+  Local_A11(2,2) := Local_A22(2,2);
+
+  Put ("Local_A11 :");
+  Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Local_A2(1) := Local_A1(1);
+  Local_A2(2) := Local_A1(2);
+  Local_A2(3) := Local_A1(3);
+
+  Put ("Local_A2  :");
+  Dump (Local_A2'Address, Arr2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A2  : 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_A22(1,1) := Local_A11(1,1);
+  Local_A22(1,2) := Local_A11(1,2);
+  Local_A22(2,1) := Local_A11(2,1);
+  Local_A22(2,2) := Local_A11(2,2);
+
+  Put ("Local_A22 :");
+  Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+end;
Index: testsuite/gnat.dg/sso/p13.adb
===================================================================
--- testsuite/gnat.dg/sso/p13.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p13.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,63 @@ 
+-- { dg-do run }
+
+with Init13; use Init13;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P13 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : db 0f 49 40 db 0f 49 c0\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 40 49 0f db c0 49 0f db\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" }
+
+  Local_R1.F := (Pi, -Pi);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" }
+
+  Local_R2.F := (Pi, -Pi);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" }
+
+  Local_R1.F := Local_R2.F;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" }
+
+  Local_R2.F := Local_R1.F;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" }
+end;
Index: testsuite/gnat.dg/sso/r11.adb
===================================================================
--- testsuite/gnat.dg/sso/r11.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r11.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init11; use Init11;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R11 is
+
+  function Get_Elem (R : R1) return My_Integer is
+    Tmp : R1 := R;
+  begin
+    return Tmp.A(1);
+  end;
+
+  procedure Set_Elem (R : access R1; I : My_Integer) is
+    Tmp : R1 := R.all;
+  begin
+    Tmp.A(1) := I;
+    R.all := Tmp;
+  end;
+
+  function Get_Elem (R : R2) return My_Integer is
+    Tmp : R2 := R;
+  begin
+    return Tmp.A(1);
+  end;
+
+  procedure Set_Elem (R : access R2; I : My_Integer) is
+    Tmp : R2 := R.all;
+  begin
+    Tmp.A(1) := I;
+    R.all := Tmp;
+  end;
+
+  A1 : aliased R1 := My_R1;
+  A2 : aliased R2 := My_R2;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  if Get_Elem (A1) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+end;
Index: testsuite/gnat.dg/sso/r12.adb
===================================================================
--- testsuite/gnat.dg/sso/r12.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/r12.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,123 @@ 
+-- { dg-do run }
+
+with Init12; use Init12;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure R12 is
+
+  function Get_Elem (A : Arr1) return Integer is
+    Tmp : Arr1 := A;
+  begin
+    return Tmp(1);
+  end;
+
+  procedure Set_Elem (A : access Arr1; I : Integer) is
+    Tmp : Arr1 := A.all;
+  begin
+    Tmp(1) := I;
+    A.all := Tmp;
+  end;
+
+  function Get_Elem (A : Arr11) return Integer is
+    Tmp : Arr11 := A;
+  begin
+    return Tmp(1,1);
+  end;
+
+  procedure Set_Elem (A : access Arr11; I : Integer) is
+    Tmp : Arr11 := A.all;
+  begin
+    Tmp(1,1) := I;
+    A.all := Tmp;
+  end;
+
+  function Get_Elem (A : Arr2) return Integer is
+    Tmp : Arr2 := A;
+  begin
+    return Tmp(1);
+  end;
+
+  procedure Set_Elem (A : access Arr2; I : Integer) is
+    Tmp : Arr2 := A.all;
+  begin
+    Tmp(1) := I;
+    A.all := Tmp;
+  end;
+
+  function Get_Elem (A : Arr22) return Integer is
+    Tmp : Arr22 := A;
+  begin
+    return Tmp(1,1);
+  end;
+
+  procedure Set_Elem (A : access Arr22; I : Integer) is
+    Tmp : Arr22 := A.all;
+  begin
+    Tmp(1,1) := I;
+    A.all := Tmp;
+  end;
+
+  A1  : aliased Arr1  := My_A1;
+  A11 : aliased Arr11 := My_A11;
+
+  A2  : aliased Arr2  := My_A2;
+  A22 : aliased Arr22 := My_A22;
+
+begin
+  Put ("A1  :");
+  Dump (A1'Address, Arr1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1  : 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A11 :");
+  Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\n" }
+
+  Put ("A2  :");
+  Dump (A2'Address, Arr2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2  : 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A22 :");
+  Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  if Get_Elem (A1) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A1'Access, 16#CD0034#);
+  if Get_Elem (A1) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A11) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A11'Access, 16#CD0034#);
+  if Get_Elem (A11) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A2) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A2'Access, 16#CD0034#);
+  if Get_Elem (A2) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+
+  if Get_Elem (A22) /= 16#AB0012# then
+    raise Program_Error;
+  end if;
+
+  Set_Elem (A22'Access, 16#CD0034#);
+  if Get_Elem (A22) /= 16#CD0034# then
+    raise Program_Error;
+  end if;
+end;
Index: testsuite/gnat.dg/sso/t10.adb
===================================================================
--- testsuite/gnat.dg/sso/t10.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t10.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+-- { dg-do run }
+-- { dg-options "-gnatws" }
+
+with Init10; use Init10;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T10 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I := My_R1.I + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12\n" }
+
+  Local_R2.I := My_R2.I + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79\n" }
+
+  Local_R1.I := 16#12345678#;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2.I := 16#12345678#;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+
+  Local_R1.I := Local_R1.I + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12\n" }
+
+  Local_R2.I := Local_R2.I + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79\n" }
+
+end;
Index: testsuite/gnat.dg/sso/init1.ads
===================================================================
--- testsuite/gnat.dg/sso/init1.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init1.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,26 @@ 
+with System;
+
+package Init1 is
+
+  type R1 is record
+    I : Integer;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    I at 0 range 0 .. 31;
+  end record;
+
+  type R2 is record
+    I : Integer;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    I at 0 range 0 .. 31;
+  end record;
+
+  My_R1 : constant R1 := (I => 16#12345678#);
+  My_R2 : constant R2 := (I => 16#12345678#);
+
+end Init1;
Index: testsuite/gnat.dg/sso/t11.adb
===================================================================
--- testsuite/gnat.dg/sso/t11.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t11.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,67 @@ 
+-- { dg-do run }
+
+with Init11; use Init11;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T11 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I    := My_R1.I + 1;
+  Local_R1.A(1) := My_R1.A(1) + 1;
+  Local_R1.A(2) := My_R1.A(2) + 1;
+  Local_R1.A(3) := My_R1.A(3) + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R2.I    := My_R2.I + 1;
+  Local_R2.A(1) := My_R2.A(1) + 1;
+  Local_R2.A(2) := My_R2.A(2) + 1;
+  Local_R2.A(3) := My_R2.A(3) + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+  Local_R1 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.A(1) := Local_R1.A(1) + 1;
+  Local_R1.A(2) := Local_R1.A(2) + 1;
+  Local_R1.A(3) := Local_R1.A(3) + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.A(1) := Local_R2.A(1) + 1;
+  Local_R2.A(2) := Local_R2.A(2) + 1;
+  Local_R2.A(3) := Local_R2.A(3) + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+end;
Index: testsuite/gnat.dg/sso/init2.ads
===================================================================
--- testsuite/gnat.dg/sso/init2.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init2.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,69 @@ 
+with System;
+
+package Init2 is
+
+  type Small is mod 2**2;
+  for Small'Size use 2;
+
+  type Count is mod 2**9;
+  for Count'Size use 9;
+
+  type Arr1 is array (1 .. 3) of Count;
+  pragma Pack (Arr1);
+  for Arr1'Size use 27;
+  for Arr1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type R1 is record
+    S1 : Small;
+    I  : Integer;
+    S2 : Small;
+    A  : Arr1;
+    B  : Boolean;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    S1 at 0 range  0 ..  1;
+    I  at 0 range  2 .. 33;
+    S2 at 0 range 34 .. 35;
+    A  at 0 range 36 .. 62;
+    B  at 0 range 63 .. 63;
+  end record;
+  for R1'Size use 64;
+
+  type Arr2 is array (1 .. 3) of Count;
+  pragma Pack (Arr2);
+  for Arr2'Size use 27;
+  for Arr2'Scalar_Storage_Order use System.High_Order_First;
+
+  type R2 is record
+    S1 : Small;
+    I  : Integer;
+    S2 : Small;
+    A  : Arr2;
+    B  : Boolean;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    S1 at 0 range  0 ..  1;
+    I  at 0 range  2 .. 33;
+    S2 at 0 range 34 .. 35;
+    A  at 0 range 36 .. 62;
+    B  at 0 range 63 .. 63;
+  end record;
+  for R2'Size use 64;
+
+  My_R1 : constant R1 := (S1 => 2,
+                          I  => 16#12345678#,
+                          S2 => 1,
+                          A  => (16#AB#, 16#CD#, 16#EF#),
+                          B  => True);
+
+  My_R2 : constant R2 := (S1 => 2,
+                          I  => 16#12345678#,
+                          S2 => 1,
+                          A  => (16#AB#, 16#CD#, 16#EF#),
+                          B  => True);
+
+end Init2;
Index: testsuite/gnat.dg/sso/t12.adb
===================================================================
--- testsuite/gnat.dg/sso/t12.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t12.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,66 @@ 
+-- { dg-do run }
+-- 
+with Init12; use Init12;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T12 is
+
+  Local_A11 : Arr11;
+  Local_A22 : Arr22;
+
+begin
+  Local_A11(1,1) := My_A11(1,1) + 1;
+  Local_A11(1,2) := My_A11(1,2) + 1;
+  Local_A11(2,1) := My_A11(2,1) + 1;
+  Local_A11(2,2) := My_A11(2,2) + 1;
+
+  Put ("Local_A11 :");
+  Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A11 : 13 00 ab 00 35 00 cd 00 13 00 ab 00 35 00 cd 00\n" }
+
+  Local_A22(1,1) := My_A22(1,1) + 1;
+  Local_A22(1,2) := My_A22(1,2) + 1;
+  Local_A22(2,1) := My_A22(2,1) + 1;
+  Local_A22(2,2) := My_A22(2,2) + 1;
+
+  Put ("Local_A22 :");
+  Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A22 : 00 ab 00 13 00 cd 00 35 00 ab 00 13 00 cd 00 35\n" }
+
+  Local_A11 := (1 => (16#AB0012#, 16#CD0034#),
+                2 => (16#AB0012#, 16#CD0034#));
+  Put ("Local_A11 :");
+  Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00\\n" }
+
+  Local_A22 := (1 => (16#AB0012#, 16#CD0034#),
+                2 => (16#AB0012#, 16#CD0034#));
+  Put ("Local_A22 :");
+  Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34\n" }
+
+  Local_A11(1,1) := Local_A11(1,1) + 1;
+  Local_A11(1,2) := Local_A11(1,2) + 1;
+  Local_A11(2,1) := Local_A11(2,1) + 1;
+  Local_A11(2,2) := Local_A11(2,2) + 1;
+
+  Put ("Local_A11 :");
+  Dump (Local_A11'Address, Arr11'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A11 : 13 00 ab 00 35 00 cd 00 13 00 ab 00 35 00 cd 00\n" }
+
+  Local_A22(1,1) := Local_A22(1,1) + 1;
+  Local_A22(1,2) := Local_A22(1,2) + 1;
+  Local_A22(2,1) := Local_A22(2,1) + 1;
+  Local_A22(2,2) := Local_A22(2,2) + 1;
+
+  Put ("Local_A22 :");
+  Dump (Local_A22'Address, Arr22'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_A22 : 00 ab 00 13 00 cd 00 35 00 ab 00 13 00 cd 00 35\n" }
+end;
Index: testsuite/gnat.dg/sso/init3.ads
===================================================================
--- testsuite/gnat.dg/sso/init3.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init3.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,78 @@ 
+with System;
+
+package Init3 is
+
+  type Small is mod 2**2;
+  for Small'Size use 2;
+
+  type Count is mod 2**9;
+  for Count'Size use 9;
+
+  type Nested1 is record
+    C1 : Count;
+    C2 : Count;
+    C3 : Count;
+  end record;
+  pragma Pack (Nested1);
+  for Nested1'Size use 27;
+  for Nested1'Bit_Order use System.Low_Order_First;
+  for Nested1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type R1 is record
+    S1 : Small;
+    I  : Integer;
+    S2 : Small;
+    N  : Nested1;
+    B  : Boolean;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    S1 at 0 range  0 ..  1;
+    I  at 0 range  2 .. 33;
+    S2 at 0 range 34 .. 35;
+    N  at 0 range 36 .. 62;
+    B  at 0 range 63 .. 63;
+  end record;
+  for R1'Size use 64;
+
+  type Nested2 is record
+    C1 : Count;
+    C2 : Count;
+    C3 : Count;
+  end record;
+  pragma Pack (Nested2);
+  for Nested2'Size use 27;
+  for Nested2'Bit_Order use System.High_Order_First;
+  for Nested2'Scalar_Storage_Order use System.High_Order_First;
+  type R2 is record
+    S1 : Small;
+    I  : Integer;
+    S2 : Small;
+    N  : Nested2;
+    B  : Boolean;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    S1 at 0 range  0 ..  1;
+    I  at 0 range  2 .. 33;
+    S2 at 0 range 34 .. 35;
+    N  at 0 range 36 .. 62;
+    B  at 0 range 63 .. 63;
+  end record;
+  for R2'Size use 64;
+
+  My_R1 : constant R1 := (S1 => 2,
+                          I  => 16#12345678#,
+                          S2 => 1,
+                          N  => (16#AB#, 16#CD#, 16#EF#),
+                          B  => True);
+
+  My_R2 : constant R2 := (S1 => 2,
+                          I  => 16#12345678#,
+                          S2 => 1,
+                          N  => (16#AB#, 16#CD#, 16#EF#),
+                          B  => True);
+
+end Init3;
Index: testsuite/gnat.dg/sso/t13.adb
===================================================================
--- testsuite/gnat.dg/sso/t13.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t13.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+-- { dg-do run }
+
+with Init13; use Init13;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T13 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.F := (My_R1.F.R + 1.0, My_R1.F.I + 1.0);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : ee 87 84 40 db 0f 09 c0\n" }
+
+  Local_R2.F := (My_R2.F.R + 1.0, My_R2.F.I + 1.0);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 84 87 ee c0 09 0f db\n" }
+
+  Local_R1.F := (Pi, -Pi);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" }
+
+  Local_R2.F := (Pi, -Pi);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" }
+
+  Local_R1.F := (Local_R1.F.R + 1.0, Local_R1.F.I + 1.0);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : ee 87 84 40 db 0f 09 c0\n" }
+
+  Local_R2.F := (Local_R2.F.R + 1.0, Local_R2.F.I + 1.0);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 84 87 ee c0 09 0f db\n" }
+
+end;
Index: testsuite/gnat.dg/sso/init4.ads
===================================================================
--- testsuite/gnat.dg/sso/init4.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init4.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,27 @@ 
+with Ada.Numerics; use Ada.Numerics;
+with System;
+
+package Init4 is
+
+  type R1 is record
+    F : Float;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    F at 0 range 0 .. 31;
+  end record;
+
+  type R2 is record
+    F : Float;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    F at 0 range 0 .. 31;
+  end record;
+
+  My_R1 : constant R1 := (F => Pi);
+  My_R2 : constant R2 := (F => Pi);
+
+end Init4;
Index: testsuite/gnat.dg/sso/init5.ads
===================================================================
--- testsuite/gnat.dg/sso/init5.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init5.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,39 @@ 
+with System;
+
+package Init5 is
+
+  type Arr1 is array (1 .. 3) of Integer;
+  for Arr1'Scalar_Storage_Order use System.Low_Order_First;
+
+  type R1 is record
+    I : Integer;
+    A : Arr1;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    I at 0 range 0 .. 31;
+    A at 4 range 0 .. 95;
+  end record;
+
+  type Arr2 is array (1 .. 3) of Integer;
+  for Arr2'Scalar_Storage_Order use System.High_Order_First;
+
+  type R2 is record
+    I : Integer;
+    A : Arr2;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    I at 0 range 0 .. 31;
+    A at 4 range 0 .. 95;
+  end record;
+
+  My_R1 : constant R1 := (I => 16#12345678#,
+                          A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+  My_R2 : constant R2 := (I => 16#12345678#,
+                          A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+end Init5;
Index: testsuite/gnat.dg/sso/init6.ads
===================================================================
--- testsuite/gnat.dg/sso/init6.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init6.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,39 @@ 
+with System;
+
+package Init6 is
+
+  type Arr1 is array (1 .. 3) of Integer;
+  for Arr1'Scalar_Storage_Order use System.High_Order_First;
+
+  type R1 is record
+    I : Integer;
+    A : Arr1;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    I at 0 range 0 .. 31;
+    A at 4 range 0 .. 95;
+  end record;
+
+  type Arr2 is array (1 .. 3) of Integer;
+  for Arr2'Scalar_Storage_Order use System.Low_Order_First;
+
+  type R2 is record
+    I : Integer;
+    A : Arr2;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    I at 0 range 0 .. 31;
+    A at 4 range 0 .. 95;
+  end record;
+
+  My_R1 : constant R1 := (I => 16#12345678#,
+                          A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+  My_R2 : constant R2 := (I => 16#12345678#,
+                          A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+end Init6;
Index: testsuite/gnat.dg/sso/init7.ads
===================================================================
--- testsuite/gnat.dg/sso/init7.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init7.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,59 @@ 
+with System;
+
+package Init7 is
+
+  type Nested1 is record
+    C1 : Integer;
+    C2 : Integer;
+    C3 : Integer;
+  end record;
+  for Nested1'Bit_Order use System.Low_Order_First;
+  for Nested1'Scalar_Storage_Order use System.Low_Order_First;
+  for Nested1 use record
+    C1 at 0 range 0 .. 31;
+    C2 at 4 range 0 .. 31;
+    C3 at 8 range 0 .. 31;
+  end record;
+
+  type R1 is record
+    I : Integer;
+    N : Nested1;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    I at 0 range 0 .. 31;
+    N at 4 range 0 .. 95;
+  end record;
+
+  type Nested2 is record
+    C1 : Integer;
+    C2 : Integer;
+    C3 : Integer;
+  end record;
+  for Nested2'Bit_Order use System.High_Order_First;
+  for Nested2'Scalar_Storage_Order use System.High_Order_First;
+  for Nested2 use record
+    C1 at 0 range 0 .. 31;
+    C2 at 4 range 0 .. 31;
+    C3 at 8 range 0 .. 31;
+  end record;
+
+  type R2 is record
+    I : Integer;
+    N : Nested2;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    I at 0 range 0 .. 31;
+    N at 4 range 0 .. 95;
+  end record;
+
+  My_R1 : constant R1 := (I => 16#12345678#,
+                          N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+  My_R2 : constant R2 := (I => 16#12345678#,
+                          N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+end Init7;
Index: testsuite/gnat.dg/sso/init8.ads
===================================================================
--- testsuite/gnat.dg/sso/init8.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init8.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,59 @@ 
+with System;
+
+package Init8 is
+
+  type Nested1 is record
+    C1 : Integer;
+    C2 : Integer;
+    C3 : Integer;
+  end record;
+  for Nested1'Bit_Order use System.High_Order_First;
+  for Nested1'Scalar_Storage_Order use System.High_Order_First;
+  for Nested1 use record
+    C1 at 0 range 0 .. 31;
+    C2 at 4 range 0 .. 31;
+    C3 at 8 range 0 .. 31;
+  end record;
+
+  type R1 is record
+    I : Integer;
+    N : Nested1;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    I at 0 range 0 .. 31;
+    N at 4 range 0 .. 95;
+  end record;
+
+  type Nested2 is record
+    C1 : Integer;
+    C2 : Integer;
+    C3 : Integer;
+  end record;
+  for Nested2'Bit_Order use System.Low_Order_First;
+  for Nested2'Scalar_Storage_Order use System.Low_Order_First;
+  for Nested2 use record
+    C1 at 0 range 0 .. 31;
+    C2 at 4 range 0 .. 31;
+    C3 at 8 range 0 .. 31;
+  end record;
+
+  type R2 is record
+    I : Integer;
+    N : Nested2;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    I at 0 range 0 .. 31;
+    N at 4 range 0 .. 95;
+  end record;
+
+  My_R1 : constant R1 := (I => 16#12345678#,
+                          N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+  My_R2 : constant R2 := (I => 16#12345678#,
+                          N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+
+end Init8;
Index: testsuite/gnat.dg/sso/init9.ads
===================================================================
--- testsuite/gnat.dg/sso/init9.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/init9.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,27 @@ 
+with Ada.Numerics; use Ada.Numerics;
+with System;
+
+package Init9 is
+
+  type R1 is record
+    F : Long_Float;
+  end record;
+  for R1'Bit_Order use System.Low_Order_First;
+  for R1'Scalar_Storage_Order use System.Low_Order_First;
+  for R1 use record
+    F at 0 range 0 .. 63;
+  end record;
+
+  type R2 is record
+    F : Long_Float;
+  end record;
+  for R2'Bit_Order use System.High_Order_First;
+  for R2'Scalar_Storage_Order use System.High_Order_First;
+  for R2 use record
+    F at 0 range 0 .. 63;
+  end record;
+
+  My_R1 : constant R1 := (F => Pi);
+  My_R2 : constant R2 := (F => Pi);
+
+end Init9;
Index: testsuite/gnat.dg/sso/s3.adb
===================================================================
--- testsuite/gnat.dg/sso/s3.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s3.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+-- { dg-do run }
+
+with Init3; use Init3;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S3 is
+
+  A1 : R1 := My_R1;
+  A2 : R2 := My_R2;
+
+  N1 : Nested1;
+  N2 : Nested2;
+
+  C1 : Init3.Count;
+  C2 : Init3.Count;
+  C3 : Init3.Count;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  N1 := A1.N;
+  C1 := N1.C1;
+  C2 := N1.C2;
+  C3 := N1.C3;
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 171\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 205\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 239\n" }
+
+  N1.C1 := C1;
+  N1.C2 := C2;
+  N1.C3 := C3;
+  A1.N := N1;
+
+  N2 := A2.N;
+  C1 := N2.C1;
+  C2 := N2.C2;
+  C3 := N2.C3;
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 171\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 205\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 239\n" }
+
+  N2.C1 := C1;
+  N2.C2 := C2;
+  N2.C3 := C3;
+  A2.N := N2;
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+end;
Index: testsuite/gnat.dg/sso/s5.adb
===================================================================
--- testsuite/gnat.dg/sso/s5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,78 @@ 
+-- { dg-do run }
+
+with Init5; use Init5;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S5 is
+
+  A1 : R1 := My_R1;
+  A2 : R2 := My_R2;
+
+  AA1 : Arr1;
+  AA2 : Arr2;
+
+  C1 : Integer;
+  C2 : Integer;
+  C3 : Integer;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  AA1 := A1.A;
+  C1 := AA1(1);
+  C2 := AA1(2);
+  C3 := AA1(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  AA1(1) := C1;
+  AA1(2) := C2;
+  AA1(3) := C3;
+  A1.A := AA1;
+
+  AA2 := A2.A;
+  C1 := AA2(1);
+  C2 := AA2(2);
+  C3 := AA2(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  AA2(1) := C1;
+  AA2(2) := C2;
+  AA2(3) := C3;
+  A2.A := AA2;
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+end;
Index: testsuite/gnat.dg/sso/s6.adb
===================================================================
--- testsuite/gnat.dg/sso/s6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+-- { dg-do run }
+
+with Init6; use Init6;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S6 is
+
+  A1 : R1 := My_R1;
+  A2 : R2 := My_R2;
+
+  AA1 : Arr1;
+  AA2 : Arr2;
+
+  C1 : Integer;
+  C2 : Integer;
+  C3 : Integer;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  AA1 := A1.A;
+  C1 := AA1(1);
+  C2 := AA1(2);
+  C3 := AA1(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  AA1(1) := C1;
+  AA1(2) := C2;
+  AA1(3) := C3;
+  A1.A := AA1;
+
+  AA2 := A2.A;
+  C1 := AA2(1);
+  C2 := AA2(2);
+  C3 := AA2(3);
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  AA2(1) := C1;
+  AA2(2) := C2;
+  AA2(3) := C3;
+  A2.A := AA2;
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+end;
Index: testsuite/gnat.dg/sso/s7.adb
===================================================================
--- testsuite/gnat.dg/sso/s7.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s7.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+-- { dg-do run }
+
+with Init7; use Init7;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S7 is
+
+  A1 : R1 := My_R1;
+  A2 : R2 := My_R2;
+
+  N1 : Nested1;
+  N2 : Nested2;
+
+  C1 : Integer;
+  C2 : Integer;
+  C3 : Integer;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  N1 := A1.N;
+  C1 := N1.C1;
+  C2 := N1.C2;
+  C3 := N1.C3;
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  N1.C1 := C1;
+  N1.C2 := C2;
+  N1.C3 := C3;
+  A1.N := N1;
+
+  N2 := A2.N;
+  C1 := N2.C1;
+  C2 := N2.C2;
+  C3 := N2.C3;
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  N2.C1 := C1;
+  N2.C2 := C2;
+  N2.C3 := C3;
+  A2.N := N2;
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+end;
Index: testsuite/gnat.dg/sso/s8.adb
===================================================================
--- testsuite/gnat.dg/sso/s8.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/s8.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+-- { dg-do run }
+
+with Init8; use Init8;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure S8 is
+
+  A1 : R1 := My_R1;
+  A2 : R2 := My_R2;
+
+  N1 : Nested1;
+  N2 : Nested2;
+
+  C1 : Integer;
+  C2 : Integer;
+  C3 : Integer;
+
+begin
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  N1 := A1.N;
+  C1 := N1.C1;
+  C2 := N1.C2;
+  C3 := N1.C3;
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  N1.C1 := C1;
+  N1.C2 := C2;
+  N1.C3 := C3;
+  A1.N := N1;
+
+  N2 := A2.N;
+  C1 := N2.C1;
+  C2 := N2.C2;
+  C3 := N2.C3;
+
+  Put_Line("C1 :" & C1'Img);
+  -- { dg-output "C1 : 11206674\n" }
+
+  Put_Line("C2 :" & C2'Img);
+  -- { dg-output "C2 : 13434932\n" }
+
+  Put_Line("C3 :" & C3'Img);
+  -- { dg-output "C3 : 15663190\n" }
+
+  N2.C1 := C1;
+  N2.C2 := C2;
+  N2.C3 := C3;
+  A2.N := N2;
+
+  Put ("A1 :");
+  Dump (A1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Put ("A2 :");
+  Dump (A2'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+end;
Index: testsuite/gnat.dg/sso/dump.adb
===================================================================
--- testsuite/gnat.dg/sso/dump.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/dump.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,17 @@ 
+-- { dg-do compile }
+
+with Text_IO; use Text_IO;
+
+procedure Dump (A : System.Address; Len : Storage_Offset) is
+
+   Arr : Storage_Array (1 .. Len);
+   for Arr'Address use A;
+   pragma Import (Ada, Arr);
+
+   H : constant array (Storage_Element range 0 .. 15) of Character :=
+         "0123456789abcdef";
+begin
+   for J in Arr'Range loop
+      Put (' ' & H (Arr (J) / 16) & H (Arr (J) mod 16));
+   end loop;
+end;
Index: testsuite/gnat.dg/sso/sso.exp
===================================================================
--- testsuite/gnat.dg/sso/sso.exp	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/sso.exp	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,40 @@ 
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Load support procs.
+load_lib gnat-dg.exp
+load_lib torture-options.exp
+
+# Initialize `dg'.
+torture-init
+dg-init
+
+set SSO_TORTURE_OPTIONS [list \
+	{ -O0 } \
+	{ -O1 -fno-inline } \
+	{ -O2 } \
+	{ -O3 -finline-functions } \
+	{ -Os } \
+	{ -Og -g } ]
+
+set-torture-options $SSO_TORTURE_OPTIONS
+
+# Main loop.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.adb]] "" ""
+
+# All done.
+dg-finish
+torture-finish
Index: testsuite/gnat.dg/sso/p1.adb
===================================================================
--- testsuite/gnat.dg/sso/p1.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p1.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,62 @@ 
+-- { dg-do run }
+
+with Init1; use Init1;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P1 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+
+  Local_R1.I := 16#12345678#;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2.I := 16#12345678#;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+
+  Local_R1.I := Local_R2.I;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2.I := Local_R1.I;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+end;
Index: testsuite/gnat.dg/sso/p2.adb
===================================================================
--- testsuite/gnat.dg/sso/p2.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p2.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,80 @@ 
+-- { dg-do run }
+
+with Init2; use Init2;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P2 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               A  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               A  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1.S1   := Local_R2.S1;
+  Local_R1.I    := Local_R2.I;
+  Local_R1.S2   := Local_R2.S2;
+  Local_R1.A(1) := Local_R2.A(1);
+  Local_R1.A(2) := Local_R2.A(2);
+  Local_R1.A(3) := Local_R2.A(3);
+  Local_R1.B    := Local_R2.B;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2.S1   := Local_R1.S1;
+  Local_R2.I    := Local_R1.I;
+  Local_R2.S2   := Local_R1.S2;
+  Local_R2.A(1) := Local_R1.A(1);
+  Local_R2.A(2) := Local_R1.A(2);
+  Local_R2.A(3) := Local_R1.A(3);
+  Local_R2.B    := Local_R1.B;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+end;
Index: testsuite/gnat.dg/sso/p3.adb
===================================================================
--- testsuite/gnat.dg/sso/p3.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p3.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,80 @@ 
+-- { dg-do run }
+
+with Init3; use Init3;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P3 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               N  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               N  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1.S1   := Local_R2.S1;
+  Local_R1.I    := Local_R2.I;
+  Local_R1.S2   := Local_R2.S2;
+  Local_R1.N.C1 := Local_R2.N.C1;
+  Local_R1.N.C2 := Local_R2.N.C2;
+  Local_R1.N.C3 := Local_R2.N.C3;
+  Local_R1.B    := Local_R2.B;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2.S1   := Local_R1.S1;
+  Local_R2.I    := Local_R1.I;
+  Local_R2.S2   := Local_R1.S2;
+  Local_R2.N.C1 := Local_R1.N.C1;
+  Local_R2.N.C2 := Local_R1.N.C2;
+  Local_R2.N.C3 := Local_R1.N.C3;
+  Local_R2.B    := Local_R1.B;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+end;
Index: testsuite/gnat.dg/sso/p4.adb
===================================================================
--- testsuite/gnat.dg/sso/p4.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p4.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,63 @@ 
+-- { dg-do run }
+
+with Init4; use Init4;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P4 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : db 0f 49 40\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 40 49 0f db\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db\n" }
+
+  Local_R1.F := Pi;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40\n" }
+
+  Local_R2.F := Pi;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db\n" }
+
+  Local_R1.F := Local_R2.F;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40\n" }
+
+  Local_R2.F := Local_R1.F;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db\n" }
+end;
Index: testsuite/gnat.dg/sso/p5.adb
===================================================================
--- testsuite/gnat.dg/sso/p5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,68 @@ 
+-- { dg-do run }
+
+with Init5; use Init5;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P5 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1.I    := Local_R2.I;
+  Local_R1.A(1) := Local_R2.A(1);
+  Local_R1.A(2) := Local_R2.A(2);
+  Local_R1.A(3) := Local_R2.A(3);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2.I    := Local_R1.I;
+  Local_R2.A(1) := Local_R1.A(1);
+  Local_R2.A(2) := Local_R1.A(2);
+  Local_R2.A(3) := Local_R1.A(3);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+end;
Index: testsuite/gnat.dg/sso/t1.adb
===================================================================
--- testsuite/gnat.dg/sso/t1.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t1.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,55 @@ 
+-- { dg-do run }
+
+with Init1; use Init1;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T1 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I := My_R1.I + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12\n" }
+
+  Local_R2.I := My_R2.I + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79\n" }
+
+  Local_R1.I := 16#12345678#;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12\n" }
+
+  Local_R2.I := 16#12345678#;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78\n" }
+
+  Local_R1.I := Local_R1.I + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12\n" }
+
+  Local_R2.I := Local_R2.I + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79\n" }
+
+end;
Index: testsuite/gnat.dg/sso/t2.adb
===================================================================
--- testsuite/gnat.dg/sso/t2.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t2.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,84 @@ 
+-- { dg-do run }
+
+with Init2; use Init2;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T2 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.S1 := My_R1.S1 - 1;
+  Local_R1.I := My_R1.I + 1;
+  Local_R1.S2 := My_R1.S2 - 1;
+  Local_R1.A(1) := My_R1.A(1) mod 16;
+  Local_R1.A(2) := My_R1.A(2) mod 16;
+  Local_R1.A(3) := My_R1.A(3) mod 16;
+  Local_R1.B := not My_R1.B;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e5 59 d1 48 b0 a0 c1 03\n" }
+
+  Local_R2.S1 := My_R2.S1 - 1;
+  Local_R2.I := My_R2.I + 1;
+  Local_R2.S2 := My_R2.S2 - 1;
+  Local_R2.A(1) := My_R2.A(1) mod 16;
+  Local_R2.A(2) := My_R2.A(2) mod 16;
+  Local_R2.A(3) := My_R2.A(3) mod 16;
+  Local_R2.B := not My_R2.B;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 44 8d 15 9e 40 58 34 1e\n" }
+
+  Local_R1 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               A  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               A  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1.S1   := Local_R1.S1 - 1;
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.S2   := Local_R1.S2 - 1;
+  Local_R1.A(1) := Local_R1.A(1) mod 16;
+  Local_R1.A(2) := Local_R1.A(2) mod 16;
+  Local_R1.A(3) := Local_R1.A(3) mod 16;
+  Local_R1.B    := not Local_R1.B;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e5 59 d1 48 b0 a0 c1 03\n" }
+
+  Local_R2.S1   := Local_R2.S1 - 1;
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.S2   := Local_R2.S2 - 1;
+  Local_R2.A(1) := Local_R2.A(1) mod 16;
+  Local_R2.A(2) := Local_R2.A(2) mod 16;
+  Local_R2.A(3) := Local_R2.A(3) mod 16;
+  Local_R2.B    := not Local_R2.B;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 44 8d 15 9e 40 58 34 1e\n" }
+end;
Index: testsuite/gnat.dg/sso/p6.adb
===================================================================
--- testsuite/gnat.dg/sso/p6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,61 @@ 
+-- { dg-do run }
+
+with Init6; use Init6;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P6 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R1 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R2 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R1.I    := Local_R2.I;
+  Local_R1.A(1) := Local_R2.A(1);
+  Local_R1.A(2) := Local_R2.A(2);
+  Local_R1.A(3) := Local_R2.A(3);
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R2.I    := Local_R1.I;
+  Local_R2.A(1) := Local_R1.A(1);
+  Local_R2.A(2) := Local_R1.A(2);
+  Local_R2.A(3) := Local_R1.A(3);
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+end;
Index: testsuite/gnat.dg/sso/t3.adb
===================================================================
--- testsuite/gnat.dg/sso/t3.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t3.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,84 @@ 
+-- { dg-do run }
+
+with Init3; use Init3;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T3 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.S1   := My_R1.S1 - 1;
+  Local_R1.I    := My_R1.I + 1;
+  Local_R1.S2   := My_R1.S2 - 1;
+  Local_R1.N.C1 := My_R1.N.C1 mod 16;
+  Local_R1.N.C2 := My_R1.N.C2 mod 16;
+  Local_R1.N.C3 := My_R1.N.C3 mod 16;
+  Local_R1.B    := not My_R1.B;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e5 59 d1 48 b0 a0 c1 03\n" }
+
+  Local_R2.S1   := My_R2.S1 - 1;
+  Local_R2.I    := My_R2.I + 1;
+  Local_R2.S2   := My_R2.S2 - 1;
+  Local_R2.N.C1 := My_R2.N.C1 mod 16;
+  Local_R2.N.C2 := My_R2.N.C2 mod 16;
+  Local_R2.N.C3 := My_R2.N.C3 mod 16;
+  Local_R2.B    := not My_R2.B;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 44 8d 15 9e 40 58 34 1e\n" }
+
+  Local_R1 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               N  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" }
+
+  Local_R2 := (S1 => 2,
+               I  => 16#12345678#,
+               S2 => 1,
+               N  => (16#AB#, 16#CD#, 16#EF#),
+               B  => True);
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" }
+
+  Local_R1.S1   := Local_R1.S1 - 1;
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.S2   := Local_R1.S2 - 1;
+  Local_R1.N.C1 := Local_R1.N.C1 mod 16;
+  Local_R1.N.C2 := Local_R1.N.C2 mod 16;
+  Local_R1.N.C3 := Local_R1.N.C3 mod 16;
+  Local_R1.B    := not Local_R1.B;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : e5 59 d1 48 b0 a0 c1 03\n" }
+
+  Local_R2.S1   := Local_R2.S1 - 1;
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.S2   := Local_R2.S2 - 1;
+  Local_R2.N.C1 := Local_R2.N.C1 mod 16;
+  Local_R2.N.C2 := Local_R2.N.C2 mod 16;
+  Local_R2.N.C3 := Local_R2.N.C3 mod 16;
+  Local_R2.B    := not Local_R2.B;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 44 8d 15 9e 40 58 34 1e\n" }
+end;
Index: testsuite/gnat.dg/sso/dump.ads
===================================================================
--- testsuite/gnat.dg/sso/dump.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/dump.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,3 @@ 
+with System.Storage_Elements; use System.Storage_Elements;
+
+procedure Dump (A : System.Address; Len : Storage_Offset);
Index: testsuite/gnat.dg/sso/p7.adb
===================================================================
--- testsuite/gnat.dg/sso/p7.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p7.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,61 @@ 
+-- { dg-do run }
+
+with Init7; use Init7;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P7 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R1 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R2 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R1.I    := Local_R2.I;
+  Local_R1.N.C1 := Local_R2.N.C1;
+  Local_R1.N.C2 := Local_R2.N.C2;
+  Local_R1.N.C3 := Local_R2.N.C3;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R2.I    := Local_R1.I;
+  Local_R2.N.C1 := Local_R1.N.C1;
+  Local_R2.N.C2 := Local_R1.N.C2;
+  Local_R2.N.C3 := Local_R1.N.C3;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+end;
Index: testsuite/gnat.dg/sso/p8.adb
===================================================================
--- testsuite/gnat.dg/sso/p8.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p8.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,61 @@ 
+-- { dg-do run }
+
+with Init8; use Init8;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P8 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R1 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R2 := (I => 16#12345678#,
+               N => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+  Local_R1.I    := Local_R2.I;
+  Local_R1.N.C1 := Local_R2.N.C1;
+  Local_R1.N.C2 := Local_R2.N.C2;
+  Local_R1.N.C3 := Local_R2.N.C3;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+  Local_R2.I    := Local_R1.I;
+  Local_R2.N.C1 := Local_R1.N.C1;
+  Local_R2.N.C2 := Local_R1.N.C2;
+  Local_R2.N.C3 := Local_R1.N.C3;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+end;
Index: testsuite/gnat.dg/sso/t4.adb
===================================================================
--- testsuite/gnat.dg/sso/t4.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t4.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+-- { dg-do run }
+
+with Init4; use Init4;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T4 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.F := My_R1.F + 1.0;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : ee 87 84 40\n" }
+
+  Local_R2.F := My_R2.F + 1.0;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 84 87 ee\n" }
+
+  Local_R1.F := Pi;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : db 0f 49 40\n" }
+
+  Local_R2.F := Pi;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 49 0f db\n" }
+
+  Local_R1.F := Local_R1.F + 1.0;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : ee 87 84 40\n" }
+
+  Local_R2.F := Local_R2.F + 1.0;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 84 87 ee\n" }
+
+end;
Index: testsuite/gnat.dg/sso/p9.adb
===================================================================
--- testsuite/gnat.dg/sso/p9.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/p9.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,63 @@ 
+-- { dg-do run }
+
+with Init9; use Init9;
+with Ada.Numerics; use Ada.Numerics;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure P9 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Put ("My_R1    :");
+  Dump (My_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R1    : 18 2d 44 54 fb 21 09 40\n" }
+
+  Put ("My_R2    :");
+  Dump (My_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "My_R2    : 40 09 21 fb 54 44 2d 18\n" }
+
+  Local_R1 := My_R1;
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" }
+
+  Local_R2 := My_R2;
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" }
+
+  Local_R1.F := Pi;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" }
+
+  Local_R2.F := Pi;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" }
+
+  Local_R1.F := Local_R2.F;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" }
+
+  Local_R2.F := Local_R1.F;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" }
+end;
Index: testsuite/gnat.dg/sso/t5.adb
===================================================================
--- testsuite/gnat.dg/sso/t5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,67 @@ 
+-- { dg-do run }
+
+with Init5; use Init5;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T5 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I    := My_R1.I + 1;
+  Local_R1.A(1) := My_R1.A(1) + 1;
+  Local_R1.A(2) := My_R1.A(2) + 1;
+  Local_R1.A(3) := My_R1.A(3) + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R2.I    := My_R2.I + 1;
+  Local_R2.A(1) := My_R2.A(1) + 1;
+  Local_R2.A(2) := My_R2.A(2) + 1;
+  Local_R2.A(3) := My_R2.A(3) + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+  Local_R1 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.A(1) := Local_R1.A(1) + 1;
+  Local_R1.A(2) := Local_R1.A(2) + 1;
+  Local_R1.A(3) := Local_R1.A(3) + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.A(1) := Local_R2.A(1) + 1;
+  Local_R2.A(2) := Local_R2.A(2) + 1;
+  Local_R2.A(3) := Local_R2.A(3) + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+end;
Index: testsuite/gnat.dg/sso/t6.adb
===================================================================
--- testsuite/gnat.dg/sso/t6.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso/t6.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,67 @@ 
+-- { dg-do run }
+
+with Init6; use Init6;
+with Text_IO; use Text_IO;
+with Dump;
+
+procedure T6 is
+
+  Local_R1 : R1;
+  Local_R2 : R2;
+
+begin
+  Local_R1.I    := My_R1.I + 1;
+  Local_R1.A(1) := My_R1.A(1) + 1;
+  Local_R1.A(2) := My_R1.A(2) + 1;
+  Local_R1.A(3) := My_R1.A(3) + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+  Local_R2.I    := My_R2.I + 1;
+  Local_R2.A(1) := My_R2.A(1) + 1;
+  Local_R2.A(2) := My_R2.A(2) + 1;
+  Local_R2.A(3) := My_R2.A(3) + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+  Local_R1 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" }
+
+  Local_R2 := (I => 16#12345678#,
+               A => (16#AB0012#, 16#CD0034#, 16#EF0056#));
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" }
+
+  Local_R1.I    := Local_R1.I + 1;
+  Local_R1.A(1) := Local_R1.A(1) + 1;
+  Local_R1.A(2) := Local_R1.A(2) + 1;
+  Local_R1.A(3) := Local_R1.A(3) + 1;
+
+  Put ("Local_R1 :");
+  Dump (Local_R1'Address, R1'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" }
+
+  Local_R2.I    := Local_R2.I + 1;
+  Local_R2.A(1) := Local_R2.A(1) + 1;
+  Local_R2.A(2) := Local_R2.A(2) + 1;
+  Local_R2.A(3) := Local_R2.A(3) + 1;
+
+  Put ("Local_R2 :");
+  Dump (Local_R2'Address, R2'Max_Size_In_Storage_Elements);
+  New_Line;
+  -- { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" }
+
+end;
Index: testsuite/gnat.dg/sso7.adb
===================================================================
--- testsuite/gnat.dg/sso7.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso7.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,52 @@ 
+-- { dg-do run }
+
+with System;
+
+procedure SSO7 is
+
+   type Short_Int is mod 2**16;
+
+   type Rec1 is record
+      F1 : Short_Int;
+      F2 : Short_Int;
+   end record;
+   for Rec1 use record
+      F1 at 0 range  0 .. 15;
+      F2 at 0 range 16 .. 31;
+   end record;
+   for Rec1'Bit_Order use System.High_Order_First;
+   for Rec1'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec2 is record
+      R1 : Rec1;
+   end record;
+   for Rec2 use record
+      R1 at 0 range 0 .. 31;
+   end record;
+   for Rec2'Bit_Order use System.High_Order_First;
+   for Rec2'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec3 is record
+      Data : Rec1;
+   end record;
+   for Rec3 use record
+      Data at 0 range 1 .. 32;
+   end record;
+   for Rec3'Bit_Order use System.High_Order_First;
+   for Rec3'Scalar_Storage_Order use System.High_Order_First;
+
+   procedure Copy (Message : in Rec3) is
+      Local : Rec2;
+   begin
+      Local := (R1 => Message.Data);
+      if Local.R1 /= Message.Data then
+         raise Program_Error;
+      end if;
+   end;
+
+   Message : Rec3;
+
+begin
+   Message := (Data => (2, 3));
+   Copy(Message);
+end;
Index: testsuite/gnat.dg/sso1.adb
===================================================================
--- testsuite/gnat.dg/sso1.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso1.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,77 @@ 
+-- { dg-do run }
+
+with System;
+with Ada.Unchecked_Conversion;
+with Ada.Streams; use Ada.Streams;
+with Ada.Text_IO;
+
+procedure SSO1 is
+
+   type Unsigned_Integer_4 is mod 2 ** 32;
+   for Unsigned_Integer_4'Size use 32;
+
+   Default_Bit_Order_Pos : constant Natural := System.Bit_Order'Pos (System.Default_Bit_Order);
+
+   Opposite_Bit_Order_Pos : constant Natural := 1 - Default_Bit_Order_Pos;
+
+   Opposite_Bit_Order : constant System.Bit_Order := System.Bit_Order'Val (Opposite_Bit_Order_Pos);
+
+   type Rec is
+      record
+	 X, Y : Unsigned_Integer_4;
+      end record;
+   for Rec'Bit_Order use System.Default_Bit_Order;
+   for Rec'Scalar_Storage_Order use System.Default_Bit_Order;
+
+   for Rec use
+      record
+	 X at 0 * 4 range 0 .. 31;
+	 Y at 1 * 4 range 0 .. 31;
+      end record;
+   
+   type Nested_Rec is
+      record 
+	 I : Unsigned_Integer_4;
+	 R : Rec;
+	 J : Unsigned_Integer_4;
+      end record;
+   for Nested_Rec use
+      record
+	 I at 0 * 4 range 0 .. 31;
+	 R at 1 * 4 range 0 .. 63;
+	 J at 3 * 4 range 0 .. 31;
+	 end record;
+
+   for Nested_Rec'Bit_Order use Opposite_Bit_Order;
+   for Nested_Rec'Scalar_Storage_Order use Opposite_Bit_Order;
+
+   Nr : Nested_Rec 
+     := (I => 1,
+	 R => (X => 1,
+	       Y => 1),
+	 J => 1);
+   
+   subtype Nested_Rec_As_Stream is Ada.Streams.Stream_Element_Array (1 ..16);
+
+   function To_Stream is
+     new Ada.Unchecked_Conversion (Nested_Rec, Nested_Rec_As_Stream);
+
+   Nr_Stream : constant Nested_Rec_As_Stream := To_Stream (Nr);
+
+   Expected : constant array (System.Bit_Order) of Nested_Rec_As_Stream :=
+                (System.Low_Order_First =>
+                   (0, 0, 0, 1,
+                    1, 0, 0, 0,
+                    1, 0, 0, 0,
+                    0, 0, 0, 1),
+                 System.High_Order_First =>
+                   (1, 0, 0, 0,
+                    0, 0, 0, 1,
+                    0, 0, 0, 1,
+                    1, 0, 0, 0));
+
+begin
+   if Nr_Stream /= Expected (System.Default_Bit_Order) then
+      raise Program_Error;
+   end if;
+end;
Index: testsuite/gnat.dg/sso2.adb
===================================================================
--- testsuite/gnat.dg/sso2.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso2.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,14 @@ 
+-- { dg-do compile }
+
+with Ada.Unchecked_Conversion;
+
+package body SSO2 is
+
+  function Conv is new Ada.Unchecked_Conversion (Arr1, Arr2);
+
+  procedure Proc (A1 : Arr1; A2 : out Arr2) is
+  begin
+     A2 := Conv (A1);
+  end;
+
+end SSO2;
Index: testsuite/gnat.dg/sso2.ads
===================================================================
--- testsuite/gnat.dg/sso2.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso2.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,13 @@ 
+with System;
+
+package SSO2 is
+
+  type Arr1 is array (1 .. 4) of Character;
+  for Arr1'Scalar_Storage_Order use System.High_Order_First;
+
+  type Arr2 is array (1 .. 4) of Character;
+  for Arr2'Scalar_Storage_Order use System.Low_Order_First;
+
+  procedure Proc (A1 : Arr1; A2 : out Arr2);
+
+end SSO2;
Index: testsuite/gnat.dg/sso3.adb
===================================================================
--- testsuite/gnat.dg/sso3.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso3.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,52 @@ 
+-- { dg-do run }
+
+with System; use System;
+
+procedure SSO3 is
+   Rev_SSO : constant Bit_Order
+     := Bit_Order'Val (1 - Bit_Order'Pos (Default_Bit_Order));
+
+   type R (D : Integer) is record
+      Common : Integer;
+      case D is
+         when 0 =>
+            V1 : Integer;
+         when others =>
+            V2 : Integer;
+      end case;
+   end record;
+
+   for R use record
+      D at 0 range 0 .. 31;
+      V1 at 4 range 0 .. 31;
+      V2 at 4 range 0 .. 31;
+      Common at 8 range 0 .. 31;
+   end record;
+   for R'Scalar_Storage_Order use Rev_SSO;
+   for R'Bit_Order use Rev_SSO;
+
+   procedure Check (Common, V : Integer; X : R) is
+   begin
+      if Common /= X.Common then
+         raise Program_Error;
+      end if;
+
+      case X.D is
+         when 0 =>
+            if V /= X.V1 then
+               raise Program_Error;
+            end if;
+         when others =>
+            if V /= X.V2 then
+               raise Program_Error;
+            end if;
+      end case;
+   end Check;
+
+   X0 : R := (D => 0,     Common => 1111, V1 => 1234);
+   X1 : R := (D => 31337, Common => 2222, V2 => 5678);
+
+begin
+   Check (1111, 1234, X0);
+   Check (2222, 5678, X1);
+end;
Index: testsuite/gnat.dg/sso4.adb
===================================================================
--- testsuite/gnat.dg/sso4.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso4.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,55 @@ 
+-- { dg-do run }
+
+with System;
+
+procedure SSO4 is
+
+   type Short_Int is mod 2**16;
+
+   type Rec1 is record
+      F1 : Short_Int;
+      F2 : Short_Int;
+   end record;
+   for Rec1 use record
+      F1 at 0 range  0 .. 15;
+      F2 at 0 range 16 .. 31;
+   end record;
+
+   for Rec1'Bit_Order use System.High_Order_First;
+   for Rec1'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec2 is record
+      I1 : Integer;
+      R1 : Rec1;
+   end record;
+   for Rec2 use record
+      I1 at 0 range 0 .. 31; 
+      R1 at 4 range 0 .. 31;
+   end record;
+   for Rec2'Bit_Order use System.High_Order_First;
+   for Rec2'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec3 is record
+      Data : Rec1;
+   end record;
+   for Rec3 use record
+      Data at 0 range  0 .. 31;
+   end record;
+   for Rec3'Bit_Order use System.High_Order_First;
+   for Rec3'Scalar_Storage_Order use System.High_Order_First;
+
+   procedure Copy (Message : in Rec3) is
+      Local : Rec2;
+   begin
+      Local := (I1 => 1, R1 => Message.Data);
+      if Local.R1 /= Message.Data then
+         raise Program_Error;
+      end if;
+   end;
+
+   Message : Rec3;
+
+begin
+   Message := (Data => (2, 3));
+   Copy(Message);
+end;
Index: testsuite/gnat.dg/specs/sso2.ads
===================================================================
--- testsuite/gnat.dg/specs/sso2.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/specs/sso2.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,26 @@ 
+-- { dg-do compile }
+-- { dg-options "-gnatws" }
+
+with System;
+
+package SSO2 is
+
+  I : Integer;
+
+  type Rec1 is record
+    A : System.Address;
+  end record;
+  for Rec1'Bit_Order use System.High_Order_First;
+  for Rec1'Scalar_Storage_Order use System.High_Order_First;
+
+  R1 : Rec1 := (A => I'Address);
+
+  type Rec2 is record
+    A : System.Address;
+  end record;
+  for Rec2'Bit_Order use System.Low_Order_First;
+  for Rec2'Scalar_Storage_Order use System.Low_Order_First;
+
+  R2 : Rec2 := (A => I'Address);
+
+end SSO2;
Index: testsuite/gnat.dg/specs/sso1.ads
===================================================================
--- testsuite/gnat.dg/specs/sso1.ads	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/specs/sso1.ads	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,22 @@ 
+-- { dg-do compile }
+
+with System;
+
+package SSO1 is
+
+   type R is record  -- { dg-error "inconsistent with bit order" }
+      B : Boolean;
+   end record;
+   for R'Bit_Order use System.Low_Order_First;
+   for R'Scalar_Storage_Order use System.High_Order_First;
+   for R use record
+      B at 0 range 0 .. 1;
+   end record;
+
+   type RW is record
+      B : Boolean;
+   end record;
+   for RW'Bit_Order use System.Low_Order_First;
+   for RW'Scalar_Storage_Order use System.Low_Order_First;  -- { dg-warning "no component clause" }
+
+end SSO1;
Index: testsuite/gnat.dg/sso5.adb
===================================================================
--- testsuite/gnat.dg/sso5.adb	(.../trunk/gcc)	(revision 0)
+++ testsuite/gnat.dg/sso5.adb	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,52 @@ 
+-- { dg-do run }
+
+with System;
+
+procedure SSO5 is
+
+   type Short_Int is mod 2**16;
+
+   type Rec1 is record
+      F1 : Short_Int;
+      F2 : Short_Int;
+   end record;
+   for Rec1 use record
+      F1 at 0 range  0 .. 15;
+      F2 at 0 range 16 .. 31;
+   end record;
+   for Rec1'Bit_Order use System.High_Order_First;
+   for Rec1'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec2 is record
+      R1 : Rec1;
+   end record;
+   for Rec2 use record
+      R1 at 0 range 1 .. 32;
+   end record;
+   for Rec2'Bit_Order use System.High_Order_First;
+   for Rec2'Scalar_Storage_Order use System.High_Order_First;
+
+   type Rec3 is record
+      Data : Rec1;
+   end record;
+   for Rec3 use record
+      Data at 0 range 0 .. 31;
+   end record;
+   for Rec3'Bit_Order use System.High_Order_First;
+   for Rec3'Scalar_Storage_Order use System.High_Order_First;
+
+   procedure Copy (Message : in Rec3) is
+      Local : Rec2;
+   begin
+      Local := (R1 => Message.Data);
+      if Local.R1 /= Message.Data then
+         raise Program_Error;
+      end if;
+   end;
+
+   Message : Rec3;
+
+begin
+   Message := (Data => (2, 3));
+   Copy(Message);
+end;
Index: testsuite/gcc.dg/sso/sso.exp
===================================================================
--- testsuite/gcc.dg/sso/sso.exp	(.../trunk/gcc)	(revision 0)
+++ testsuite/gcc.dg/sso/sso.exp	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,40 @@ 
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Load support procs.
+load_lib gcc-dg.exp
+load_lib torture-options.exp
+
+# Initialize `dg'.
+torture-init
+dg-init
+
+set SSO_TORTURE_OPTIONS [list \
+	{ -O0 } \
+	{ -O1 -fno-inline } \
+	{ -O2 } \
+	{ -O3 -finline-functions } \
+	{ -Os } \
+	{ -Og -g } ]
+
+set-torture-options $SSO_TORTURE_OPTIONS
+
+# Main loop.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/c-c++-common/sso/*.c]] "" ""
+
+# All done.
+dg-finish
+torture-finish
Index: testsuite/gcc.dg/sso-1.c
===================================================================
--- testsuite/gcc.dg/sso-1.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/gcc.dg/sso-1.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,17 @@ 
+/* { dg-do compile } */
+
+int i;
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+struct __attribute__((scalar_storage_order("big-endian"))) Rec
+{
+  int *p;
+};
+#else
+struct __attribute__((scalar_storage_order("little-endian"))) Rec
+{
+  int *p;
+};
+#endif
+
+struct Rec r = { &i };  /* { dg-error "element is not constant" } */
Index: testsuite/g++.dg/sso/sso.exp
===================================================================
--- testsuite/g++.dg/sso/sso.exp	(.../trunk/gcc)	(revision 0)
+++ testsuite/g++.dg/sso/sso.exp	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,40 @@ 
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# Load support procs.
+load_lib g++-dg.exp
+load_lib torture-options.exp
+
+# Initialize `dg'.
+torture-init
+dg-init
+
+set SSO_TORTURE_OPTIONS [list \
+	{ -O0 } \
+	{ -O1 -fno-inline } \
+	{ -O2 } \
+	{ -O3 -finline-functions } \
+	{ -Os } \
+	{ -Og -g } ]
+
+set-torture-options $SSO_TORTURE_OPTIONS
+
+# Main loop.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/c-c++-common/sso/*.c]] "" ""
+
+# All done.
+dg-finish
+torture-finish
Index: testsuite/g++.dg/sso-1.C
===================================================================
--- testsuite/g++.dg/sso-1.C	(.../trunk/gcc)	(revision 0)
+++ testsuite/g++.dg/sso-1.C	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,17 @@ 
+// { dg-do compile }
+
+int i;
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+struct __attribute__((scalar_storage_order("big-endian"))) Rec
+{
+  int *p;
+};
+#else
+struct __attribute__((scalar_storage_order("little-endian"))) Rec
+{
+  int *p;
+};
+#endif
+
+struct Rec r = { &i };
Index: testsuite/c-c++-common/sso-2.c
===================================================================
--- testsuite/c-c++-common/sso-2.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-2.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,94 @@ 
+/* Test support of scalar_storage_order attribute */
+
+/* { dg-do compile } */
+
+struct S1
+{
+  int i;
+} __attribute__((scalar_storage_order("big-endian")));
+
+struct S2
+{
+  int i;
+} __attribute__((scalar_storage_order("little-endian")));
+
+struct S3 { int i; } __attribute__((scalar_storage_order("other"))); /* { dg-error "must be one of .big-endian. or .little-endian." } */
+
+void incompatible_assign (struct S1 *s1, struct S2 *s2)
+{
+  *s1 = *s2; /* { dg-error "(incompatible types|no match)" } */
+}
+
+int *addr1 (int which, struct S1 *s1, struct S2 *s2)
+{
+  return (which == 1 ? &s1->i : &s2->i); /* { dg-error "address of scalar with reverse storage order" } */
+}
+
+struct S4
+{
+  int a[4];
+  struct S2 s2;
+} __attribute__((scalar_storage_order("big-endian")));
+
+struct S5
+{
+  int a[4];
+  struct S1 s1;
+} __attribute__((scalar_storage_order("little-endian")));
+
+void *addr2 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)s4->a : (void *)s5->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr3 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)&s4->a : (void *)&s5->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr4 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)&s4->a[0] : (void *)&s5->a[0]); /* { dg-error "address of scalar with reverse storage order" } */
+}
+
+void *addr5 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)&s4->s2 : (void *) &s5->s1); /* ok */
+}
+
+struct S6
+{
+  int a[4][2];
+  struct S2 s2[2];
+}  __attribute__((scalar_storage_order("big-endian")));
+
+struct S7
+{
+  int a[4][2];
+  struct S1 s1[2];
+}  __attribute__((scalar_storage_order("little-endian")));
+
+void *addr6 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)s6->a : (void *)s7->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr7 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->a : (void *)&s7->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr8 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->a[0] : (void *)&s7->a[0]); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr9 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->a[0][0] : (void *)&s7->a[0][0]); /* { dg-error "address of scalar with reverse storage order" } */
+}
+
+void *addr10 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->s2 : (void *)&s7->s1); /* ok */
+}
Index: testsuite/c-c++-common/sso-6.c
===================================================================
--- testsuite/c-c++-common/sso-6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+/* Test support of scalar_storage_order pragma */
+
+/* { dg-do run } */
+/* { dg-options "-fsso-struct=big-endian" } */
+
+struct S1
+{
+  int i;
+};
+
+#pragma scalar_storage_order little-endian
+
+struct S2
+{
+  int i;
+};
+
+#pragma scalar_storage_order default
+
+struct S3
+{
+  int i;
+};
+
+struct S1 my_s1 = { 0x12345678 };
+struct S2 my_s2 = { 0x12345678 };
+struct S3 my_s3 = { 0x12345678 };
+
+unsigned char big_endian_pattern[4] = { 0x12, 0x34, 0x56, 0x78 };
+unsigned char little_endian_pattern[4] = { 0x78, 0x56, 0x34, 0x12 };
+
+int main (void)
+{
+  if (__builtin_memcmp (&my_s1, &big_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s2, &little_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s3, &big_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso-3.c
===================================================================
--- testsuite/c-c++-common/sso-3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,21 @@ 
+/* Test support of scalar_storage_order attribute */
+
+/* { dg-do compile } */
+
+struct S1
+{
+  int i;
+};
+
+typedef struct S1 __attribute__((scalar_storage_order("big-endian"))) NS1; /* { dg-warning "attribute ignored" } */
+
+struct S2
+{
+  int i;
+};
+
+typedef struct S2 __attribute__((scalar_storage_order("little-endian"))) NS2; /* { dg-warning "attribute ignored" } */
+
+struct S3 { int i; };
+
+typedef struct S3 __attribute__((scalar_storage_order("other"))) NS3; /* { dg-warning "attribute ignored" } */
Index: testsuite/c-c++-common/sso-7.c
===================================================================
--- testsuite/c-c++-common/sso-7.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-7.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,44 @@ 
+/* Test support of scalar_storage_order pragma */
+
+/* { dg-do run } */
+/* { dg-options "-fsso-struct=little-endian" } */
+
+struct S1
+{
+  int i;
+};
+
+#pragma scalar_storage_order big-endian
+
+struct S2
+{
+  int i;
+};
+
+#pragma scalar_storage_order default
+
+struct S3
+{
+  int i;
+};
+
+struct S1 my_s1 = { 0x12345678 };
+struct S2 my_s2 = { 0x12345678 };
+struct S3 my_s3 = { 0x12345678 };
+
+unsigned char big_endian_pattern[4] = { 0x12, 0x34, 0x56, 0x78 };
+unsigned char little_endian_pattern[4] = { 0x78, 0x56, 0x34, 0x12 };
+
+int main (void)
+{
+  if (__builtin_memcmp (&my_s1, &little_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s2, &big_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s3, &little_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init6.h
===================================================================
--- testsuite/c-c++-common/sso/init6.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init6.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,24 @@ 
+struct __attribute__((scalar_storage_order("big-endian"))) Nested1
+{
+  int A[3];
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  int I;
+  struct Nested1 N;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) Nested2
+{
+  int A[3];
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  int I;
+  struct Nested2 N;
+};
+
+struct R1 My_R1 = { 0x12345678, { { 0xAB0012, 0xCD0034, 0xEF0056 } } };
+struct R2 My_R2 = { 0x12345678, { { 0xAB0012, 0xCD0034, 0xEF0056 } } };
Index: testsuite/c-c++-common/sso/init7.h
===================================================================
--- testsuite/c-c++-common/sso/init7.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init7.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,28 @@ 
+struct __attribute__((scalar_storage_order("little-endian"))) Nested1
+{
+  int C1;
+  int C2;
+  int C3;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  int I;
+  struct Nested1 N;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) Nested2
+{
+  int C1;
+  int C2;
+  int C3;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  int I;
+  struct Nested2 N;
+};
+
+struct R1 My_R1 = { 0x12345678, { 0xAB0012, 0xCD0034, 0xEF0056 } };
+struct R2 My_R2 = { 0x12345678, { 0xAB0012, 0xCD0034, 0xEF0056 } };
Index: testsuite/c-c++-common/sso/init8.h
===================================================================
--- testsuite/c-c++-common/sso/init8.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init8.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,28 @@ 
+struct __attribute__((scalar_storage_order("big-endian"))) Nested1
+{
+  int C1;
+  int C2;
+  int C3;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  int I;
+  struct Nested1 N;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) Nested2
+{
+  int C1;
+  int C2;
+  int C3;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  int I;
+  struct Nested2 N;
+};
+
+struct R1 My_R1 = { 0x12345678, { 0xAB0012, 0xCD0034, 0xEF0056 } };
+struct R2 My_R2 = { 0x12345678, { 0xAB0012, 0xCD0034, 0xEF0056 } };
Index: testsuite/c-c++-common/sso/init9.h
===================================================================
--- testsuite/c-c++-common/sso/init9.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init9.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,14 @@ 
+#define Pi 3.14159265358979323846
+
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  double F;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  double F;
+};
+
+struct R1 My_R1 = { Pi };
+struct R2 My_R2 = { Pi };
Index: testsuite/c-c++-common/sso/p13.c
===================================================================
--- testsuite/c-c++-common/sso/p13.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p13.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,64 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init13.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : db 0f 49 40 db 0f 49 c0\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 40 49 0f db c0 49 0f db\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" } */
+
+  Local_R1.F = Pi - Pi * I;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" } */
+
+  Local_R2.F = Pi - Pi * I;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" } */
+
+  Local_R1.F = Local_R2.F;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" } */
+
+  Local_R2.F = Local_R1.F;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q13.c
===================================================================
--- testsuite/c-c++-common/sso/q13.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q13.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,50 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init13.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : db 0f 49 40 db 0f 49 c0\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : db 0f 49 40 db 0f 49 c0\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 40 49 0f db c0 49 0f db\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 40 49 0f db c0 49 0f db\n" } */
+
+  if (A1.F != B1.F) abort ();
+
+  if (A1.F != Pi - Pi * I) abort ();
+
+  if (A2.F != B2.F) abort ();
+
+  if (A2.F != Pi - Pi * I) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t13.c
===================================================================
--- testsuite/c-c++-common/sso/t13.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t13.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init13.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.F = My_R1.F + (1.0f + 1.0f * I);
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : ee 87 84 40 db 0f 09 c0\n" } */
+
+  Local_R2.F = My_R2.F + (1.0f + 1.0f * I);
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 84 87 ee c0 09 0f db\n" } */
+
+  Local_R1.F = Pi - Pi * I;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40 db 0f 49 c0\n" } */
+
+  Local_R2.F = Pi - Pi * I;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db c0 49 0f db\n" } */
+
+  Local_R1.F = Local_R1.F + (1.0f + 1.0f * I);
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : ee 87 84 40 db 0f 09 c0\n" } */
+
+  Local_R2.F = Local_R2.F + (1.0f + 1.0f * I);
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 84 87 ee c0 09 0f db\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init13.h
===================================================================
--- testsuite/c-c++-common/sso/init13.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init13.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,15 @@ 
+#define I (__extension__ 1.0iF)
+#define Pi 3.1415927f
+
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  _Complex float F;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  _Complex float F;
+};
+
+struct R1 My_R1 = { Pi - Pi * I };
+struct R2 My_R2 = { Pi - Pi * I };
Index: testsuite/c-c++-common/sso/q1.c
===================================================================
--- testsuite/c-c++-common/sso/q1.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q1.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,50 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init1.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : 78 56 34 12\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 12 34 56 78\n" } */
+
+  if (A1.I != B1.I) abort ();
+
+  if (A1.I != 0x12345678) abort ();
+
+  if (A2.I != B2.I) abort ();
+
+  if (A2.I != 0x12345678) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q2.c
===================================================================
--- testsuite/c-c++-common/sso/q2.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q2.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,54 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init2.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  if (A1.S1 != B1.S1) abort ();
+
+  if (A1.S1 != 2) abort ();
+
+  if (A2.S1 != B2.S1) abort ();
+
+  if (A2.S1 != 2) abort ();
+
+  if (A1.I != B1.I || A1.A1 != B1.A1) abort ();
+
+  if (A2.I != B2.I || A2.A1 != B2.A1) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q3.c
===================================================================
--- testsuite/c-c++-common/sso/q3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,54 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init3.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  if (A1.S1 != B1.S1) abort ();
+
+  if (A1.S1 != 2) abort ();
+
+  if (A2.S1 != B2.S1) abort ();
+
+  if (A2.S1 != 2) abort ();
+
+  if (A1.I != B1.I || A1.N.C1 != B1.N.C1) abort ();
+
+  if (A2.I != B2.I || A2.N.C1 != B2.N.C1) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q4.c
===================================================================
--- testsuite/c-c++-common/sso/q4.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q4.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,50 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init4.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : db 0f 49 40\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : db 0f 49 40\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 40 49 0f db\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 40 49 0f db\n" } */
+
+  if (A1.F != B1.F) abort ();
+
+  if (A1.F != Pi) abort ();
+
+  if (A2.F != B2.F) abort ();
+
+  if (A2.F != Pi) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q5.c
===================================================================
--- testsuite/c-c++-common/sso/q5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,46 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init5.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  if (A1.I != B1.I || A1.A[0] != B1.A[0]) abort();
+
+  if (A2.I != B2.I || A2.A[0] != B2.A[0]) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/s3.c
===================================================================
--- testsuite/c-c++-common/sso/s3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/s3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init3.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  struct Nested1 N1;
+  struct Nested2 N2;
+
+  unsigned C1;
+  unsigned C2;
+  unsigned C3;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  N1 = A1.N;
+  C1 = N1.C1;
+  C2 = N1.C2;
+  C3 = N1.C3;
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 18\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 52\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 86\n" } */
+
+  N1.C1 = C1;
+  N1.C2 = C2;
+  N1.C3 = C3;
+  A1.N = N1;
+
+  N2 = A2.N;
+  C1 = N2.C1;
+  C2 = N2.C2;
+  C3 = N2.C3;
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 18\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 52\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 86\n" } */
+
+  N2.C1 = C1;
+  N2.C2 = C2;
+  N2.C3 = C3;
+  A2.N = N2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q6.c
===================================================================
--- testsuite/c-c++-common/sso/q6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,45 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init6.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  if (A1.I != B1.I || A1.N.A[0] != B1.N.A[0]) abort();
+
+  if (A2.I != B2.I || A2.N.A[0] != B2.N.A[0]) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/s5.c
===================================================================
--- testsuite/c-c++-common/sso/s5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/s5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,91 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init5.h"
+#include "dump.h"
+
+#pragma GCC diagnostic ignored "-Wscalar-storage-order"
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  struct __attribute__((scalar_storage_order("little-endian"))) Nested1
+  {
+    int A[3];
+  };
+
+  struct __attribute__((scalar_storage_order("big-endian"))) Nested2
+  {
+    int A[3];
+  };
+
+  struct Nested1 N1;
+  struct Nested2 N2;
+
+  int C1;
+  int C2;
+  int C3;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  __builtin_memcpy (N1.A, A1.A, sizeof (int) * 3);
+  C1 = N1.A[0];
+  C2 = N1.A[1];
+  C3 = N1.A[2];
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N1.A[0] = C1;
+  N1.A[1] = C2;
+  N1.A[2] = C3;
+  __builtin_memcpy (A1.A, N1.A, sizeof (int) * 3);
+
+  __builtin_memcpy (N2.A, A2.A, sizeof (int) * 3);
+  C1 = N2.A[0];
+  C2 = N2.A[1];
+  C3 = N2.A[2];
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N2.A[0] = C1;
+  N2.A[1] = C2;
+  N2.A[2] = C3;
+  __builtin_memcpy (A2.A, N2.A, sizeof (int) * 3);
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q7.c
===================================================================
--- testsuite/c-c++-common/sso/q7.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q7.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,46 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init7.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  if (A1.I != B1.I || A1.N.C1 != B1.N.C1) abort();
+
+  if (A2.I != B2.I || A2.N.C1 != B2.N.C1) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/s6.c
===================================================================
--- testsuite/c-c++-common/sso/s6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/s6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,81 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init6.h"
+#include "dump.h"
+
+#pragma GCC diagnostic ignored "-Wscalar-storage-order"
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  struct Nested1 N1;
+  struct Nested2 N2;
+
+  int C1;
+  int C2;
+  int C3;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  __builtin_memcpy (N1.A, A1.N.A, sizeof (int) * 3);
+  C1 = N1.A[0];
+  C2 = N1.A[1];
+  C3 = N1.A[2];
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N1.A[0] = C1;
+  N1.A[1] = C2;
+  N1.A[2] = C3;
+  __builtin_memcpy (A1.N.A, N1.A, sizeof (int) * 3);
+
+  __builtin_memcpy (N2.A, A2.N.A, sizeof (int) * 3);
+  C1 = N2.A[0];
+  C2 = N2.A[1];
+  C3 = N2.A[2];
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N2.A[0] = C1;
+  N2.A[1] = C2;
+  N2.A[2] = C3;
+  __builtin_memcpy (A2.N.A, N2.A, sizeof (int) * 3);
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q8.c
===================================================================
--- testsuite/c-c++-common/sso/q8.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q8.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,46 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init8.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  if (A1.I != B1.I || A1.N.C1 != B1.N.C1) abort();
+
+  if (A2.I != B2.I || A2.N.C1 != B2.N.C1) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/u5.c
===================================================================
--- testsuite/c-c++-common/sso/u5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/u5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,52 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init5.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+  int C1;
+  int C2;
+
+  Local_R1.I    = 1;
+  Local_R1.A[0] = 0xAB0012;
+  Local_R1.A[1] = 0xCD0034;
+  Local_R1.A[2] = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 01 00 00 00 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = 1;
+  Local_R2.A[0] = 0xAB0012;
+  Local_R2.A[1] = 0xCD0034;
+  Local_R2.A[2] = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 00 00 00 01 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  C1 = Local_R1.A[Local_R1.I];
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 13434932\n" } */
+
+  Local_R1.I++;
+  C1 = Local_R1.A[Local_R1.I];
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 15663190\n" } */
+
+  C2 = Local_R2.A[Local_R2.I];
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  Local_R2.I++;
+  C2 = Local_R2.A[Local_R2.I];
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 15663190\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/s7.c
===================================================================
--- testsuite/c-c++-common/sso/s7.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/s7.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init7.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  struct Nested1 N1;
+  struct Nested2 N2;
+
+  int C1;
+  int C2;
+  int C3;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  N1 = A1.N;
+  C1 = N1.C1;
+  C2 = N1.C2;
+  C3 = N1.C3;
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N1.C1 = C1;
+  N1.C2 = C2;
+  N1.C3 = C3;
+  A1.N = N1;
+
+  N2 = A2.N;
+  C1 = N2.C1;
+  C2 = N2.C2;
+  C3 = N2.C3;
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N2.C1 = C1;
+  N2.C2 = C2;
+  N2.C3 = C3;
+  A2.N = N2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/q9.c
===================================================================
--- testsuite/c-c++-common/sso/q9.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/q9.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,50 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init9.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R1 B1 = My_R1;
+
+  struct R2 A2 = My_R2;
+  struct R2 B2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 18 2d 44 54 fb 21 09 40\n" } */
+
+  put ("B1 :");
+  dump (&B1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "B1 : 18 2d 44 54 fb 21 09 40\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 40 09 21 fb 54 44 2d 18\n" } */
+
+  put ("B2 :");
+  dump (&B2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "B2 : 40 09 21 fb 54 44 2d 18\n" } */
+
+  if (A1.F != B1.F) abort ();
+
+  if (A1.F != Pi) abort ();
+
+  if (A2.F != B2.F) abort ();
+
+  if (A2.F != Pi) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/u6.c
===================================================================
--- testsuite/c-c++-common/sso/u6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/u6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,52 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init6.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+  int C1;
+  int C2;
+
+  Local_R1.I      = 1;
+  Local_R1.N.A[0] = 0xAB0012;
+  Local_R1.N.A[1] = 0xCD0034;
+  Local_R1.N.A[2] = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 01 00 00 00 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I      = 1;
+  Local_R2.N.A[0] = 0xAB0012;
+  Local_R2.N.A[1] = 0xCD0034;
+  Local_R2.N.A[2] = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 00 00 00 01 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  C1 = Local_R1.N.A[Local_R1.I];
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 13434932\n" } */
+
+  Local_R1.I++;
+  C1 = Local_R1.N.A[Local_R1.I];
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 15663190\n" } */
+
+  C2 = Local_R2.N.A[Local_R2.I];
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  Local_R2.I++;
+  C2 = Local_R2.N.A[Local_R2.I];
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 15663190\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/s8.c
===================================================================
--- testsuite/c-c++-common/sso/s8.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/s8.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,79 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init8.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  struct Nested1 N1;
+  struct Nested2 N2;
+
+  int C1;
+  int C2;
+  int C3;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  N1 = A1.N;
+  C1 = N1.C1;
+  C2 = N1.C2;
+  C3 = N1.C3;
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N1.C1 = C1;
+  N1.C2 = C2;
+  N1.C3 = C3;
+  A1.N = N1;
+
+  N2 = A2.N;
+  C1 = N2.C1;
+  C2 = N2.C2;
+  C3 = N2.C3;
+
+  printf ("C1 : %d\n", C1);
+  /* { dg-output "C1 : 11206674\n" } */
+
+  printf ("C2 : %d\n", C2);
+  /* { dg-output "C2 : 13434932\n" } */
+
+  printf ("C3 : %d\n", C3);
+  /* { dg-output "C3 : 15663190\n" } */
+
+  N2.C1 = C1;
+  N2.C2 = C2;
+  N2.C3 = C3;
+  A2.N = N2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/dump.h
===================================================================
--- testsuite/c-c++-common/sso/dump.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/dump.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,23 @@ 
+void dump (void *p, unsigned int len)
+{
+  const char digits[17] = "0123456789abcdef";
+  unsigned char *a = (unsigned char *)p;
+  int i;
+
+  for (i = 0; i < len; i++)
+    {
+      putchar (' ');
+      putchar (digits[a[i] / 16]);
+      putchar (digits[a[i] % 16]);
+    }
+}
+
+void put (const char s[])
+{
+  fputs (s, stdout);
+}
+
+void new_line (void)
+{
+  putchar ('\n');
+}
Index: testsuite/c-c++-common/sso/p1.c
===================================================================
--- testsuite/c-c++-common/sso/p1.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p1.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,64 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init1.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : 78 56 34 12\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 12 34 56 78\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78\n" } */
+
+  Local_R1.I = 0x12345678;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12\n" } */
+
+  Local_R2.I = 0x12345678;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78\n" } */
+
+  Local_R1.I = Local_R2.I;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12\n" } */
+
+  Local_R2.I = Local_R1.I;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p2.c
===================================================================
--- testsuite/c-c++-common/sso/p2.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p2.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,88 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init2.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  Local_R1.S1 = 2;
+  Local_R1.I  = 0x12345678;
+  Local_R1.S2 = 1;
+  Local_R1.A1 = 0xAB;
+  Local_R1.A2 = 0xCD;
+  Local_R1.A3 = 0xEF;
+  Local_R1.B  = 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  Local_R2.S1 = 2;
+  Local_R2.I  = 0x12345678;
+  Local_R2.S2 = 1;
+  Local_R2.A1 = 0xAB;
+  Local_R2.A2 = 0xCD;
+  Local_R2.A3 = 0xEF;
+  Local_R2.B  = 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  Local_R1.S1 = Local_R2.S1;
+  Local_R1.I  = Local_R2.I;
+  Local_R1.S2 = Local_R2.S2;
+  Local_R1.A1 = Local_R2.A1;
+  Local_R1.A2 = Local_R2.A2;
+  Local_R1.A3 = Local_R2.A3;
+  Local_R1.B  = Local_R2.B;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  Local_R2.S1 = Local_R1.S1;
+  Local_R2.I  = Local_R1.I;
+  Local_R2.S2 = Local_R1.S2;
+  Local_R2.A1 = Local_R1.A1;
+  Local_R2.A2 = Local_R1.A2;
+  Local_R2.A3 = Local_R1.A3;
+  Local_R2.B  = Local_R1.B;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p3.c
===================================================================
--- testsuite/c-c++-common/sso/p3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,88 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init3.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  Local_R1.S1   = 2;
+  Local_R1.I    = 0x78ABCDEF;
+  Local_R1.S2   = 1;
+  Local_R1.N.C1 = 0x12;
+  Local_R1.N.C2 = 0x34;
+  Local_R1.N.C3 = 0x56;
+  Local_R1.N.B  = 4;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  Local_R2.S1   = 2;
+  Local_R2.I    = 0x78ABCDEF;
+  Local_R2.S2   = 1;
+  Local_R2.N.C1 = 0x12;
+  Local_R2.N.C2 = 0x34;
+  Local_R2.N.C3 = 0x56;
+  Local_R2.N.B  = 4;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  Local_R1.S1   = Local_R2.S1;
+  Local_R1.I    = Local_R2.I;
+  Local_R1.S2   = Local_R2.S2;
+  Local_R1.N.C1 = Local_R2.N.C1;
+  Local_R1.N.C2 = Local_R2.N.C2;
+  Local_R1.N.C3 = Local_R2.N.C3;
+  Local_R1.N.B  = Local_R2.N.B;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  Local_R2.S1   = Local_R1.S1;
+  Local_R2.I    = Local_R1.I;
+  Local_R2.S2   = Local_R1.S2;
+  Local_R2.N.C1 = Local_R1.N.C1;
+  Local_R2.N.C2 = Local_R1.N.C2;
+  Local_R2.N.C3 = Local_R1.N.C3;
+  Local_R2.N.B  = Local_R1.N.B;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p4.c
===================================================================
--- testsuite/c-c++-common/sso/p4.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p4.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,64 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init4.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : db 0f 49 40\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 40 49 0f db\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db\n" } */
+
+  Local_R1.F = Pi;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40\n" } */
+
+  Local_R2.F = Pi;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db\n" } */
+
+  Local_R1.F = Local_R2.F;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40\n" } */
+
+  Local_R2.F = Local_R1.F;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t1.c
===================================================================
--- testsuite/c-c++-common/sso/t1.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t1.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init1.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.I = My_R1.I + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12\n" } */
+
+  Local_R2.I = My_R2.I + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79\n" } */
+
+  Local_R1.I = 0x12345678;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12\n" } */
+
+  Local_R2.I = 0x12345678;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78\n" } */
+
+  Local_R1.I = Local_R1.I + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12\n" } */
+
+  Local_R2.I = Local_R2.I + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p5.c
===================================================================
--- testsuite/c-c++-common/sso/p5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,74 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init5.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1.I    = 0x12345678;
+  Local_R1.A[0] = 0xAB0012;
+  Local_R1.A[1] = 0xCD0034;
+  Local_R1.A[2] = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = 0x12345678;
+  Local_R2.A[0] = 0xAB0012;
+  Local_R2.A[1] = 0xCD0034;
+  Local_R2.A[2] = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1.I    = Local_R2.I;
+  Local_R1.A[0] = Local_R2.A[0];
+  Local_R1.A[1] = Local_R2.A[1];
+  Local_R1.A[2] = Local_R2.A[2];
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = Local_R1.I;
+  Local_R2.A[0] = Local_R1.A[0];
+  Local_R2.A[1] = Local_R1.A[1];
+  Local_R2.A[2] = Local_R1.A[2];
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/r3.c
===================================================================
--- testsuite/c-c++-common/sso/r3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/r3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,65 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init3.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int Get_Elem1 (struct R1 R)
+{
+  struct R1 Tmp = R;
+  return Tmp.I;
+}
+
+void Set_Elem1 (struct R1 *R, int I)
+{
+  struct R1 Tmp = *R;
+  Tmp.I = I;
+  *R = Tmp;
+}
+
+int Get_Elem2 (struct R2 R)
+{
+  struct R2 Tmp = R;
+  return Tmp.I;
+}
+
+void Set_Elem2 (struct R2 *R, int I)
+{
+  struct R2 Tmp = *R;
+  Tmp.I = I;
+  *R = Tmp;
+}
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  if (Get_Elem1 (A1) != 0x78ABCDEF) abort ();
+
+  Set_Elem1 (&A1, 0xCD0034);
+  if (Get_Elem1 (A1) != 0xCD0034) abort ();
+
+  if (Get_Elem2 (A2) != 0x78ABCDEF) abort ();
+
+  Set_Elem2 (&A2, 0xCD0034);
+  if (Get_Elem2 (A2) != 0xCD0034) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p6.c
===================================================================
--- testsuite/c-c++-common/sso/p6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,74 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init6.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1.I      = 0x12345678;
+  Local_R1.N.A[0] = 0xAB0012;
+  Local_R1.N.A[1] = 0xCD0034;
+  Local_R1.N.A[2] = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I      = 0x12345678;
+  Local_R2.N.A[0] = 0xAB0012;
+  Local_R2.N.A[1] = 0xCD0034;
+  Local_R2.N.A[2] = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1.I      = Local_R2.I;
+  Local_R1.N.A[0] = Local_R2.N.A[0];
+  Local_R1.N.A[1] = Local_R2.N.A[1];
+  Local_R1.N.A[2] = Local_R2.N.A[2];
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I      = Local_R1.I;
+  Local_R2.N.A[0] = Local_R1.N.A[0];
+  Local_R2.N.A[1] = Local_R1.N.A[1];
+  Local_R2.N.A[2] = Local_R1.N.A[2];
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t2.c
===================================================================
--- testsuite/c-c++-common/sso/t2.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t2.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,92 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init2.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.S1 = My_R1.S1 - 1;
+  Local_R1.I  = My_R1.I + 1;
+  Local_R1.S2 = My_R1.S2 - 1;
+  Local_R1.A1 = My_R1.A1 % 16;
+  Local_R1.A2 = My_R1.A2 % 16;
+  Local_R1.A3 = My_R1.A3 % 16;
+  Local_R1.B  = !My_R1.B;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : e5 59 d1 48 b0 a0 c1 03\n" } */
+
+  Local_R2.S1 = My_R2.S1 - 1;
+  Local_R2.I  = My_R2.I + 1;
+  Local_R2.S2 = My_R2.S2 - 1;
+  Local_R2.A1 = My_R2.A1 % 16;
+  Local_R2.A2 = My_R2.A2 % 16;
+  Local_R2.A3 = My_R2.A3 % 16;
+  Local_R2.B  = !My_R2.B;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 44 8d 15 9e 40 58 34 1e\n" } */
+
+  Local_R1.S1 = 2;
+  Local_R1.I  = 0x12345678;
+  Local_R1.S2 = 1;
+  Local_R1.A1 = 0xAB;
+  Local_R1.A2 = 0xCD;
+  Local_R1.A3 = 0xEF;
+  Local_R1.B  = 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : e2 59 d1 48 b4 aa d9 bb\n" } */
+
+  Local_R2.S1 = 2;
+  Local_R2.I  = 0x12345678;
+  Local_R2.S2 = 1;
+  Local_R2.A1 = 0xAB;
+  Local_R2.A2 = 0xCD;
+  Local_R2.A3 = 0xEF;
+  Local_R2.B  = 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 84 8d 15 9e 15 5b 35 df\n" } */
+
+  Local_R1.S1 = Local_R1.S1 - 1;
+  Local_R1.I  = Local_R1.I + 1;
+  Local_R1.S2 = Local_R1.S2 - 1;
+  Local_R1.A1 = Local_R1.A1 % 16;
+  Local_R1.A2 = Local_R1.A2 % 16;
+  Local_R1.A3 = Local_R1.A3 % 16;
+  Local_R1.B  = !Local_R1.B;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : e5 59 d1 48 b0 a0 c1 03\n" } */
+
+  Local_R2.S1 = Local_R2.S1 - 1;
+  Local_R2.I  = Local_R2.I + 1;
+  Local_R2.S2 = Local_R2.S2 - 1;
+  Local_R2.A1 = Local_R2.A1 % 16;
+  Local_R2.A2 = Local_R2.A2 % 16;
+  Local_R2.A3 = Local_R2.A3 % 16;
+  Local_R2.B  = !Local_R2.B;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 44 8d 15 9e 40 58 34 1e\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p7.c
===================================================================
--- testsuite/c-c++-common/sso/p7.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p7.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,74 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init7.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1.I    = 0x12345678;
+  Local_R1.N.C1 = 0xAB0012;
+  Local_R1.N.C2 = 0xCD0034;
+  Local_R1.N.C3 = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = 0x12345678;
+  Local_R2.N.C1 = 0xAB0012;
+  Local_R2.N.C2 = 0xCD0034;
+  Local_R2.N.C3 = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1.I    = Local_R2.I;
+  Local_R1.N.C1 = Local_R2.N.C1;
+  Local_R1.N.C2 = Local_R2.N.C2;
+  Local_R1.N.C3 = Local_R2.N.C3;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = Local_R1.I;
+  Local_R2.N.C1 = Local_R1.N.C1;
+  Local_R2.N.C2 = Local_R1.N.C2;
+  Local_R2.N.C3 = Local_R1.N.C3;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/r5.c
===================================================================
--- testsuite/c-c++-common/sso/r5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/r5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,65 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init5.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int Get_Elem1 (struct R1 R)
+{
+  struct R1 Tmp = R;
+  return Tmp.A[0];
+}
+
+void Set_Elem1 (struct R1 *R, int I)
+{
+  struct R1 Tmp = *R;
+  Tmp.A[0] = I;
+  *R = Tmp;
+}
+
+int Get_Elem2 (struct R2 R)
+{
+  struct R2 Tmp = R;
+  return Tmp.A[0];
+}
+
+void Set_Elem2 (struct R2 *R, int I)
+{
+  struct R2 Tmp = *R;
+  Tmp.A[0] = I;
+  *R = Tmp;
+}
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  if (Get_Elem1 (A1) != 0xAB0012) abort ();
+
+  Set_Elem1 (&A1, 0xCD0034);
+  if (Get_Elem1 (A1) != 0xCD0034) abort ();
+
+  if (Get_Elem2 (A2) != 0xAB0012) abort ();
+
+  Set_Elem2 (&A2, 0xCD0034);
+  if (Get_Elem2 (A2) != 0xCD0034) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t3.c
===================================================================
--- testsuite/c-c++-common/sso/t3.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t3.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,92 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init3.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.S1   = My_R1.S1 - 1;
+  Local_R1.I    = My_R1.I + 1;
+  Local_R1.S2   = My_R1.S2 - 1;
+  Local_R1.N.C1 = My_R1.N.C1 % 16;
+  Local_R1.N.C2 = My_R1.N.C2 % 16;
+  Local_R1.N.C3 = My_R1.N.C3 % 16;
+  Local_R1.N.B  = My_R1.N.B % 2;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 01 7c f3 2a 1e 02 82 01\n" } */
+
+  Local_R2.S1   = My_R2.S1 - 1;
+  Local_R2.I    = My_R2.I + 1;
+  Local_R2.S2   = My_R2.S2 - 1;
+  Local_R2.N.C1 = My_R2.N.C1 % 16;
+  Local_R2.N.C2 = My_R2.N.C2 % 16;
+  Local_R2.N.C3 = My_R2.N.C3 % 16;
+  Local_R2.N.B  = My_R2.N.B % 2;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 05 e2 af 37 c0 04 10 30\n" } */
+
+  Local_R1.S1   = 2;
+  Local_R1.I    = 0x78ABCDEF;
+  Local_R1.S2   = 1;
+  Local_R1.N.C1 = 0x12;
+  Local_R1.N.C2 = 0x34;
+  Local_R1.N.C3 = 0x56;
+  Local_R1.N.B  = 4;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : c2 7b f3 2a 5e 12 9a 95\n" } */
+
+  Local_R2.S1   = 2;
+  Local_R2.I    = 0x78ABCDEF;
+  Local_R2.S2   = 1;
+  Local_R2.N.C1 = 0x12;
+  Local_R2.N.C2 = 0x34;
+  Local_R2.N.C3 = 0x56;
+  Local_R2.N.B  = 4;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 09 e2 af 37 bd 24 d2 b4\n" } */
+
+  Local_R1.S1   = Local_R1.S1 - 1;
+  Local_R1.I    = Local_R1.I + 1;
+  Local_R1.S2   = Local_R1.S2 - 1;
+  Local_R1.N.C1 = Local_R1.N.C1 % 16;
+  Local_R1.N.C2 = Local_R1.N.C2 % 16;
+  Local_R1.N.C3 = Local_R1.N.C3 % 16;
+  Local_R1.N.B  = Local_R1.N.B % 2;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 01 7c f3 2a 1e 02 82 01\n" } */
+
+  Local_R2.S1   = Local_R2.S1 - 1;
+  Local_R2.I    = Local_R2.I + 1;
+  Local_R2.S2   = Local_R2.S2 - 1;
+  Local_R2.N.C1 = Local_R2.N.C1 % 16;
+  Local_R2.N.C2 = Local_R2.N.C2 % 16;
+  Local_R2.N.C3 = Local_R2.N.C3 % 16;
+  Local_R2.N.B  = Local_R2.N.B % 2;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 05 e2 af 37 c0 04 10 30\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p8.c
===================================================================
--- testsuite/c-c++-common/sso/p8.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p8.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,74 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init8.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1.I    = 0x12345678;
+  Local_R1.N.C1 = 0xAB0012;
+  Local_R1.N.C2 = 0xCD0034;
+  Local_R1.N.C3 = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I    = 0x12345678;
+  Local_R2.N.C1 = 0xAB0012;
+  Local_R2.N.C2 = 0xCD0034;
+  Local_R2.N.C3 = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1.I    = Local_R2.I;
+  Local_R1.N.C1 = Local_R2.N.C1;
+  Local_R1.N.C2 = Local_R2.N.C2;
+  Local_R1.N.C3 = Local_R2.N.C3;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I    = Local_R1.I;
+  Local_R2.N.C1 = Local_R1.N.C1;
+  Local_R2.N.C2 = Local_R1.N.C2;
+  Local_R2.N.C3 = Local_R1.N.C3;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/r6.c
===================================================================
--- testsuite/c-c++-common/sso/r6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/r6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,65 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init6.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int Get_Elem1 (struct R1 R)
+{
+  struct R1 Tmp = R;
+  return Tmp.N.A[0];
+}
+
+void Set_Elem1 (struct R1 *R, int I)
+{
+  struct R1 Tmp = *R;
+  Tmp.N.A[0] = I;
+  *R = Tmp;
+}
+
+int Get_Elem2 (struct R2 R)
+{
+  struct R2 Tmp = R;
+  return Tmp.N.A[0];
+}
+
+void Set_Elem2 (struct R2 *R, int I)
+{
+  struct R2 Tmp = *R;
+  Tmp.N.A[0] = I;
+  *R = Tmp;
+}
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  if (Get_Elem1 (A1) != 0xAB0012) abort ();
+
+  Set_Elem1 (&A1, 0xCD0034);
+  if (Get_Elem1 (A1) != 0xCD0034) abort ();
+
+  if (Get_Elem2 (A2) != 0xAB0012) abort ();
+
+  Set_Elem2 (&A2, 0xCD0034);
+  if (Get_Elem2 (A2) != 0xCD0034) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t4.c
===================================================================
--- testsuite/c-c++-common/sso/t4.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t4.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init4.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.F = My_R1.F + 1.0f;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : ee 87 84 40\n" } */
+
+  Local_R2.F = My_R2.F + 1.0f;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 84 87 ee\n" } */
+
+  Local_R1.F = Pi;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : db 0f 49 40\n" } */
+
+  Local_R2.F = Pi;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 49 0f db\n" } */
+
+  Local_R1.F = Local_R1.F + 1.0f;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : ee 87 84 40\n" } */
+
+  Local_R2.F = Local_R2.F + 1.0f;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 84 87 ee\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/p9.c
===================================================================
--- testsuite/c-c++-common/sso/p9.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/p9.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,64 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init9.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  put ("My_R1    :");
+  dump (&My_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "My_R1    : 18 2d 44 54 fb 21 09 40\n" } */
+
+  put ("My_R2    :");
+  dump (&My_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "My_R2    : 40 09 21 fb 54 44 2d 18\n" } */
+
+  Local_R1 = My_R1;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" } */
+
+  Local_R2 = My_R2;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" } */
+
+  Local_R1.F = Pi;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" } */
+
+  Local_R2.F = Pi;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" } */
+
+  Local_R1.F = Local_R2.F;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" } */
+
+  Local_R2.F = Local_R1.F;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/r7.c
===================================================================
--- testsuite/c-c++-common/sso/r7.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/r7.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,65 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init7.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int Get_Elem1 (struct R1 R)
+{
+  struct R1 Tmp = R;
+  return Tmp.N.C1;
+}
+
+void Set_Elem1 (struct R1 *R, int I)
+{
+  struct R1 Tmp = *R;
+  Tmp.N.C1 = I;
+  *R = Tmp;
+}
+
+int Get_Elem2 (struct R2 R)
+{
+  struct R2 Tmp = R;
+  return Tmp.N.C1;
+}
+
+void Set_Elem2 (struct R2 *R, int I)
+{
+  struct R2 Tmp = *R;
+  Tmp.N.C1 = I;
+  *R = Tmp;
+}
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  if (Get_Elem1 (A1) != 0xAB0012) abort ();
+
+  Set_Elem1 (&A1, 0xCD0034);
+  if (Get_Elem1 (A1) != 0xCD0034) abort ();
+
+  if (Get_Elem2 (A2) != 0xAB0012) abort ();
+
+  Set_Elem2 (&A2, 0xCD0034);
+  if (Get_Elem2 (A2) != 0xCD0034) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t5.c
===================================================================
--- testsuite/c-c++-common/sso/t5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,72 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init5.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.I    = My_R1.I + 1;
+  Local_R1.A[0] = My_R1.A[0] + 1;
+  Local_R1.A[1] = My_R1.A[1] + 1;
+  Local_R1.A[2] = My_R1.A[2] + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  Local_R2.I    = My_R2.I + 1;
+  Local_R2.A[0] = My_R2.A[0] + 1;
+  Local_R2.A[1] = My_R2.A[1] + 1;
+  Local_R2.A[2] = My_R2.A[2] + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  Local_R1.I    = 0x12345678;
+  Local_R1.A[0] = 0xAB0012;
+  Local_R1.A[1] = 0xCD0034;
+  Local_R1.A[2] = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = 0x12345678;
+  Local_R2.A[0] = 0xAB0012;
+  Local_R2.A[1] = 0xCD0034;
+  Local_R2.A[2] = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1.I    = Local_R1.I + 1;
+  Local_R1.A[0] = Local_R1.A[0] + 1;
+  Local_R1.A[1] = Local_R1.A[1] + 1;
+  Local_R1.A[2] = Local_R1.A[2] + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  Local_R2.I    = Local_R2.I + 1;
+  Local_R2.A[0] = Local_R2.A[0] + 1;
+  Local_R2.A[1] = Local_R2.A[1] + 1;
+  Local_R2.A[2] = Local_R2.A[2] + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init1.h
===================================================================
--- testsuite/c-c++-common/sso/init1.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init1.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,12 @@ 
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  int I;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  int I;
+};
+
+struct R1 My_R1 = { 0x12345678 };
+struct R2 My_R2 = { 0x12345678 };
Index: testsuite/c-c++-common/sso/r8.c
===================================================================
--- testsuite/c-c++-common/sso/r8.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/r8.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,65 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init8.h"
+#include "dump.h"
+
+#ifdef __cplusplus
+extern "C"
+#endif
+void abort (void);
+
+int Get_Elem1 (struct R1 R)
+{
+  struct R1 Tmp = R;
+  return Tmp.N.C1;
+}
+
+void Set_Elem1 (struct R1 *R, int I)
+{
+  struct R1 Tmp = *R;
+  Tmp.N.C1 = I;
+  *R = Tmp;
+}
+
+int Get_Elem2 (struct R2 R)
+{
+  struct R2 Tmp = R;
+  return Tmp.N.C1;
+}
+
+void Set_Elem2 (struct R2 *R, int I)
+{
+  struct R2 Tmp = *R;
+  Tmp.N.C1 = I;
+  *R = Tmp;
+}
+
+int main (void)
+{
+  struct R1 A1 = My_R1;
+  struct R2 A2 = My_R2;
+
+  put ("A1 :");
+  dump (&A1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "A1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  put ("A2 :");
+  dump (&A2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "A2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  if (Get_Elem1 (A1) != 0xAB0012) abort ();
+
+  Set_Elem1 (&A1, 0xCD0034);
+  if (Get_Elem1 (A1) != 0xCD0034) abort ();
+
+  if (Get_Elem2 (A2) != 0xAB0012) abort ();
+
+  Set_Elem2 (&A2, 0xCD0034);
+  if (Get_Elem2 (A2) != 0xCD0034) abort ();
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/t6.c
===================================================================
--- testsuite/c-c++-common/sso/t6.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t6.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,72 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init6.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.I      = My_R1.I + 1;
+  Local_R1.N.A[0] = My_R1.N.A[0] + 1;
+  Local_R1.N.A[1] = My_R1.N.A[1] + 1;
+  Local_R1.N.A[2] = My_R1.N.A[2] + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  Local_R2.I      = My_R2.I + 1;
+  Local_R2.N.A[0] = My_R2.N.A[0] + 1;
+  Local_R2.N.A[1] = My_R2.N.A[1] + 1;
+  Local_R2.N.A[2] = My_R2.N.A[2] + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  Local_R1.I      = 0x12345678;
+  Local_R1.N.A[0] = 0xAB0012;
+  Local_R1.N.A[1] = 0xCD0034;
+  Local_R1.N.A[2] = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I      = 0x12345678;
+  Local_R2.N.A[0] = 0xAB0012;
+  Local_R2.N.A[1] = 0xCD0034;
+  Local_R2.N.A[2] = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1.I      = Local_R1.I + 1;
+  Local_R1.N.A[0] = Local_R1.N.A[0] + 1;
+  Local_R1.N.A[1] = Local_R1.N.A[1] + 1;
+  Local_R1.N.A[2] = Local_R1.N.A[2] + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  Local_R2.I      = Local_R2.I + 1;
+  Local_R2.N.A[0] = Local_R2.N.A[0] + 1;
+  Local_R2.N.A[1] = Local_R2.N.A[1] + 1;
+  Local_R2.N.A[2] = Local_R2.N.A[2] + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init2.h
===================================================================
--- testsuite/c-c++-common/sso/init2.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init2.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,24 @@ 
+struct __attribute__((scalar_storage_order("little-endian"), packed)) R1
+{
+  unsigned S1 : 2;
+  unsigned I  : 32;
+  unsigned S2 : 2;
+  unsigned A1 : 9;
+  unsigned A2 : 9;
+  unsigned A3 : 9;
+  unsigned B  : 1;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"), packed)) R2
+{
+  unsigned S1 : 2;
+  unsigned I  : 32;
+  unsigned S2 : 2;
+  unsigned A1 : 9;
+  unsigned A2 : 9;
+  unsigned A3 : 9;
+  unsigned B  : 1;
+};
+
+struct R1 My_R1 = { 2, 0x12345678, 1, 0xAB, 0xCD, 0xEF, 1 };
+struct R2 My_R2 = { 2, 0x12345678, 1, 0xAB, 0xCD, 0xEF, 1 };
Index: testsuite/c-c++-common/sso/t7.c
===================================================================
--- testsuite/c-c++-common/sso/t7.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t7.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,72 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init7.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.I    = My_R1.I + 1;
+  Local_R1.N.C1 = My_R1.N.C1 + 1;
+  Local_R1.N.C2 = My_R1.N.C2 + 1;
+  Local_R1.N.C3 = My_R1.N.C3 + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  Local_R2.I    = My_R2.I + 1;
+  Local_R2.N.C1 = My_R2.N.C1 + 1;
+  Local_R2.N.C2 = My_R2.N.C2 + 1;
+  Local_R2.N.C3 = My_R2.N.C3 + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  Local_R1.I    = 0x12345678;
+  Local_R1.N.C1 = 0xAB0012;
+  Local_R1.N.C2 = 0xCD0034;
+  Local_R1.N.C3 = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R2.I    = 0x12345678;
+  Local_R2.N.C1 = 0xAB0012;
+  Local_R2.N.C2 = 0xCD0034;
+  Local_R2.N.C3 = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R1.I    = Local_R1.I + 1;
+  Local_R1.N.C1 = Local_R1.N.C1 + 1;
+  Local_R1.N.C2 = Local_R1.N.C2 + 1;
+  Local_R1.N.C3 = Local_R1.N.C3 + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  Local_R2.I    = Local_R2.I + 1;
+  Local_R2.N.C1 = Local_R2.N.C1 + 1;
+  Local_R2.N.C2 = Local_R2.N.C2 + 1;
+  Local_R2.N.C3 = Local_R2.N.C3 + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init3.h
===================================================================
--- testsuite/c-c++-common/sso/init3.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init3.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,34 @@ 
+struct __attribute__((scalar_storage_order("little-endian"), packed)) Nested1
+{
+  unsigned C1 : 7;
+  unsigned C2 : 7;
+  unsigned C3 : 7;
+  unsigned B  : 3;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"), packed)) R1
+{
+  unsigned S1 : 6;
+  unsigned I  : 32;
+  unsigned S2 : 2;
+  struct Nested1 N;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"), packed)) Nested2
+{
+  unsigned C1 : 7;
+  unsigned C2 : 7;
+  unsigned C3 : 7;
+  unsigned B  : 3;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"), packed)) R2
+{
+  unsigned S1 : 6;
+  unsigned I  : 32;
+  unsigned S2 : 2;
+  struct Nested2 N;
+};
+
+struct R1 My_R1 = { 2, 0x78ABCDEF, 1, { 0x12, 0x34, 0x56, 4 } };
+struct R2 My_R2 = { 2, 0x78ABCDEF, 1, { 0x12, 0x34, 0x56, 4 } };
Index: testsuite/c-c++-common/sso/t8.c
===================================================================
--- testsuite/c-c++-common/sso/t8.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t8.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,72 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init8.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.I    = My_R1.I + 1;
+  Local_R1.N.C1 = My_R1.N.C1 + 1;
+  Local_R1.N.C2 = My_R1.N.C2 + 1;
+  Local_R1.N.C3 = My_R1.N.C3 + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  Local_R2.I    = My_R2.I + 1;
+  Local_R2.N.C1 = My_R2.N.C1 + 1;
+  Local_R2.N.C2 = My_R2.N.C2 + 1;
+  Local_R2.N.C3 = My_R2.N.C3 + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  Local_R1.I    = 0x12345678;
+  Local_R1.N.C1 = 0xAB0012;
+  Local_R1.N.C2 = 0xCD0034;
+  Local_R1.N.C3 = 0xEF0056;
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 78 56 34 12 00 ab 00 12 00 cd 00 34 00 ef 00 56\n" } */
+
+  Local_R2.I    = 0x12345678;
+  Local_R2.N.C1 = 0xAB0012;
+  Local_R2.N.C2 = 0xCD0034;
+  Local_R2.N.C3 = 0xEF0056;
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 78 12 00 ab 00 34 00 cd 00 56 00 ef 00\n" } */
+
+  Local_R1.I    = Local_R1.I + 1;
+  Local_R1.N.C1 = Local_R1.N.C1 + 1;
+  Local_R1.N.C2 = Local_R1.N.C2 + 1;
+  Local_R1.N.C3 = Local_R1.N.C3 + 1;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 79 56 34 12 00 ab 00 13 00 cd 00 35 00 ef 00 57\n" } */
+
+  Local_R2.I    = Local_R2.I + 1;
+  Local_R2.N.C1 = Local_R2.N.C1 + 1;
+  Local_R2.N.C2 = Local_R2.N.C2 + 1;
+  Local_R2.N.C3 = Local_R2.N.C3 + 1;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 12 34 56 79 13 00 ab 00 35 00 cd 00 57 00 ef 00\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init4.h
===================================================================
--- testsuite/c-c++-common/sso/init4.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init4.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,14 @@ 
+#define Pi 3.1415927f
+
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  float F;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  float F;
+};
+
+struct R1 My_R1 = { Pi };
+struct R2 My_R2 = { Pi };
Index: testsuite/c-c++-common/sso/t9.c
===================================================================
--- testsuite/c-c++-common/sso/t9.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/t9.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,56 @@ 
+/* { dg-do run } */
+
+#include <stdio.h>
+
+#include "init9.h"
+#include "dump.h"
+
+int main (void)
+{
+  struct R1 Local_R1;
+  struct R2 Local_R2;
+
+  Local_R1.F = My_R1.F + 1.0;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40\n" } */
+
+  Local_R2.F = My_R2.F + 1.0;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c\n" } */
+
+  Local_R1.F = Pi;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 18 2d 44 54 fb 21 09 40\n" } */
+
+  Local_R2.F = Pi;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 09 21 fb 54 44 2d 18\n" } */
+
+  Local_R1.F = Local_R1.F + 1.0;
+
+  put ("Local_R1 :");
+  dump (&Local_R1, sizeof (struct R1));
+  new_line ();
+  /* { dg-output "Local_R1 : 8c 16 22 aa fd 90 10 40\n" } */
+
+  Local_R2.F = Local_R2.F + 1.0;
+
+  put ("Local_R2 :");
+  dump (&Local_R2, sizeof (struct R2));
+  new_line ();
+  /* { dg-output "Local_R2 : 40 10 90 fd aa 22 16 8c\n" } */
+
+  return 0;
+}
Index: testsuite/c-c++-common/sso/init5.h
===================================================================
--- testsuite/c-c++-common/sso/init5.h	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso/init5.h	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,14 @@ 
+struct __attribute__((scalar_storage_order("little-endian"))) R1
+{
+  int I;
+  int A[3];
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) R2
+{
+  int I;
+  int A[3];
+};
+
+struct R1 My_R1 = { 0x12345678, { 0xAB0012, 0xCD0034, 0xEF0056 } };
+struct R2 My_R2 = { 0x12345678, { 0xAB0012, 0xCD0034, 0xEF0056 } };
Index: testsuite/c-c++-common/sso-4.c
===================================================================
--- testsuite/c-c++-common/sso-4.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-4.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,24 @@ 
+/* Test support of scalar_storage_order attribute */
+
+/* { dg-do compile } */
+
+struct S3
+{
+  struct __attribute__((scalar_storage_order("big-endian"))) S1
+  {
+    int i;
+  } s1;
+};
+
+struct S4
+{
+  struct __attribute__((scalar_storage_order("little-endian"))) S2
+  {
+    int i;
+  } s2;
+};
+
+void incompatible_assign (struct S3 *s3, struct S4 *s4)
+{
+  s3->s1 = s4->s2; /* { dg-error "(incompatible types|no match)" } */
+}
Index: testsuite/c-c++-common/sso-1.c
===================================================================
--- testsuite/c-c++-common/sso-1.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-1.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,94 @@ 
+/* Test support of scalar_storage_order attribute */
+
+/* { dg-do compile } */
+
+struct __attribute__((scalar_storage_order("big-endian"))) S1
+{
+  int i;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) S2
+{
+  int i;
+};
+
+struct __attribute__((scalar_storage_order("other"))) S3 { int i; }; /* { dg-error "must be one of .big-endian. or .little-endian." } */
+
+void incompatible_assign (struct S1 *s1, struct S2 *s2)
+{
+  *s1 = *s2; /* { dg-error "(incompatible types|no match)" } */
+}
+
+int *addr1 (int which, struct S1 *s1, struct S2 *s2)
+{
+  return (which == 1 ? &s1->i : &s2->i); /* { dg-error "address of scalar with reverse storage order" } */
+}
+
+struct __attribute__((scalar_storage_order("big-endian"))) S4
+{
+  int a[4];
+  struct S2 s2;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) S5
+{
+  int a[4];
+  struct S1 s1;
+};
+
+void *addr2 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)s4->a : (void *)s5->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr3 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)&s4->a : (void *)&s5->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr4 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)&s4->a[0] : (void *)&s5->a[0]); /* { dg-error "address of scalar with reverse storage order" } */
+}
+
+void *addr5 (int which, struct S4 *s4, struct S5 *s5)
+{
+  return (which == 1 ? (void *)&s4->s2 : (void *) &s5->s1); /* ok */
+}
+
+struct __attribute__((scalar_storage_order("big-endian"))) S6
+{
+  int a[4][2];
+  struct S2 s2[2];
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) S7
+{
+  int a[4][2];
+  struct S1 s1[2];
+};
+
+void *addr6 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)s6->a : (void *)s7->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr7 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->a : (void *)&s7->a); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr8 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->a[0] : (void *)&s7->a[0]); /* { dg-warning "address of array with reverse scalar storage order" } */
+}
+
+void *addr9 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->a[0][0] : (void *)&s7->a[0][0]); /* { dg-error "address of scalar with reverse storage order" } */
+}
+
+void *addr10 (int which, struct S6 *s6, struct S7 *s7)
+{
+  return (which == 1 ? (void *)&s6->s2 : (void *)&s7->s1); /* ok */
+}
Index: testsuite/c-c++-common/sso-5.c
===================================================================
--- testsuite/c-c++-common/sso-5.c	(.../trunk/gcc)	(revision 0)
+++ testsuite/c-c++-common/sso-5.c	(.../branches/scalar-storage-order/gcc)	(revision 228133)
@@ -0,0 +1,72 @@ 
+/* Test support of scalar_storage_order pragma */
+
+/* { dg-do run } */
+
+#pragma scalar_storage_order /* { dg-warning "missing .big-endian.little-endian.default." } */
+
+#pragma scalar_storage_order big-endian
+
+struct S1
+{
+  int i;
+};
+
+struct __attribute__((scalar_storage_order("little-endian"))) S2
+{
+  int i;
+};
+
+#pragma scalar_storage_order little-endian
+
+struct S3
+{
+  int i;
+};
+
+struct __attribute__((scalar_storage_order("big-endian"))) S4
+{
+  int i;
+};
+
+#pragma scalar_storage_order default
+
+struct S5
+{
+  int i;
+};
+
+#pragma scalar_storage_order other /* { dg-warning "expected .big-endian.little-endian.default." } */
+
+struct S1 my_s1 = { 0x12345678 };
+struct S2 my_s2 = { 0x12345678 };
+struct S3 my_s3 = { 0x12345678 };
+struct S4 my_s4 = { 0x12345678 };
+struct S5 my_s5 = { 0x12345678 };
+
+unsigned char big_endian_pattern[4] = { 0x12, 0x34, 0x56, 0x78 };
+unsigned char little_endian_pattern[4] = { 0x78, 0x56, 0x34, 0x12 };
+
+int main (void)
+{
+  if (__builtin_memcmp (&my_s1, &big_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s2, &little_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s3, &little_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+  if (__builtin_memcmp (&my_s4, &big_endian_pattern, 4) != 0)
+    __builtin_abort ();
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+  if (__builtin_memcmp (&my_s5, &little_endian_pattern, 4) != 0)
+    __builtin_abort ();
+#else
+  if (__builtin_memcmp (&my_s5, &big_endian_pattern, 4) != 0)
+    __builtin_abort ();
+#endif
+
+  return 0;
+}