[gnu.g++.bug] fix for g++ segmentation fault

schmidt%crimee.ics.uci.edu@PARIS.ICS.UCI.EDU ("Douglas C. Schmidt") (01/19/89)

Hi,

  G++ 1.32 fails when presented with strange input like this:

----------------------------------------
	typedef int *win_error_function(int, int);
	int win_errorhandler(win_error_function);
----------------------------------------

The following patches fix this problem:

----------------------------------------
*** cplus-decl.c.~1~	Tue Jan 17 23:07:21 1989
--- cplus-decl.c	Thu Jan 19 02:40:53 1989
***************
*** 4245,4256 ****
  
          if (TREE_CODE (type) == FUNCTION_TYPE)
            {
!             error ("parameter `%s' invalidly declared function type", IDENTIFIER_POINTER (declarator));
              type = build_pointer_type (type);
            }
          else if (TREE_CODE (type) == MEMBER_TYPE)
            {
!             error ("parameter `%s' invalidly declared member type", IDENTIFIER_POINTER (declarator));
              type = build_pointer_type (type);
            }
  
--- 4245,4262 ----
  
          if (TREE_CODE (type) == FUNCTION_TYPE)
            {
!             if (declarator == NULL_TREE)
!               error ("formal parameter invalidly declared function type");
!             else
!               error ("parameter `%s' invalidly declared function type", IDENTIFIER_POINTER (declarator));
              type = build_pointer_type (type);
            }
          else if (TREE_CODE (type) == MEMBER_TYPE)
            {
!             if (declarator == NULL_TREE)
!               error ("formal parameter invalidly declared member type");
!             else 
!               error ("parameter `%s' invalidly declared member type", IDENTIFIER_POINTER (declarator));
              type = build_pointer_type (type);
            }