[PATCH] Fix PR ada/23995

Eric Botcazou ebotcazou@adacore.com
Thu Nov 10 11:34:00 GMT 2005


This is a regression present on 4.0 branch and latent on mainline.  In Gigi we 
have a special mechanism for passing non-addressable In Out by-ref 
parameters:

   /* If we are passing a non-addressable Out or In Out parameter by
       reference, pass the addres of a copy and set up to copy back out
       after the call.  */

      if (Ekind (gnat_formal) != E_In_Parameter)
        {
          gnu_name = gnat_stabilize_reference (gnu_name, true);
          if (!addressable_p (gnu_name)
              && gnu_formal
              && (DECL_BY_REF_P (gnu_formal)
                  || (TREE_CODE (gnu_formal) == PARM_DECL
                      && (DECL_BY_COMPONENT_PTR_P (gnu_formal)
                          || (DECL_BY_DESCRIPTOR_P (gnu_formal))))))
            {

[...]

              gnu_actual = save_expr (gnu_name);

[...]

            }
        }

      /* If this was a procedure call, we may not have removed any padding.
         So do it here for the part we will use as an input, if any.  */
      gnu_actual = gnu_name;


The statement

    gnu_name = gnu_actual;

present between the 2 assignments in 3.4.x has been lost in translation, thus 
effectively disabling the mechanism.

Tested on SPARC/Solaris and x86-64/Linux, applied to mainline and 4.0 branch.


2005-11-10  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/23995
	* trans.c (call_to_gnu): Restore statement lost in translation.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr23995.diff
Type: text/x-diff
Size: 449 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20051110/46880037/attachment.bin>


More information about the Gcc-patches mailing list