This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH]: Fix 7919[C++ PATCH]: Fix 7919
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Sep 2002 14:09:04 +0100
- Subject: Re: [C++ PATCH]: Fix 7919[C++ PATCH]: Fix 7919
- Organization: Codesourcery LLC
- References: <200209171813.g8HIDKLd017839@hiauly1.hia.nrc.ca>
John David Anglin wrote:
and detects two new failures
FAIL: g++.jason/pmem4.C caused compiler crash
FAIL: g++.other/crash32.C caused compiler crash
Those tests did not ICE in gcc 3.1.1.
I've installed the attached obvious patch, which fixes the first ICE. The
second test case, I've merely marked as causing a crash -- it was
an XFAILing multiple error problem already).
built & tested on i686-pc-linux-gnu.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2002-09-18 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokdeclarator): Use assert, not internal_error. Don't
ICE with invalid pointers & references.
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.933
diff -c -3 -p -r1.933 decl.c
*** cp/decl.c 13 Sep 2002 11:33:46 -0000 1.933
--- cp/decl.c 18 Sep 2002 13:04:18 -0000
*************** grokdeclarator (declarator, declspecs, d
*** 10024,10030 ****
break;
default:
! internal_error ("`%D' as declarator", decl);
}
}
}
--- 10024,10030 ----
break;
default:
! my_friendly_assert (0, 20020917);
}
}
}
*************** grokdeclarator (declarator, declspecs, d
*** 10903,10923 ****
if (TREE_CODE (type) == REFERENCE_TYPE)
{
! error ("cannot declare %s to references",
! TREE_CODE (declarator) == ADDR_EXPR
! ? "references" : "pointers");
! declarator = TREE_OPERAND (declarator, 0);
! continue;
! }
!
! if (ctype
! && (TREE_CODE (type) == VOID_TYPE
! || TREE_CODE (type) == REFERENCE_TYPE))
! {
! error ("cannot declare pointer to `%#T' member",
! TREE_TYPE (type));
type = TREE_TYPE (type);
}
/* Merge any constancy or volatility into the target type
for the pointer. */
--- 10903,10917 ----
if (TREE_CODE (type) == REFERENCE_TYPE)
{
! error (TREE_CODE (declarator) == ADDR_EXPR
! ? "cannot declare reference to `%#T'"
! : "cannot declare pointer to `%#T'", type);
type = TREE_TYPE (type);
}
+ else if (VOID_TYPE_P (type)
+ && (ctype || TREE_CODE (declarator) == ADDR_EXPR))
+ error (ctype ? "cannot declare pointer to `%#T' member"
+ : "cannot declare reference to `%#T'", type);
/* Merge any constancy or volatility into the target type
for the pointer. */
*************** grokdeclarator (declarator, declspecs, d
*** 10928,10936 ****
if (TREE_CODE (declarator) == ADDR_EXPR)
{
! if (TREE_CODE (type) == VOID_TYPE)
! error ("invalid type: `void &'");
! else
type = build_reference_type (type);
}
else if (TREE_CODE (type) == METHOD_TYPE)
--- 10922,10928 ----
if (TREE_CODE (declarator) == ADDR_EXPR)
{
! if (!VOID_TYPE_P (type))
type = build_reference_type (type);
}
else if (TREE_CODE (type) == METHOD_TYPE)
Index: testsuite/g++.old-deja/g++.other/crash32.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.other/crash32.C,v
retrieving revision 1.2
diff -c -3 -p -r1.2 crash32.C
*** testsuite/g++.old-deja/g++.other/crash32.C 12 Feb 2001 04:10:07 -0000 1.2
--- testsuite/g++.old-deja/g++.other/crash32.C 18 Sep 2002 13:04:33 -0000
*************** namespace N
*** 26,32 ****
typedef baz<bar> c;
}
! struct z
{
int a;
};
--- 26,32 ----
typedef baz<bar> c;
}
! struct z // crash test - XFAIL *-*-*
{
int a;
};