Bug 39692 - f95: conflict between EXTERNAL and POINTER
Summary: f95: conflict between EXTERNAL and POINTER
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: janus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-09 08:25 UTC by janus
Modified: 2009-04-11 10:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2009-04-11 10:32:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janus 2009-04-09 08:25:23 UTC
In the Fortran95 standard, section 5.1, one finds:

Constraint: If the POINTER attribute is specified, the TARGET, INTENT, EXTERNAL, or INTRINSIC attribute shall not be specified.

Thus, the following should be rejected with -std=f95:

 external f
 pointer f

And consequently also something like this:

function f()
 intrinsic sin
 external f
 pointer f
 real f
! ICE without the following line
! strange error with that line
!  f => sin
end function f
Comment 1 Dominique d'Humieres 2009-04-09 08:39:30 UTC
After removing the comment in the line

!  f => sin

I get on powerpc-apple-darwin9, revision 145779:

[karma] f90/bug% gfc pr39692.f90
pr39692.f90:3.11:

 external f
           1
Error: EXTERNAL attribute conflicts with FUNCTION attribute at (1)
pr39692.f90:8.10:

  f => sin
          1
Error: Function 'sin' requires an argument list at (1)

If I comment the external declaration, I still get the same error for "f => sin".

Comment 2 janus 2009-04-11 10:30:50 UTC
Subject: Bug 39692

Author: janus
Date: Sat Apr 11 10:30:29 2009
New Revision: 145955

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=145955
Log:
2009-04-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39692
	* symbol.c (check_conflict): Reject procedure pointers for -std=f95.


2009-04-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/39692
	* gfortran.dg/proc_ptr_14.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/proc_ptr_14.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 janus 2009-04-11 10:32:34 UTC
Fixed with r145955. Closing.