This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] PR33310, PR33284: Add conflicts between PARAMETER and Bind(C); between ENTRY and INTRINSIC
- From: Tobias Burnus <burnus at net-b dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 05 Sep 2007 16:39:21 +0200
- Subject: Re: [Patch, Fortran] PR33310, PR33284: Add conflicts between PARAMETER and Bind(C); between ENTRY and INTRINSIC
- References: <46DEB633.1000702@net-b.de> <20070905143208.GA39943@troutmask.apl.washington.edu>
Steve Kargl wrote:
> You forgot to add the patch
Thanks for the reminder. I attached it now.
Tobias
2007-09-05 Tobias Burnus <burnus@net-b.de>
PR fortran/33284
PR fortran/33310
* symbol.c (check_conflict): Add conflict between INTRINSIC and ENTRY
and between BIND(C) and PARAMETER.
2007-09-05 Tobias Burnus <burnus@net-b.de>
PR fortran/33284
PR fortran/33310
* gfortran.dg/conflicts_2.f90: New.
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 128123)
+++ gcc/fortran/symbol.c (working copy)
@@ -424,32 +424,33 @@ check_conflict (symbol_attribute *attr,
}
}
conf (dummy, entry);
conf (dummy, intrinsic);
conf (dummy, threadprivate);
conf (pointer, target);
conf (pointer, intrinsic);
conf (pointer, elemental);
conf (allocatable, elemental);
conf (target, external);
conf (target, intrinsic);
conf (external, dimension); /* See Fortran 95's R504. */
conf (external, intrinsic);
+ conf (entry, intrinsic);
if ((attr->if_source && !attr->procedure) || attr->contained)
{
conf (external, subroutine);
conf (external, function);
}
conf (allocatable, pointer);
conf_std (allocatable, dummy, GFC_STD_F2003);
conf_std (allocatable, function, GFC_STD_F2003);
conf_std (allocatable, result, GFC_STD_F2003);
conf (elemental, recursive);
conf (in_common, dummy);
conf (in_common, allocatable);
conf (in_common, result);
@@ -660,34 +661,34 @@ check_conflict (symbol_attribute *attr,
case FL_PARAMETER:
conf2 (external);
conf2 (intrinsic);
conf2 (optional);
conf2 (allocatable);
conf2 (function);
conf2 (subroutine);
conf2 (entry);
conf2 (pointer);
conf2 (protected);
conf2 (target);
conf2 (dummy);
conf2 (in_common);
conf2 (value);
conf2 (volatile_);
conf2 (threadprivate);
- /* TODO: hmm, double check this. */
conf2 (value);
+ conf2 (is_bind_c);
break;
default:
break;
}
return SUCCESS;
conflict:
if (name == NULL)
gfc_error ("%s attribute conflicts with %s attribute at %L",
a1, a2, where);
else
gfc_error ("%s attribute conflicts with %s attribute in '%s' at %L",
a1, a2, name, where);
Index: gcc/testsuite/gfortran.dg/conflicts_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/conflicts_2.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/conflicts_2.f90 (revision 0)
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! Check conflicts:
+! - PARAMETER and BIND(C), PR fortran/33310
+! - INTRINSIC and ENTRY, PR fortran/33284
+!
+
+subroutine a
+ intrinsic cos
+entry cos(x) ! { dg-error "ENTRY attribute conflicts with INTRINSIC" }
+ real x
+ x = 0
+end subroutine
+
+module m
+ use iso_c_binding
+ implicit none
+ TYPE, bind(C) :: the_distribution
+ INTEGER(c_int) :: parameters(1)
+ END TYPE the_distribution
+ TYPE (the_distribution), parameter, bind(C) :: & ! { dg-error "PARAMETER attribute conflicts with BIND.C." }
+ the_beta = the_distribution((/0/))
+end module m
+
+end