OSDN Git Service

* gcc-interface/trans.c (Call_to_gnu): Robustify test for function case
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jul 2012 09:08:26 +0000 (09:08 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 3 Jul 2012 09:08:26 +0000 (09:08 +0000)
if the CICO mechanism is used.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189205 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/trans.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/recursive_call.adb [new file with mode: 0644]

index d2f81a6..0352c4b 100644 (file)
@@ -1,5 +1,10 @@
 2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
 
 2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/trans.c (Call_to_gnu): Robustify test for function case
+       if the CICO mechanism is used.
+
+2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gcc-interface/utils2.c (build_simple_component_ref): Do not look
        through an extension if the type contains a placeholder.
 
        * gcc-interface/utils2.c (build_simple_component_ref): Do not look
        through an extension if the type contains a placeholder.
 
index ba07832..50e8692 100644 (file)
@@ -4060,7 +4060,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
 
       /* The first entry is for the actual return value if this is a
         function, so skip it.  */
 
       /* The first entry is for the actual return value if this is a
         function, so skip it.  */
-      if (TREE_VALUE (gnu_cico_list) == void_type_node)
+      if (function_call)
        gnu_cico_list = TREE_CHAIN (gnu_cico_list);
 
       if (Nkind (Name (gnat_node)) == N_Explicit_Dereference)
        gnu_cico_list = TREE_CHAIN (gnu_cico_list);
 
       if (Nkind (Name (gnat_node)) == N_Explicit_Dereference)
@@ -4164,8 +4164,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target,
         return value from it and update the return type.  */
       if (TYPE_CI_CO_LIST (gnu_subprog_type))
        {
         return value from it and update the return type.  */
       if (TYPE_CI_CO_LIST (gnu_subprog_type))
        {
-         tree gnu_elmt = value_member (void_type_node,
-                                       TYPE_CI_CO_LIST (gnu_subprog_type));
+         tree gnu_elmt = TYPE_CI_CO_LIST (gnu_subprog_type);
          gnu_call = build_component_ref (gnu_call, NULL_TREE,
                                          TREE_PURPOSE (gnu_elmt), false);
          gnu_result_type = TREE_TYPE (gnu_call);
          gnu_call = build_component_ref (gnu_call, NULL_TREE,
                                          TREE_PURPOSE (gnu_elmt), false);
          gnu_result_type = TREE_TYPE (gnu_call);
index 1310d41..cb6d784 100644 (file)
@@ -1,5 +1,9 @@
 2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
 
 2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gnat.dg/recursive_call.adb: New test.
+
+2012-07-03  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gnat.dg/discr37.ad[sb]: New test.
 
 2012-07-02  Jason Merrill  <jason@redhat.com>
        * gnat.dg/discr37.ad[sb]: New test.
 
 2012-07-02  Jason Merrill  <jason@redhat.com>
diff --git a/gcc/testsuite/gnat.dg/recursive_call.adb b/gcc/testsuite/gnat.dg/recursive_call.adb
new file mode 100644 (file)
index 0000000..ab60e44
--- /dev/null
@@ -0,0 +1,10 @@
+-- { dg-do compile }
+-- { dg-options "-gnat2012" }
+
+function Recursive_Call (File : String; Status : out Boolean) return Boolean is
+begin
+  if File /= "/dev/null" then
+    return Recursive_Call ("/dev/null", Status);
+  end if;
+  return False;
+end;