2015-11-25 Arnaud Charlet <charlet@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 2015 15:16:44 +0000 (15:16 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Nov 2015 15:16:44 +0000 (15:16 +0000)
* exp_util.adb (Remove_Side_Effects): Minimize extra temporaries
and use of 'Reference when needed.

2015-11-25  Doug Rupp  <rupp@adacore.com>

* sigtramp-vxworks-target.inc (__x86_64__): Restore context for the
sake of uniformity.
* init.c (__gnat_inum_to_ivec): Add some casting to avoid
warnings when sizeof(long) != sizeof(int)

2015-11-25  Yannick Moy  <moy@adacore.com>

* lib-xref-spark_specific.adb (SPARK_Entities): Add entries for
consideration.
(Add_SPARK_Scope): Take tasks into account.
(Detect_And_Add_SPARK_Scope): Take tasks into account.
(Enclosing_Subprogram_Or_Library_Package): Take tasks into account.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230878 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/exp_util.adb
gcc/ada/init.c
gcc/ada/lib-xref-spark_specific.adb
gcc/ada/sigtramp-vxworks-target.inc

index 19ddd9f..db50698 100644 (file)
@@ -1,3 +1,23 @@
+2015-11-25  Arnaud Charlet  <charlet@adacore.com>
+
+       * exp_util.adb (Remove_Side_Effects): Minimize extra temporaries
+       and use of 'Reference when needed.
+
+2015-11-25  Doug Rupp  <rupp@adacore.com>
+
+       * sigtramp-vxworks-target.inc (__x86_64__): Restore context for the
+       sake of uniformity.
+       * init.c (__gnat_inum_to_ivec): Add some casting to avoid
+       warnings when sizeof(long) != sizeof(int)
+
+2015-11-25  Yannick Moy  <moy@adacore.com>
+
+       * lib-xref-spark_specific.adb (SPARK_Entities): Add entries for
+       consideration.
+       (Add_SPARK_Scope): Take tasks into account.
+       (Detect_And_Add_SPARK_Scope): Take tasks into account.
+       (Enclosing_Subprogram_Or_Library_Package): Take tasks into account.
+
 2015-11-25  Bob Duff  <duff@adacore.com>
 
        * sem_elab.adb (Check_Internal_Call_Continue): Code clean ups.
index 3d534bd..55836e1 100644 (file)
@@ -7816,9 +7816,10 @@ package body Exp_Util is
       else
          --  An expression which is in SPARK mode is considered side effect
          --  free if the resulting value is captured by a variable or a
-         --  constant.
+         --  constant. Same reasoning when generating C code.
+         --  Why can't we apply this test in general???
 
-         if GNATprove_Mode
+         if (GNATprove_Mode or Generate_C_Code)
            and then Nkind (Parent (Exp)) = N_Object_Declaration
          then
             goto Leave;
@@ -7862,8 +7863,10 @@ package body Exp_Util is
          --  the secondary stack. Since SPARK (and why) cannot process access
          --  types, use a different approach which ignores the secondary stack
          --  and "copies" the returned object.
+         --  When generating C code, no need for a 'reference since the
+         --  secondary stack is not supported.
 
-         if GNATprove_Mode then
+         if GNATprove_Mode or Generate_C_Code then
             Res := New_Occurrence_Of (Def_Id, Loc);
             Ref_Type := Exp_Type;
 
@@ -7898,10 +7901,10 @@ package body Exp_Util is
          else
             E := Relocate_Node (E);
 
-            --  Do not generate a 'reference in SPARK mode since the access
-            --  type is not created in the first place.
+            --  Do not generate a 'reference in SPARK mode or C generation
+            --  since the access type is not created in the first place.
 
-            if GNATprove_Mode then
+            if GNATprove_Mode or Generate_C_Code then
                New_Exp := E;
 
             --  Otherwise generate reference, marking the value as non-null
index 06e366d..2f01c8d 100644 (file)
@@ -1732,7 +1732,7 @@ extern int __gnat_inum_to_ivec (int);
 int
 __gnat_inum_to_ivec (int num)
 {
-  return (int) INUM_TO_IVEC (num);
+  return (int) ((long) INUM_TO_IVEC ((long) num));
 }
 #endif
 
@@ -1985,14 +1985,14 @@ __gnat_error_handler (int sig, siginfo_t *si, void *sc)
 #ifdef HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE
   /* We need to sometimes to adjust the PC in case of signals so that it
      doesn't reference the exception that actually raised the signal but the
-     instruction before it. */
+     instruction before it.  */
   __gnat_adjust_context_for_raise (sig, sc);
 #endif
 
 #if defined (__i386__) && !defined (VTHREADS) && (__WRS_VXWORKS_MAJOR < 7)
    /* On x86, the vxsim signal context is subtly different and is processeed
       by a handler compiled especially for vxsim.
-      Vxsim is not supported anymore on our vxworks-7 port. */
+      Vxsim is not supported anymore on our vxworks-7 port.  */
 
   if (is_vxsim)
     __gnat_vxsim_error_handler (sig, si, sc);
@@ -2115,9 +2115,9 @@ __gnat_init_float (void)
 #endif
 #endif
 
-#if defined (__i386__) && !defined (VTHREADS)
+#if (defined (__i386__) && !defined (VTHREADS))
   /* This is used to properly initialize the FPU on an x86 for each
-     process thread.  */
+     process thread. Is this needed for x86_64 ???  */
   asm ("finit");
 #endif
 
index 43a0237..b570725 100644 (file)
@@ -40,6 +40,7 @@ package body SPARK_Specific is
 
    SPARK_Entities : constant array (Entity_Kind) of Boolean :=
      (E_Constant         => True,
+      E_Entry            => True,
       E_Function         => True,
       E_In_Out_Parameter => True,
       E_In_Parameter     => True,
@@ -268,7 +269,7 @@ package body SPARK_Specific is
          =>
             Typ := Xref_Entity_Letters (Ekind (E));
 
-         when E_Package_Body | E_Subprogram_Body =>
+         when E_Package_Body | E_Subprogram_Body | E_Task_Body =>
             Typ := Xref_Entity_Letters (Ekind (Unique_Entity (E)));
 
          when E_Void =>
@@ -1006,14 +1007,19 @@ package body SPARK_Specific is
 
    procedure Detect_And_Add_SPARK_Scope (N : Node_Id) is
    begin
-      if Nkind_In (N, N_Entry_Body,
-                      N_Entry_Declaration,
-                      N_Package_Body,
+      if Nkind_In (N, N_Entry_Body,             --  entries
+                      N_Entry_Declaration)
+           or else
+         Nkind_In (N, N_Package_Body,           --  packages
                       N_Package_Body_Stub,
-                      N_Package_Declaration,
-                      N_Subprogram_Body,
+                      N_Package_Declaration)
+           or else
+         Nkind_In (N, N_Subprogram_Body,        --  subprograms
                       N_Subprogram_Body_Stub,
                       N_Subprogram_Declaration)
+           or else
+         Nkind_In (N, N_Task_Body,              --  tasks
+                      N_Task_Body_Stub)
       then
          Add_SPARK_Scope (N);
       end if;
@@ -1105,6 +1111,10 @@ package body SPARK_Specific is
                Result := Defining_Identifier (Result);
                exit;
 
+            when N_Task_Body =>
+               Result := Defining_Identifier (Result);
+               exit;
+
             when others =>
                Result := Parent (Result);
          end case;
index fbb708b..a031360 100644 (file)
@@ -441,6 +441,7 @@ TCR("# Call the real handler. The signo, siginfo and sigcontext") \
 TCR("# arguments are the same as those we received") \
 TCR("call      *%rcx") \
 TCR("# This part should never be executed") \
+TCR("addq      $8, %rsp") \
 TCR("ret")
 
 #else