Commit 79d13333 by Alexandre Petit-Bianco Committed by Alexandre Petit-Bianco

re GNATS gcj/17 (Internal error: segfault on import-classname clash)

Thu Aug 19 10:26:18 1999  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * parse.y (method_header): Return a null pointer if the current
        class node is null.
        (finish_method_declaration): Return if the current function decl
        is null.
        (source_start_java_method): Likewise.
        (java_method_add_stmt): Likewise.

This fixes the net PR #17.

From-SVN: r28765
parent 852be00c
Thu Aug 19 10:26:18 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (method_header): Return a null pointer if the current
class node is null.
(finish_method_declaration): Return if the current function decl
is null.
(source_start_java_method): Likewise.
(java_method_add_stmt): Likewise.
Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> Wed Aug 18 13:17:15 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* class.c (emit_register_class): Removed unnecessary call to * class.c (emit_register_class): Removed unnecessary call to
......
...@@ -2231,7 +2231,7 @@ static const short yycheck[] = { 3, ...@@ -2231,7 +2231,7 @@ static const short yycheck[] = { 3,
#define YYPURE 1 #define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple" #line 3 "/usr/share/misc/bison.simple"
/* Skeleton output parser for bison, /* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
...@@ -2248,7 +2248,7 @@ static const short yycheck[] = { 3, ...@@ -2248,7 +2248,7 @@ static const short yycheck[] = { 3,
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* As a special exception, when this file is copied by Bison into a /* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction. Bison output file, you may use that output file without restriction.
...@@ -2382,8 +2382,10 @@ int yydebug; /* nonzero means print parse trace */ ...@@ -2382,8 +2382,10 @@ int yydebug; /* nonzero means print parse trace */
/* Prevent warning if -Wstrict-prototypes. */ /* Prevent warning if -Wstrict-prototypes. */
#ifdef __GNUC__ #ifdef __GNUC__
#ifndef YYPARSE_PARAM
int yyparse (void); int yyparse (void);
#endif #endif
#endif
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
...@@ -2424,7 +2426,7 @@ __yy_memcpy (char *to, char *from, int count) ...@@ -2424,7 +2426,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif #endif
#endif #endif
#line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple" #line 196 "/usr/share/misc/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed /* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *. into yyparse. The argument should have type void *.
...@@ -4713,7 +4715,7 @@ case 495: ...@@ -4713,7 +4715,7 @@ case 495:
break;} break;}
} }
/* the action file gets copied in in place of this dollarsign */ /* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple" #line 498 "/usr/share/misc/bison.simple"
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
...@@ -5922,14 +5924,19 @@ method_header (flags, type, mdecl, throws) ...@@ -5922,14 +5924,19 @@ method_header (flags, type, mdecl, throws)
{ {
tree meth = TREE_VALUE (mdecl); tree meth = TREE_VALUE (mdecl);
tree id = TREE_PURPOSE (mdecl); tree id = TREE_PURPOSE (mdecl);
tree this_class = TREE_TYPE (ctxp->current_parsed_class);
tree type_wfl = NULL_TREE; tree type_wfl = NULL_TREE;
tree meth_name = NULL_TREE, current, orig_arg; tree meth_name = NULL_TREE;
tree current, orig_arg, this_class;
int saved_lineno; int saved_lineno;
int constructor_ok = 0, must_chain; int constructor_ok = 0, must_chain;
check_modifiers_consistency (flags); check_modifiers_consistency (flags);
if (ctxp->current_parsed_class)
this_class = TREE_TYPE (ctxp->current_parsed_class);
else
return NULL_TREE;
/* There are some forbidden modifiers for an abstract method and its /* There are some forbidden modifiers for an abstract method and its
class must be abstract as well. */ class must be abstract as well. */
if (type && (flags & ACC_ABSTRACT)) if (type && (flags & ACC_ABSTRACT))
...@@ -6124,7 +6131,12 @@ static void ...@@ -6124,7 +6131,12 @@ static void
finish_method_declaration (method_body) finish_method_declaration (method_body)
tree method_body; tree method_body;
{ {
int flags = get_access_flags_from_decl (current_function_decl); int flags;
if (!current_function_decl)
return;
flags = get_access_flags_from_decl (current_function_decl);
/* 8.4.5 Method Body */ /* 8.4.5 Method Body */
if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
...@@ -8101,6 +8113,9 @@ source_start_java_method (fndecl) ...@@ -8101,6 +8113,9 @@ source_start_java_method (fndecl)
tree parm_decl; tree parm_decl;
int i; int i;
if (!fndecl)
return;
current_function_decl = fndecl; current_function_decl = fndecl;
/* New scope for the function */ /* New scope for the function */
...@@ -8219,6 +8234,9 @@ source_end_java_method () ...@@ -8219,6 +8234,9 @@ source_end_java_method ()
tree fndecl = current_function_decl; tree fndecl = current_function_decl;
int flag_asynchronous_exceptions = asynchronous_exceptions; int flag_asynchronous_exceptions = asynchronous_exceptions;
if (!fndecl)
return;
java_parser_context_save_global (); java_parser_context_save_global ();
lineno = ctxp->last_ccb_indent1; lineno = ctxp->last_ccb_indent1;
...@@ -8274,6 +8292,8 @@ tree ...@@ -8274,6 +8292,8 @@ tree
java_method_add_stmt (fndecl, expr) java_method_add_stmt (fndecl, expr)
tree fndecl, expr; tree fndecl, expr;
{ {
if (!fndecl)
return NULL;
return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
} }
......
...@@ -3337,14 +3337,19 @@ method_header (flags, type, mdecl, throws) ...@@ -3337,14 +3337,19 @@ method_header (flags, type, mdecl, throws)
{ {
tree meth = TREE_VALUE (mdecl); tree meth = TREE_VALUE (mdecl);
tree id = TREE_PURPOSE (mdecl); tree id = TREE_PURPOSE (mdecl);
tree this_class = TREE_TYPE (ctxp->current_parsed_class);
tree type_wfl = NULL_TREE; tree type_wfl = NULL_TREE;
tree meth_name = NULL_TREE, current, orig_arg; tree meth_name = NULL_TREE;
tree current, orig_arg, this_class;
int saved_lineno; int saved_lineno;
int constructor_ok = 0, must_chain; int constructor_ok = 0, must_chain;
check_modifiers_consistency (flags); check_modifiers_consistency (flags);
if (ctxp->current_parsed_class)
this_class = TREE_TYPE (ctxp->current_parsed_class);
else
return NULL_TREE;
/* There are some forbidden modifiers for an abstract method and its /* There are some forbidden modifiers for an abstract method and its
class must be abstract as well. */ class must be abstract as well. */
if (type && (flags & ACC_ABSTRACT)) if (type && (flags & ACC_ABSTRACT))
...@@ -3539,7 +3544,12 @@ static void ...@@ -3539,7 +3544,12 @@ static void
finish_method_declaration (method_body) finish_method_declaration (method_body)
tree method_body; tree method_body;
{ {
int flags = get_access_flags_from_decl (current_function_decl); int flags;
if (!current_function_decl)
return;
flags = get_access_flags_from_decl (current_function_decl);
/* 8.4.5 Method Body */ /* 8.4.5 Method Body */
if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body) if ((flags & ACC_ABSTRACT || flags & ACC_NATIVE) && method_body)
...@@ -5516,6 +5526,9 @@ source_start_java_method (fndecl) ...@@ -5516,6 +5526,9 @@ source_start_java_method (fndecl)
tree parm_decl; tree parm_decl;
int i; int i;
if (!fndecl)
return;
current_function_decl = fndecl; current_function_decl = fndecl;
/* New scope for the function */ /* New scope for the function */
...@@ -5634,6 +5647,9 @@ source_end_java_method () ...@@ -5634,6 +5647,9 @@ source_end_java_method ()
tree fndecl = current_function_decl; tree fndecl = current_function_decl;
int flag_asynchronous_exceptions = asynchronous_exceptions; int flag_asynchronous_exceptions = asynchronous_exceptions;
if (!fndecl)
return;
java_parser_context_save_global (); java_parser_context_save_global ();
lineno = ctxp->last_ccb_indent1; lineno = ctxp->last_ccb_indent1;
...@@ -5689,6 +5705,8 @@ tree ...@@ -5689,6 +5705,8 @@ tree
java_method_add_stmt (fndecl, expr) java_method_add_stmt (fndecl, expr)
tree fndecl, expr; tree fndecl, expr;
{ {
if (!fndecl)
return NULL;
return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr); return add_stmt_to_block (GET_CURRENT_BLOCK (fndecl), NULL_TREE, expr);
} }
......
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