[Bug fortran/33957] gfortran rejects valid initialization expression

2007-11-16 Thread fxcoudert at gcc dot gnu dot org


--- Comment #7 from fxcoudert at gcc dot gnu dot org  2007-11-16 22:40 
---
Fixed.


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.3.0


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-11-16 Thread fxcoudert at gcc dot gnu dot org


--- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-11-16 22:38 
---
Subject: Bug 33957

Author: fxcoudert
Date: Fri Nov 16 22:38:21 2007
New Revision: 130246

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130246
Log:
PR fortran/33957

* gfortran.dg/initialization_15.f90 : New test.

* expr.c (check_inquiry): Don't call gfc_error now.

Added:
trunk/gcc/testsuite/gfortran.dg/initialization_15.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/expr.c
trunk/gcc/testsuite/ChangeLog


-- 


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-11-08 Thread fxcoudert at gcc dot gnu dot org


--- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-11-09 01:25 
---
The patch below should do it.

Index: expr.c
===
--- expr.c  (revision 129869)
+++ expr.c  (working copy)
@@ -1981,11 +1981,7 @@ check_inquiry (gfc_expr *e, int not_rest
   break;

   if (functions[i] == NULL)
-{
-  gfc_error ("Inquiry function '%s' at %L is not permitted "
-"in an initialization expression", name, &e->where);
-  return MATCH_ERROR;
-}
+return MATCH_ERROR;

   /* At this point we have an inquiry function with a variable argument.  The
  type of the variable might be undefined, but we need it now, because the


-- 

fxcoudert at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||fxcoudert at gcc dot gnu dot
   ||org
 AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Keywords||patch
   Last reconfirmed|2007-10-31 19:20:31 |2007-11-09 01:25:46
   date||


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-10-31 Thread jv244 at cam dot ac dot uk


-- 

jv244 at cam dot ac dot uk changed:

   What|Removed |Added

OtherBugsDependingO||32834
  nThis||
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2007-10-31 19:20:31
   date||


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-10-31 Thread tow21 at cam dot ac dot uk


--- Comment #4 from tow21 at cam dot ac dot uk  2007-10-31 13:58 ---
(Sorry for mis-typed example, I can't cut & paste from the VM I'm working in
into my web-browser. Your corrected version is what I meant to type)

Well I'm going from the F95 standard (which is the only one I have to hand; and
in any case I am trying to write F95-compliant code here, so I'm not overly
concerned about F2003 personally). F95 has no concept of a "specification
inquiry" (that I can see). Section (7) of the definition of a "restricted
expression" seems to cover mostly the same ground, and reads in full:

(7) A reference to an intrinsic function that is
  (a) an array inquiry function (13.11.15) other than ALLOCATED,
  (b) the bit inquiry function BIT_SIZE
  (c) the character enquiry function LEN
  (d) the kind inquire function KIND, or
  (e) a numeric inquiry function (13.11.8)
and where each argument of the function is
  (a) a restricted expression
  (b) a variable whose properties inquired about are not 
(i) dependent on the upper bound of the last dimension of an assumed-size
array,
(ii) defined by an expression that is not a restricted expression, or
(iii) definable by an ALLOCATE or pointer assignment expression

That is - the expression is not allowed under (7) - but it is under (8).


-- 


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-10-31 Thread dominiq at lps dot ens dot fr


--- Comment #3 from dominiq at lps dot ens dot fr  2007-10-31 13:33 ---
(7) A specification inquiry where each designator or function argument is
 (a) a restricted expression or
 (b) a variable whose properties inquired about are not
  (i) dependent on the upper bound of the last dimension of an assumed-size
array,
  (ii) deferred, or
  (iii) defined by an expression that is not a restricted expression,
 (8) A reference to any other standard intrinsic function where each argument
is a restricted expression,

A specification inquiry is a reference to
(1) an array inquiry function (13.5.7),
(2) the bit inquiry function BIT_SIZE,
(3) the character inquiry function LEN,
(4) the kind inquiry function KIND,
(5) the character inquiry function NEW_LINE,
(6) a numeric inquiry function (13.5.6),
(7) a type parameter inquiry (6.1.3), or
(8) an IEEE inquiry function (14.9.1),

ASSOCIATED appears in 13.5.8, but is not listed above, so it is probably not a
valid "specification inquiry" however this restriction seems lifted by (8) (it
is probably the appropriate time to have a "simplified" F2003 draft!-).

13.5.8 Other inquiry functions

ALLOCATED (ARRAY) or ALLOCATED (SCALAR) Allocation status
ASSOCIATED (POINTER [, TARGET]) Association status inquiry or comparison
BIT_SIZE (I) Number of bits of the model
EXTENDS TYPE OF (A, MOLD) Same dynamic type or an extension
LEN (STRING [, KIND]) Length of a character entity
NEW_LINE (A) Newline character
PRESENT (A) Argument presence
SAME_TYPE_AS (A, B) Same dynamic type


-- 


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-10-31 Thread dominiq at lps dot ens dot fr


--- Comment #2 from dominiq at lps dot ens dot fr  2007-10-31 13:17 ---
The test case is bogus (missing closing parenthesis and p is not a pointer). I
hope the following is valid:

! { dg-do compile }
function bug(i) result(c)
  integer, pointer :: i
  character(len=merge(1,2, associated(i))) :: c
  c = ""
end function bug

it is accepted by xlf and g95 (with or without -std=f95).

If my understanding of the proc 'check_inquiry' in expr.c is correct,
'associated' is not in the set inquiry_func_f2003.


-- 


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



[Bug fortran/33957] gfortran rejects valid initialization expression

2007-10-31 Thread anlauf at gmx dot de


--- Comment #1 from anlauf at gmx dot de  2007-10-31 12:59 ---
(In reply to comment #0)

> [...]
> 
> (and indeed no other compiler I have access to has complained about this.)

As a side note: xlf 9.1 says this is a F2003 feature and not a F95 feature.


-- 


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