Janus Weil <janus@gcc.gnu.org>
PR fortran/42051
PR fortran/44064
PR fortran/45151
* intrinsic.c (gfc_get_intrinsic_sub_symbol): Commit changed symbol.
* symbol.c (gen_cptr_param, gen_fptr_param, gen_shape_param,
gfc_copy_formal_args, gfc_copy_formal_args_intr,
gfc_copy_formal_args_ppc, generate_isocbinding_symbol): Ditto.
* parse.c (parse_derived_contains, parse_spec, parse_progunit):
Call reject_statement in case of error.
(match_deferred_characteritics): Call gfc_undo_symbols in case match
fails.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162821
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-08-02 Mikael Morin <mikael@gcc.gnu.org>
+ Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/42051
+ PR fortran/44064
+ PR fortran/45151
+ * intrinsic.c (gfc_get_intrinsic_sub_symbol): Commit changed symbol.
+ * symbol.c (gen_cptr_param, gen_fptr_param, gen_shape_param,
+ gfc_copy_formal_args, gfc_copy_formal_args_intr,
+ gfc_copy_formal_args_ppc, generate_isocbinding_symbol): Ditto.
+ * parse.c (parse_derived_contains, parse_spec, parse_progunit):
+ Call reject_statement in case of error.
+ (match_deferred_characteritics): Call gfc_undo_symbols in case match
+ fails.
+
2010-08-01 Janus Weil <janus@gcc.gnu.org>
PR fortran/44912
sym->attr.flavor = FL_PROCEDURE;
sym->attr.proc = PROC_INTRINSIC;
+ gfc_commit_symbol (sym);
+
return sym;
}
case ST_DATA_DECL:
gfc_error ("Components in TYPE at %C must precede CONTAINS");
- error_flag = true;
- break;
+ goto error;
case ST_PROCEDURE:
if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: Type-bound"
" procedure at %C") == FAILURE)
- error_flag = true;
+ goto error;
accept_statement (ST_PROCEDURE);
seen_comps = true;
case ST_GENERIC:
if (gfc_notify_std (GFC_STD_F2003, "Fortran 2003: GENERIC binding"
" at %C") == FAILURE)
- error_flag = true;
+ goto error;
accept_statement (ST_GENERIC);
seen_comps = true;
if (gfc_notify_std (GFC_STD_F2003,
"Fortran 2003: FINAL procedure declaration"
" at %C") == FAILURE)
- error_flag = true;
+ goto error;
accept_statement (ST_FINAL);
seen_comps = true;
&& (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Derived type "
"definition at %C with empty CONTAINS "
"section") == FAILURE))
- error_flag = true;
+ goto error;
/* ST_END_TYPE is accepted by parse_derived after return. */
break;
{
gfc_error ("PRIVATE statement in TYPE at %C must be inside "
"a MODULE");
- error_flag = true;
- break;
+ goto error;
}
if (seen_comps)
{
gfc_error ("PRIVATE statement at %C must precede procedure"
" bindings");
- error_flag = true;
- break;
+ goto error;
}
if (seen_private)
{
gfc_error ("Duplicate PRIVATE statement at %C");
- error_flag = true;
+ goto error;
}
accept_statement (ST_PRIVATE);
case ST_SEQUENCE:
gfc_error ("SEQUENCE statement at %C must precede CONTAINS");
- error_flag = true;
- break;
+ goto error;
case ST_CONTAINS:
gfc_error ("Already inside a CONTAINS block at %C");
- error_flag = true;
- break;
+ goto error;
default:
unexpected_statement (st);
break;
}
+
+ continue;
+
+error:
+ error_flag = true;
+ reject_statement ();
}
pop_state ();
gfc_commit_symbols ();
}
else
- gfc_error_check ();
+ {
+ gfc_error_check ();
+ gfc_undo_symbols ();
+ }
gfc_current_locus =loc;
return m;
case ST_STATEMENT_FUNCTION:
gfc_error ("%s statement is not allowed inside of BLOCK at %C",
gfc_ascii_statement (st));
+ reject_statement ();
break;
default:
{
gfc_error ("%s statement must appear in a MODULE",
gfc_ascii_statement (st));
+ reject_statement ();
break;
}
{
gfc_error ("%s statement at %C follows another accessibility "
"specification", gfc_ascii_statement (st));
+ reject_statement ();
break;
}
{
gfc_error ("CONTAINS statement at %C is already in a contained "
"program unit");
+ reject_statement ();
st = next_statement ();
goto loop;
}
formal_arg = gfc_get_formal_arglist ();
/* Add arg to list of formal args (the CPTR arg). */
add_formal_arg (head, tail, formal_arg, param_sym);
+
+ /* Validate changes. */
+ gfc_commit_symbol (param_sym);
}
formal_arg = gfc_get_formal_arglist ();
/* Add arg to list of formal args. */
add_formal_arg (head, tail, formal_arg, param_sym);
+
+ /* Validate changes. */
+ gfc_commit_symbol (param_sym);
}
formal_arg = gfc_get_formal_arglist ();
/* Add arg to list of formal args. */
add_formal_arg (head, tail, formal_arg, param_sym);
+
+ /* Validate changes. */
+ gfc_commit_symbol (param_sym);
}
/* Add arg to list of formal args. */
add_formal_arg (&head, &tail, formal_arg, formal_arg->sym);
+
+ /* Validate changes. */
+ gfc_commit_symbol (formal_arg->sym);
}
/* Add the interface to the symbol. */
/* Add arg to list of formal args. */
add_formal_arg (&head, &tail, formal_arg, formal_arg->sym);
+
+ /* Validate changes. */
+ gfc_commit_symbol (formal_arg->sym);
}
/* Add the interface to the symbol. */
/* Add arg to list of formal args. */
add_formal_arg (&head, &tail, formal_arg, formal_arg->sym);
+
+ /* Validate changes. */
+ gfc_commit_symbol (formal_arg->sym);
}
/* Add the interface to the symbol. */
default:
gcc_unreachable ();
}
+ gfc_commit_symbol (tmp_sym);
}