aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/decl.c
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@aei.mpg.de>2005-12-02 01:25:58 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2005-12-02 01:25:58 +0000
commite45b3c75467600eafb89a989301d207da3f31650 (patch)
tree978c7adea1250bd00e1e5ddfa10e006751049366 /gcc/fortran/decl.c
parent86e1c63beca6f696e15f68ace62480a765b1a52c (diff)
downloadgcc-e45b3c75467600eafb89a989301d207da3f31650.zip
gcc-e45b3c75467600eafb89a989301d207da3f31650.tar.gz
gcc-e45b3c75467600eafb89a989301d207da3f31650.tar.bz2
decl.c (gfc_match_old_kind_spec): Improve handling of old style COMPLEX*N
2005-12-01 Erik Schnetter <schnetter@aei.mpg.de> * decl.c (gfc_match_old_kind_spec): Improve handling of old style COMPLEX*N From-SVN: r107853
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r--gcc/fortran/decl.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 8352c52..6f04734 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1279,6 +1279,7 @@ match
gfc_match_old_kind_spec (gfc_typespec * ts)
{
match m;
+ int original_kind;
if (gfc_match_char ('*') != MATCH_YES)
return MATCH_NO;
@@ -1287,17 +1288,24 @@ gfc_match_old_kind_spec (gfc_typespec * ts)
if (m != MATCH_YES)
return MATCH_ERROR;
+ original_kind = ts->kind;
+
/* Massage the kind numbers for complex types. */
- if (ts->type == BT_COMPLEX && ts->kind == 8)
- ts->kind = 4;
- if (ts->type == BT_COMPLEX && ts->kind == 16)
- ts->kind = 8;
+ if (ts->type == BT_COMPLEX)
+ {
+ if (ts->kind % 2)
+ {
+ gfc_error ("Old-style type declaration %s*%d not supported at %C",
+ gfc_basic_typename (ts->type), original_kind);
+ return MATCH_ERROR;
+ }
+ ts->kind /= 2;
+ }
if (gfc_validate_kind (ts->type, ts->kind, true) < 0)
{
- gfc_error ("Old-style kind %d not supported for type %s at %C",
- ts->kind, gfc_basic_typename (ts->type));
-
+ gfc_error ("Old-style type declaration %s*%d not supported at %C",
+ gfc_basic_typename (ts->type), original_kind);
return MATCH_ERROR;
}