2012-07-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/52101
+ * decl.c (match_char_length): Extra argument, show obsolenscent
+ warning only if *length is used after the typename.
+ (variable_decl, gfc_match_char_spec): Update call
+
+2012-07-17 Tobias Burnus <burnus@net-b.de>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/49265
char_len_param_value in parenthesis. */
static match
-match_char_length (gfc_expr **expr, bool *deferred)
+match_char_length (gfc_expr **expr, bool *deferred, bool obsolenscent_check)
{
int length;
match m;
if (m == MATCH_YES)
{
- if (gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
- "Old-style character length at %C") == FAILURE)
+ if (obsolenscent_check
+ && gfc_notify_std (GFC_STD_F95_OBS, "Obsolescent feature: "
+ "Old-style character length at %C") == FAILURE)
return MATCH_ERROR;
*expr = gfc_get_int_expr (gfc_default_integer_kind, NULL, length);
return m;
if (current_ts.type == BT_CHARACTER)
{
- switch (match_char_length (&char_len, &cl_deferred))
+ switch (match_char_length (&char_len, &cl_deferred, false))
{
case MATCH_YES:
cl = gfc_new_charlen (gfc_current_ns, NULL);
/* Try the old-style specification first. */
old_char_selector = 0;
- m = match_char_length (&len, &deferred);
+ m = match_char_length (&len, &deferred, true);
if (m != MATCH_NO)
{
if (m == MATCH_YES)
2012-07-17 Tobias Burnus <burnus@net-b.de>
+ PR fortran/52101
+ * gfortran.dg/oldstyle_4.f90: New.
+
+2012-07-17 Tobias Burnus <burnus@net-b.de>
+
PR fortran/49265
* gfortran.dg/module_procedure_double_colon_3.f90: New.
* gfortran.dg/module_procedure_double_colon_4.f90: New.
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=f95" }
+!
+! PR fortran/52101
+!
+! Contributed by John Harper
+!
+program foo
+ character*10 s ! { dg-warning "Obsolescent feature: Old-style character length" }
+ character t*10 ! Still okay
+ s = 'foo'
+ t = 'bar'
+end program foo