This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran] PR42354, accepts invalid init expr


Hi all.

Functions from ISO_C_BINDING are generally not allowed in initialization 
expressions (exception C_SIZEOF in F2008). Attached simple patch rejects any 
specification function that has 'is_iso_c' set - which is currently not a 
problem for the exception as C_SIZEOF is (a) in the wrong scope (see PR40568) 
and (b) generally being rejected as initialization expression (not marked 
CLASS_INQUIRY, not in the list of intrinsics being allowed in init 
expressions). I'll add a note to PR40568 if this change goes in.


2009-12-12  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/42354
	* expr.c (check_specification_function): Reject
	functions from ISO_C_BINDING.

2009-12-12  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/42354
	* gfortran.dg/iso_c_binding_init_expr.f03: New.


Regression tested on i686-pc-linux-gnu. Ok for trunk?

Cheers

	Daniel
Index: expr.c
===================================================================
--- expr.c	(revision 155189)
+++ expr.c	(working copy)
@@ -741,7 +741,9 @@ check_specification_function (gfc_expr *
   sym = e->symtree->n.sym;
 
   /* F95, 7.1.6.2; F2003, 7.1.7  */
+  /* FIXME F2008: C_SIZEOF of ISO_C_BINDING is allowed (see also PR40568) */
   if (sym
+      && !sym->attr.is_iso_c
       && sym->attr.function
       && sym->attr.pure
       && !sym->attr.intrinsic

Attachment: iso_c_binding_init_expr.f03
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]