Article View: gnu.g++.bug
Article #1067gcc-2.2.2, "error 62" and patch
From: H.Dr.Ehling
Date: Thu, 15 Oct 1992 20:08
Date: Thu, 15 Oct 1992 20:08
175 lines
6472 bytes
6472 bytes
With gcc-2.2.2, file
"test.i":
//---
class alfa {
typedef int (*FP)();
};
class berta : public alfa {
Func(FP);
};
//---
using "cc1plus -quiet test.i", produced:
"internal compiler error 62, please report"
The same happened with .. int *FP; .. int FP simply remained undefined.
For me, the fix given in the remainder was sucessfull. The primary changes
are in cp-lex.c, "identifier_typedecl_value", dealing with the fact that
->type not always brings a DECL_TYPE; I found POINTER_TYPE or no even no
type. In such cases "lookup_name" may however produce a valid DECL_TYPE
node (inherited from base classes) which is the thing to use. I found it
most simple to give that node as a second argument to "identifier_...".
Found later some wake in other files but it's purely formal and I have not
experienced adverse effects.
Observe that the typedef is private and nevertheless is visible in class
"berta". I believe it's against the book (ARM), but not fatal.
With best regards
Hans-Juergen Ehling
----------
Hans-Juergen Ehling | eh@astbe.uucp
| Voice: +49 30/828-2497 Fax: +49 30/828-2483
AEG Softwaretechnik, Hohenzollerndamm 150, D1000 Berlin 33, Germany
----------------- Start Here ----------------------------------------
*** gcc-2.2.2/ChangeLog Mon Jun 15 15:28:03 1992
--- ../gcc-2.2.2a/ChangeLog Thu Oct 15 18:34:20 1992
***************
*** 1,3 ****
--- 1,19 ----
+ Thu Oct 15 12:43:41 1992 H.Dr.Ehling (eh at risbe)
+
+ * cp-lex.c: second argument to identifier_typedecl_value
+ * cp-spew.c: ... for use with case: TYPENAME, when handling
+ local typedef
+ * cp-tree.c, cp-tree.h: changes related to the cp-lex.c change
+ (look for: IDENTIFIER_TYPEDECL_VALUE)
+
Sun Jun 14 16:30:07 1992 Richard Stallman (rms@mole.gnu.ai.mit.edu)
* Version 2.2.2 released.
*** gcc-2.2.2/cp-lex.c Wed May 6 23:29:10 1992
--- ../gcc-2.2.2a/cp-lex.c Thu Oct 15 17:33:33 1992
***************
*** 2381,2394 ****
return id;
}
tree
! identifier_typedecl_value (node)
! tree node;
{
tree t, type;
type = IDENTIFIER_TYPE_VALUE (node);
! if (type == NULL_TREE)
! return NULL_TREE;
#define do(X) \
{ \
t = (X); \
--- 2381,2405 ----
return id;
}
+ /* "Node" is typename, may have no type, true type (code==TYPE_DECL)
+ or other (eg: code==POINTER_TYPE). "Gnode" is from "lookup_name",
+ always (??!) a type-declaration (code==TYPE_DECL). In particular,
+ it may come from a base class. */
+
tree
! identifier_typedecl_value (node, gnode)
! tree node, gnode;
{
tree t, type;
type = IDENTIFIER_TYPE_VALUE (node);
! if (type == NULL_TREE) {
! /* ... but lookup_name may have found a
! true node with type */
! if (gnode == NULL_TREE) return NULL_TREE;
! /* here TREE_CODE(gnode) == TYPE_DECL
! granted ?? */
! else return gnode;
! }
#define do(X) \
{ \
t = (X); \
***************
*** 2399,2404 ****
--- 2410,2419 ----
do (IDENTIFIER_CLASS_VALUE (node));
do (IDENTIFIER_GLOBAL_VALUE (node));
#undef do
+ /* node may have a type, but scoped _VALUEs all 0 or
+ CODE not TYPE_DECL (eg: ptr to ...): */
+ if (gnode != NULL_TREE) return gnode; /* Assumption TREE_CODE(gnode)
+ == TYPE_DECL, see above */
/* Will this one ever happen? */
if (TYPE_NAME (type))
return TYPE_NAME (type);
*** gcc-2.2.2/cp-spew.c Thu Apr 23 05:19:28 1992
--- ../gcc-2.2.2a/cp-spew.c Wed Oct 14 20:29:17 1992
***************
*** 336,342 ****
switch (tmp_token.yychar)
{
case TYPENAME:
! lastiddecl = IDENTIFIER_TYPEDECL_VALUE (tmp_token.yylval.ttype);
break;
case IDENTIFIER:
lastiddecl = trrr;
--- 336,343 ----
switch (tmp_token.yychar)
{
case TYPENAME:
! lastiddecl = IDENTIFIER_TYPEDECL_VALUE (
! tmp_token.yylval.ttype, trrr);
break;
case IDENTIFIER:
lastiddecl = trrr;
*** gcc-2.2.2/cp-tree.c Wed Apr 29 08:00:40 1992
--- ../gcc-2.2.2a/cp-tree.c Wed Oct 14 21:04:01 1992
***************
*** 934,941 ****
/* If the type name and constructor name are different, don't
write constructor name into type. */
extern tree constructor_name ();
! if (IDENTIFIER_TYPEDECL_VALUE (value)
! && IDENTIFIER_TYPEDECL_VALUE (value) != constructor_name (value))
list = tree_cons (NULL_TREE, value, NULL_TREE);
else
{
--- 934,942 ----
/* If the type name and constructor name are different, don't
write constructor name into type. */
extern tree constructor_name ();
! tree tmp;
! if ((tmp=IDENTIFIER_TYPEDECL_VALUE (value, NULL_TREE))
! && tmp != constructor_name (value))
list = tree_cons (NULL_TREE, value, NULL_TREE);
else
{
*** gcc-2.2.2/cp-tree.h Thu May 7 08:34:57 1992
--- ../gcc-2.2.2a/cp-tree.h Wed Oct 14 20:29:16 1992
***************
*** 87,93 ****
#endif
#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (TREE_TYPE (NODE) ? 1 : 0)
extern tree identifier_typedecl_value ();
! #define IDENTIFIER_TYPEDECL_VALUE(NODE) identifier_typedecl_value (NODE)
#define IDENTIFIER_LABEL_VALUE(NODE) \
(((struct lang_identifier *)(NODE))->x \
--- 87,94 ----
#endif
#define IDENTIFIER_HAS_TYPE_VALUE(NODE) (TREE_TYPE (NODE) ? 1 : 0)
extern tree identifier_typedecl_value ();
! #define IDENTIFIER_TYPEDECL_VALUE(NODE,GNODE) \
! identifier_typedecl_value ((NODE),(GNODE))
#define IDENTIFIER_LABEL_VALUE(NODE) \
(((struct lang_identifier *)(NODE))->x \
Technical Details
Message-ID:
<9210152008.AA26885@risbe.local>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!astbe.UUCP!ehShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!astbe.UUCP!eh From: eh@astbe.UUCP (H.Dr.Ehling) Subject: gcc-2.2.2, "error 62" and patch Message-ID: <9210152008.AA26885@risbe.local> Sender: gnulists@ai.mit.edu Reply-To: astbe!eh@risbe.ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 15 Oct 1992 20:08:45 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 176