+2014-10-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * stor-layout.c (self_referential_size): Do not promote arguments.
+
2014-10-15 Marek Polacek <polacek@redhat.com>
* doc/invoke.texi: Update to reflect that GNU11 is the default
param_type = TREE_TYPE (ref);
param_decl
= build_decl (input_location, PARM_DECL, param_name, param_type);
- if (targetm.calls.promote_prototypes (NULL_TREE)
- && INTEGRAL_TYPE_P (param_type)
- && TYPE_PRECISION (param_type) < TYPE_PRECISION (integer_type_node))
- DECL_ARG_TYPE (param_decl) = integer_type_node;
- else
- DECL_ARG_TYPE (param_decl) = param_type;
+ DECL_ARG_TYPE (param_decl) = param_type;
DECL_ARTIFICIAL (param_decl) = 1;
TREE_READONLY (param_decl) = 1;
+2014-10-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt41.adb: New test.
+ * gnat.dg/opt41_pkg.ad[sb]: New helper.
+
2014-10-15 Richard Biener <rguenther@suse.de>
* g++.dg/torture/pr63419.C: Add -Wno-psabi.
--- /dev/null
+-- { dg-do run }
+-- { dg-options "-Os" }
+
+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+with Opt41_Pkg; use Opt41_Pkg;
+
+procedure Opt41 is
+ R : Rec := (Five, To_Unbounded_String ("CONFIG"));
+ SP : String_Access := new String'(To_String (Rec_Write (R)));
+ RP : Rec_Ptr := new Rec'(Rec_Read (SP));
+begin
+ if RP.D /= R.D then
+ raise Program_Error;
+ end if;
+end;
--- /dev/null
+with Ada.Streams; use Ada.Streams;\r
+\r
+package body Opt41_Pkg is\r
+\r
+ type Wstream is new Root_Stream_Type with record\r
+ S : Unbounded_String;\r
+ end record;\r
+\r
+ procedure Read (Stream : in out Wstream;\r
+ Item : out Stream_Element_Array;\r
+ Last : out Stream_Element_Offset) is null;\r
+\r
+ procedure Write (Stream : in out Wstream; Item : Stream_Element_Array) is\r
+ begin\r
+ for J in Item'Range loop\r
+ Append (Stream.S, Character'Val (Item (J)));\r
+ end loop;\r
+ end Write;\r
+\r
+ function Rec_Write (R : Rec) return Unbounded_String is\r
+ S : aliased Wstream;\r
+ begin\r
+ Rec'Output (S'Access, R);\r
+ return S.S;\r
+ end Rec_Write;\r
+\r
+ type Rstream is new Root_Stream_Type with record\r
+ S : String_Access;\r
+ Idx : Integer := 1;\r
+ end record;\r
+\r
+ procedure Write (Stream : in out Rstream; Item : Stream_Element_Array) is null;\r
+\r
+ procedure Read (Stream : in out Rstream;\r
+ Item : out Stream_Element_Array;\r
+ Last : out Stream_Element_Offset) is\r
+ begin\r
+ Last := Stream_Element_Offset'Min\r
+ (Item'Last, Item'First + Stream_Element_Offset (Stream.S'Last - Stream.Idx));\r
+ for I in Item'First .. Last loop\r
+ Item (I) := Stream_Element (Character'Pos (Stream.S (Stream.Idx)));\r
+ Stream.Idx := Stream.Idx + 1;\r
+ end loop;\r
+ end Read;\r
+\r
+ function Rec_Read (Str : String_Access) return Rec is\r
+ S : aliased Rstream;\r
+ begin\r
+ S.S := Str;\r
+ return Rec'Input (S'Access);\r
+ end Rec_Read;\r
+\r
+end Opt41_Pkg;\r
--- /dev/null
+with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;\r
+\r
+package Opt41_Pkg is\r
+\r
+ type Enum is (One, Two, Three, Four, Five, Six);\r
+\r
+ type Rec (D : Enum) is record\r
+ case D is\r
+ when One => \r
+ I : Integer;\r
+ when Two | Five | Six =>\r
+ S : Unbounded_String;\r
+ case D is\r
+ when Two => B : Boolean;\r
+ when others => null;\r
+ end case;\r
+ when others =>\r
+ null;\r
+ end case;\r
+ end record;\r
+\r
+ type Rec_Ptr is access all Rec;\r
+\r
+ function Rec_Write (R : Rec) return Unbounded_String;\r
+\r
+ function Rec_Read (Str : String_Access) return Rec;\r
+\r
+end Opt41_Pkg;\r