summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-15 18:02:20 +0000
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-15 18:02:20 +0000
commitd88b1bc07a5646f2894b9557d47b41e0746c5a15 (patch)
treea2f7e67e6e38ab33d08e077762d35c4386c5e8b1
parent9ca4a77cdc957cd6773577976470f7b386d25941 (diff)
downloadgcc-d88b1bc07a5646f2894b9557d47b41e0746c5a15.tar.gz
fortran:
PR fortran/13826 * primary.c (match_structure_constructor): Rename ... (gfc_match_structure_constructor): ... to this. Make non-static. (gfc_match_rvalue): Call renamed function. * match.h (gfc_match_structure_constructor): Declare. * match.c (gfc_match_data_constant): Handle structure constructor. testsuite: PR fortran/13826 * gfortran.fortran-torture/compile/data_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@81891 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog11
-rw-r--r--gcc/fortran/match.c5
-rw-r--r--gcc/fortran/match.h1
-rw-r--r--gcc/fortran/primary.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.fortran-torture/compile/data_1.f907
6 files changed, 30 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a1542b5db3e..16ea4470998 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,15 @@
2004-05-15 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+ PR fortran/13826
+ * primary.c (match_structure_constructor): Rename ...
+ (gfc_match_structure_constructor): ... to this. Make non-static.
+ (gfc_match_rvalue): Call renamed function.
+ * match.h (gfc_match_structure_constructor): Declare.
+ * match.c (gfc_match_data_constant): Handle structure
+ constructor.
+
+2004-05-15 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
PR fortran/13702
(Port from g95)
* gfortran.h (gfc_linebuf): New typedef.
@@ -47,7 +57,6 @@
preprocessor flags.
(all): Add missing initializers.
-
2004-05-15 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* Make-lang.in (trans-common.o): Remove redundant dependency.
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index dc8dc3e7333..1b2b763013e 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -2907,12 +2907,15 @@ match_data_constant (gfc_expr ** result)
if (gfc_find_symbol (name, NULL, 1, &sym))
return MATCH_ERROR;
- if (sym == NULL || sym->attr.flavor != FL_PARAMETER)
+ if (sym == NULL
+ || (sym->attr.flavor != FL_PARAMETER && sym->attr.flavor != FL_DERIVED))
{
gfc_error ("Symbol '%s' must be a PARAMETER in DATA statement at %C",
name);
return MATCH_ERROR;
}
+ else if (sym->attr.flavor == FL_DERIVED)
+ return gfc_match_structure_constructor (sym, result);
*result = gfc_copy_expr (sym->value);
return MATCH_YES;
diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h
index 25e551caa6c..6cff5cc0aa0 100644
--- a/gcc/fortran/match.h
+++ b/gcc/fortran/match.h
@@ -120,6 +120,7 @@ match gfc_match_modproc (void);
match gfc_match_target (void);
/* primary.c */
+match gfc_match_structure_constructor (gfc_symbol *, gfc_expr **);
match gfc_match_rvalue (gfc_expr **);
match gfc_match_variable (gfc_expr **, int);
match gfc_match_actual_arglist (int, gfc_actual_arglist **);
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 03e975776ea..d10a46244e9 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -1747,8 +1747,8 @@ gfc_expr_attr (gfc_expr * e)
/* Match a structure constructor. The initial symbol has already been
seen. */
-static match
-match_structure_constructor (gfc_symbol * sym, gfc_expr ** result)
+match
+gfc_match_structure_constructor (gfc_symbol * sym, gfc_expr ** result)
{
gfc_constructor *head, *tail;
gfc_component *comp;
@@ -1908,7 +1908,7 @@ gfc_match_rvalue (gfc_expr ** result)
if (sym == NULL)
m = MATCH_ERROR;
else
- m = match_structure_constructor (sym, &e);
+ m = gfc_match_structure_constructor (sym, &e);
break;
/* If we're here, then the name is known to be the name of a
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0f1ec72238c..d23aed287c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-15 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ PR fortran/13826
+ * gfortran.fortran-torture/compile/data_1.f90: New test.
+
2004-05-15 Ulrich Weigand <uweigand@de.ibm.com>
* gcc.dg/const-elim-1.c: Remove XFAIL for s390*-*-*.
diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/data_1.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/data_1.f90
new file mode 100644
index 00000000000..fa8ab9fe1f7
--- /dev/null
+++ b/gcc/testsuite/gfortran.fortran-torture/compile/data_1.f90
@@ -0,0 +1,7 @@
+! this tests the fix for PR 13826
+TYPE a
+ REAL x
+END TYPE
+TYPE(a) :: y
+DATA y /a(1.)/ ! used to give an error about non-PARAMETER
+END