* [fortran, ptach] initialization expressions, update
@ 2007-07-23 0:14 Daniel Franke
2007-07-23 0:38 ` Steve Kargl
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Franke @ 2007-07-23 0:14 UTC (permalink / raw)
To: fortran; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
The original testcase of PR31639 still results in an ICE if -std=gnu but is
handled correctly if -std=f95 or -std=f2003. This update changes the related
gfc_notify_std() to gfc_error().
Further, as F2003 allows more transformational intrinsics in initialization
expressions than F95, we ICE on those as shown in PR25104. The second part of
the patch changes this ice-on-valid to reject-valid for now.
2007-07-22 Daniel Franke <franke.daniel@gmail.com>
PR fortran/25104
PR fortran/31639
* expr.c(check_transformational): Reject valid transformational
intrinsics to avoid ICE.
(check_inquiry): Report error for assumed character lengths for
all supported standards.
2007-07-22 Daniel Franke <franke.daniel@gmail.com>
PR fortran/31639
* gfortran.dg/initialization_9.f90: New test.
Regression tested on i686-pc-linux-gnu. Ok for trunk?
Regards
Daniel
[-- Attachment #2: init-expr-update.patch --]
[-- Type: text/x-diff, Size: 2073 bytes --]
Index: fortran/expr.c
===================================================================
--- fortran/expr.c (revision 126826)
+++ fortran/expr.c (working copy)
@@ -1966,9 +1966,8 @@
&& ap->expr->symtree->n.sym->ts.type == BT_CHARACTER
&& ap->expr->symtree->n.sym->ts.cl->length == NULL)
{
- if (gfc_notify_std (GFC_STD_GNU, "assumed character length "
- "variable '%s' in constant expression at %L",
- e->symtree->n.sym->name, &e->where) == FAILURE)
+ gfc_error ("assumed character length variable '%s' in constant "
+ "expression at %L", e->symtree->n.sym->name, &e->where);
return MATCH_ERROR;
}
else if (not_restricted && check_init_expr (ap->expr) == FAILURE)
@@ -2007,11 +2006,23 @@
if (strcmp (trans_func_f95[i], name) == 0)
break;
+ /* FIXME, F2003: implement translation of initialization
+ expressions before enabling this check. For F95, error
+ out if the transformational function is not in the list. */
+#if 0
if (trans_func_f95[i] == NULL
&& gfc_notify_std (GFC_STD_F2003,
"transformational intrinsic '%s' at %L is not permitted "
"in an initialization expression", name, &e->where) == FAILURE)
return MATCH_ERROR;
+#else
+ if (trans_func_f95[i] == NULL)
+ {
+ gfc_error("transformational intrinsic '%s' at %L is not permitted "
+ "in an initialization expression", name, &e->where);
+ return MATCH_ERROR;
+ }
+#endif
return check_init_expr_arguments (e);
}
Index: testsuite/gfortran.dg/initialization_9.f90
===================================================================
--- testsuite/gfortran.dg/initialization_9.f90 (revision 0)
+++ testsuite/gfortran.dg/initialization_9.f90 (revision 0)
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR fortran/31639
+! Contributed by Martin Michlmayr <tbm >T cyrius DOT com>
+
+ integer function xstrcmp(s1)
+ character*(*), intent(in) :: s1
+ integer :: n1 = len(s1) ! { dg-error "assumed character length variable" }
+ n1 = 1
+ return
+ end function xstrcmp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [fortran, ptach] initialization expressions, update
2007-07-23 0:14 [fortran, ptach] initialization expressions, update Daniel Franke
@ 2007-07-23 0:38 ` Steve Kargl
2007-07-23 20:18 ` Daniel Franke
0 siblings, 1 reply; 3+ messages in thread
From: Steve Kargl @ 2007-07-23 0:38 UTC (permalink / raw)
To: Daniel Franke; +Cc: fortran, gcc-patches
On Sun, Jul 22, 2007 at 11:45:05PM +0200, Daniel Franke wrote:
>
> 2007-07-22 Daniel Franke <franke.daniel@gmail.com>
>
> PR fortran/25104
> PR fortran/31639
> * expr.c(check_transformational): Reject valid transformational
> intrinsics to avoid ICE.
> (check_inquiry): Report error for assumed character lengths for
> all supported standards.
>
> 2007-07-22 Daniel Franke <franke.daniel@gmail.com>
>
> PR fortran/31639
> * gfortran.dg/initialization_9.f90: New test.
>
Daniel,
This is OK. Please update the appropriate PRs.
Also, are you working on a proper fix?
--
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [fortran, ptach] initialization expressions, update
2007-07-23 0:38 ` Steve Kargl
@ 2007-07-23 20:18 ` Daniel Franke
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Franke @ 2007-07-23 20:18 UTC (permalink / raw)
To: fortran; +Cc: Steve Kargl, gcc-patches
On Monday 23 July 2007 02:02:57 Steve Kargl wrote:
> On Sun, Jul 22, 2007 at 11:45:05PM +0200, Daniel Franke wrote:
> > 2007-07-22 Daniel Franke <franke.daniel@gmail.com>
> >
> > PR fortran/25104
> > PR fortran/31639
> > * expr.c(check_transformational): Reject valid transformational
> > intrinsics to avoid ICE.
> > (check_inquiry): Report error for assumed character lengths for
> > all supported standards.
> >
> > 2007-07-22 Daniel Franke <franke.daniel@gmail.com>
> >
> > PR fortran/31639
> > * gfortran.dg/initialization_9.f90: New test.
>
> Daniel,
>
> This is OK. Please update the appropriate PRs.
> Also, are you working on a proper fix?
As indicated in the first mail about init expressions, I had in mind to fix
this properly. Browsing the sources, I learned that I'm currently not up to
the task. Thus this cover-up patch. I'll commit it shortly.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-23 19:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-23 0:14 [fortran, ptach] initialization expressions, update Daniel Franke
2007-07-23 0:38 ` Steve Kargl
2007-07-23 20:18 ` Daniel Franke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).