diff options
author | Daniel Kraft <d@domob.eu> | 2008-08-22 22:36:12 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2008-08-22 22:36:12 +0200 |
commit | fee3292b1460655f81a06c160de992638749373a (patch) | |
tree | c47e4e93dbfac7b1bb17ee74e10bfa450db5d256 /gcc/fortran | |
parent | 9b410dd0ecd3b952c53d2a201756efb7dc24f8b4 (diff) | |
download | gcc-fee3292b1460655f81a06c160de992638749373a.zip gcc-fee3292b1460655f81a06c160de992638749373a.tar.gz gcc-fee3292b1460655f81a06c160de992638749373a.tar.bz2 |
re PR fortran/30239 (duplicate data type assignment not detected)
2008-08-22 Daniel Kraft <d@domob.eu>
PR fortran/30239
* symbol.c (gfc_add_type): Warn on -Wsurprising if a function-result
type is re-declared but neither -pedantic nor -std=f* is given and so
this is no error.
* invoke.texi (-Wsurprising): Document this new behaviour.
From-SVN: r139499
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/invoke.texi | 4 | ||||
-rw-r--r-- | gcc/fortran/symbol.c | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1b588cd..67c1fac 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,13 @@ 2008-08-22 Daniel Kraft <d@domob.eu> + PR fortran/30239 + * symbol.c (gfc_add_type): Warn on -Wsurprising if a function-result + type is re-declared but neither -pedantic nor -std=f* is given and so + this is no error. + * invoke.texi (-Wsurprising): Document this new behaviour. + +2008-08-22 Daniel Kraft <d@domob.eu> + * gfortran.h (in_prefix): Removed from this header. * match.h (gfc_matching_prefix): Moved and renamed from `in_prefix'. * decl.c (in_prefix): Removed from here. diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index b2370d4..b854ce4 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -757,6 +757,10 @@ A LOGICAL SELECT construct has three CASE statements. @item A TRANSFER specifies a source that is shorter than the destination. + +@item +The type of a function result is declared more than once with the same type. If +@option{-pedantic} or standard-conforming mode is enabled, this is an error. @end itemize @item -Wtabs diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index f49f773..e16406d 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -1540,9 +1540,11 @@ gfc_add_type (gfc_symbol *sym, gfc_typespec *ts, locus *where) gfc_error (msg, sym->name, where, gfc_basic_typename (sym->ts.type)); return FAILURE; } - else if (gfc_notify_std (GFC_STD_GNU, msg, sym->name, where, - gfc_basic_typename (sym->ts.type)) == FAILURE) + if (gfc_notify_std (GFC_STD_GNU, msg, sym->name, where, + gfc_basic_typename (sym->ts.type)) == FAILURE) return FAILURE; + if (gfc_option.warn_surprising) + gfc_warning (msg, sym->name, where, gfc_basic_typename (sym->ts.type)); } flavor = sym->attr.flavor; |