[Bug middle-end/36671] [4.4 Regression]: gfortran.dg/associated_1.f90

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jun 30 09:52:00 GMT 2008



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-06-30 09:51 -------
The problem is that the function x has the MALLOC flag.  Why is this so?  This
causes the use of the argument memory to be missed.

I see in generic trans-decl.c code

/* Get a basic decl for an external function.  */

tree
gfc_get_extern_function_decl (gfc_symbol * sym)
{
...

  /* If the return type is a pointer, avoid alias issues by setting
     DECL_IS_MALLOC to nonzero. This means that the function should be
     treated as if it were a malloc, meaning it returns a pointer that
     is not an alias.  */
  if (POINTER_TYPE_P (type))
    DECL_IS_MALLOC (fndecl) = 1;



static void
build_function_decl (gfc_symbol * sym)
{
...

  /* If the return type is a pointer, avoid alias issues by setting
     DECL_IS_MALLOC to nonzero. This means that the function should be
     treated as if it were a malloc, meaning it returns a pointer that
     is not an alias.  */
  if (POINTER_TYPE_P (type))
    DECL_IS_MALLOC (fndecl) = 1;


I guess I'll have to re-organize the code to not ignore arguments to
malloc functions.

Anyway, the patch only uncovered this latent problem :(


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-06-30 09:51:50
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36671



More information about the Gcc-bugs mailing list