Bug 16136 - Conflicting attributes ALLOCATABLE, DUMMY (F2003)
Summary: Conflicting attributes ALLOCATABLE, DUMMY (F2003)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: 4.2.0
Assignee: eedelman
URL:
Keywords: rejects-valid
Depends on: 20541
Blocks: 20585
  Show dependency treegraph
 
Reported: 2004-06-22 11:01 UTC by Victor Leikehman
Modified: 2006-03-14 01:24 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-15 05:02:03


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Leikehman 2004-06-22 11:01:40 UTC
subroutine foo(x)
integer, allocatable :: x(:)
end

----------------------

integer, allocatable :: x(:)
                        1
Error: ALLOCATABLE attribute conflicts with DUMMY attribute at (1)

----------------------

Combining ALLOCATABLE and DUMMY attributes is okay, IMHO.

The Standard says (12.4.1.2, Actual arguments associated with
dummy data objects): "If a dummy argument is allocatable or a 
pointer, the associated actual argument shall be polymorphic 
[etc etc]".  

IBM xlf compiler accepts this, too.
Comment 1 Paul Brook 2004-06-22 11:27:14 UTC
This is a F2003 extension. 
Comment 2 Andrew Pinski 2006-01-10 04:01:46 UTC
Related to PR 20541.
Comment 3 patchapp@dberlin.org 2006-03-03 00:40:25 UTC
Subject: Bug number PR 16136

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00173.html
Comment 4 eedelman 2006-03-05 19:24:51 UTC
Subject: Bug 16136

Author: eedelman
Date: Sun Mar  5 19:24:48 2006
New Revision: 111741

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111741
Log:
fortran/
2005-03-05  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/16136
        * symbol.c (conf_std): New macro.
        (check_conflict): Use it to allow ALLOCATABLE dummy
        arguments for F2003.
        * trans-expr.c (gfc_conv_function_call): Pass the
        address of the array descriptor when dummy argument is
        ALLOCATABLE.
        * interface.c (compare_allocatable): New function.
        (compare_actual_formal): Use it.
        resolve.c (resolve_deallocate_expr,
        resolve_allocate_expr): Check that INTENT(IN) variables
        aren't (de)allocated.
        * gfortran.texi (Fortran 2003 status): List ALLOCATABLE
        dummy arguments as supported.

testsuite/
2005-03-05  Erik Edelmann  <eedelman@gcc.gnu.org>

        PR fortran/16136
        * allocatable_dummy_1.f90: New.
        * allocatable_dummy_2.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/allocatable_dummy_1.f90
    trunk/gcc/testsuite/gfortran.dg/allocatable_dummy_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/gfortran.texi
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 eedelman 2006-03-06 12:52:58 UTC
Works on mainline (will become 4.2).  Will (probably) not be backported to 4.1.