Commit b7c56581 by Thomas Koenig

re PR fortran/60526 (Accepts-invalid: Variable name same as type name)

2016-02-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/60526
	PR bootstrap/69816
	* decl.c (build_sym):  Reverted previous patch.

2016-02-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/60526
	PR bootstrap/69816
	* gfortran.dg/type_decl_4.f90:  Removed.

From-SVN: r233411
parent 60cb4ef5
2016-02-14 Thomas Koenig <tkoenig@gcc.gnu.org> 2016-02-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60526 PR fortran/60526
PR bootstrap/69816
* decl.c (build_sym): Reverted previous patch.
2016-02-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60526
* decl.c (build_sym): If the name has already been defined as a * decl.c (build_sym): If the name has already been defined as a
type, issue error and return false. type, issue error and return false.
......
...@@ -1215,30 +1215,10 @@ build_sym (const char *name, gfc_charlen *cl, bool cl_deferred, ...@@ -1215,30 +1215,10 @@ build_sym (const char *name, gfc_charlen *cl, bool cl_deferred,
{ {
symbol_attribute attr; symbol_attribute attr;
gfc_symbol *sym; gfc_symbol *sym;
int nlen;
char u_name[GFC_MAX_SYMBOL_LEN + 1];
gfc_symtree *st;
if (gfc_get_symbol (name, NULL, &sym)) if (gfc_get_symbol (name, NULL, &sym))
return false; return false;
/* Check if the name has already been defined as a type. The
first letter of the symtree will be in upper case then. */
nlen = strlen(name);
gcc_assert (nlen <= GFC_MAX_SYMBOL_LEN);
strncpy (u_name, name, nlen + 1);
u_name[0] = TOUPPER(u_name[0]);
st = gfc_find_symtree (gfc_current_ns->sym_root, u_name);
if (st != 0)
{
gfc_error ("Symbol %qs at %C also declared as a type at %L", name,
&st->n.sym->declared_at);
return false;
}
/* Start updating the symbol table. Add basic type attribute if present. */ /* Start updating the symbol table. Add basic type attribute if present. */
if (current_ts.type != BT_UNKNOWN if (current_ts.type != BT_UNKNOWN
&& (sym->attr.implicit_type == 0 && (sym->attr.implicit_type == 0
......
2016-02-14 Thomas Koenig <tkoenig@gcc.gnu.org> 2016-02-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60526 PR fortran/60526
PR bootstrap/69816
* gfortran.dg/type_decl_4.f90: Removed.
2016-02-14 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60526
* gfortran.dg/type_decl_4.f90: New test. * gfortran.dg/type_decl_4.f90: New test.
2016-02-14 Alan Modra <amodra@gmail.com> 2016-02-14 Alan Modra <amodra@gmail.com>
......
! { dg-do compile }
program main
type Xx ! { dg-error "Symbol 'xx' at .1. also declared as a type at .2." }
end type Xx
real :: Xx ! { dg-error "Symbol 'xx' at .1. also declared as a type at .2." }
end program main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment