Commit c58e98c8 by Simon Martin Committed by Simon Martin

re PR c/43384 (ICE: Segmentation fault with invalid K&R-like code)

gcc/

2010-11-16  Simon Martin  <simartin@users.sourceforge.net>

	PR c/43384
	* c-decl.c (lookup_label): Labels can only be referenced in a
	function's scope. 
	(store_parm_decls_oldstyle): Skip erroneous parameters.

gcc/testsuite/
 
2010-11-16  Simon Martin  <simartin@users.sourceforge.net>

	PR c/43384
	* gcc.dg/parser-error-3.c: New test.

From-SVN: r166408
parent da0dc818
2010-11-06 Simon Martin <simartin@users.sourceforge.net>
PR c/43384
* c-decl.c (lookup_label): Labels can only be referenced in a
function's scope.
(store_parm_decls_oldstyle): Skip erroneous parameters.
2010-11-06 Anatoly Sokolov <aesok@post.ru>
* config/fr30/fr30.h (FUNCTION_VALUE_REGNO_P, FUNCTION_VALUE,
......@@ -3013,7 +3013,7 @@ lookup_label (tree name)
tree label;
struct c_label_vars *label_vars;
if (current_function_decl == 0)
if (current_function_scope == 0)
{
error ("label %qE referenced outside of any function", name);
return 0;
......@@ -7847,6 +7847,9 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
if (b && B_IN_CURRENT_SCOPE (b))
{
decl = b->decl;
/* Skip erroneous parameters. */
if (decl == error_mark_node)
continue;
/* If we got something other than a PARM_DECL it is an error. */
if (TREE_CODE (decl) != PARM_DECL)
error_at (DECL_SOURCE_LOCATION (decl),
......
2010-11-06 Simon Martin <simartin@users.sourceforge.net>
PR c/43384
* gcc.dg/parser-error-3.c: New test.
2010-11-06 Nathan Froyd <froydnj@codesourcery.com>
PR c++/45332
......
/* PR c/43384 */
/* { dg-do "compile" } */
void c_direct(par)
void *par = &&lab; /* { dg-error "is initialized|non-standard|outside of" } */
{}
void foo(p, q)
int *p = &q; /* { dg-error "initialized|undeclared" } */
{}
void bar(i)
int j = i; /* { dg-error "initialized|undeclared|no such parameter" } */
{}
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