[gnu.g++.bug] g++-1.36.1, sun4os4, unrecognizable insn

fox@allegra.tempo.nj.att.com (David Fox) (11/28/89)

The following program causes a compiler crash.  Hopefully it
is not due to my minor compiler mods.

------------- bug.cc ----------------
class Object {
public:
  virtual int foo(int n);
};

class Pointer : public Object {
  Object* _object;
public:
};

typedef struct {
  int timestamp;
  int first_line;
  int first_column;
  int last_line;
  int last_column;
  char *text;
} yyltype;

short *yyr2;

int
yyparse()
{
  Pointer *yyvsp;
  yyltype  yylsa[200 ];	 
  Pointer yyval;		 
  int yylen;

  yylen = yyr2[0];
  yyval = yyvsp[1-yylen];  
}
-------------------------------------

------------ output -----------------
cd /usr/fox/src/ntrees/
gmake bug.o
g++-1.36.1 -g -I/usr/fox/include   -c bug.cc -o bug.o
bug.cc: In function int yyparse ():
bug.cc:32: The following insn was not recognizable:
(insn 17 16 18 (set (mem:SI (plus:SI (reg:SI 30)
               (const_int -4844)))
       (mem/s:SI (plus:SI (reg:SI 30)
               (reg:SI 68)))) -1 (nil)
   (nil))
g++-1.36.1: Program cc1plus got fatal signal 6.
gmake: *** [bug.o] Error 1

Compilation exited abnormally with code 1 at Mon Nov 27 18:41:24
-------------------------------------
David Fox
fox@allegra.att.com

tiemann@arkesden.eng.sun.com (Michael Tiemann) (11/28/89)

Here was the problem:

Mon Nov 27 06:30:53 1989  Michael Tiemann  (tiemann at arkesden)

	* expr.c (save_noncopied_parts): Deal with case of having
	`assign_stack_local' return an invalid memory reference.

Here is the fix.  GCC'ers, your line numbers will vary.  These line
numbers are against test release 1.36.2 from this morning.

    arkesden% diff -c2 expr.c~ expr.c
    *** expr.c~	Sat Oct 14 16:06:47 1989
    --- expr.c	Mon Nov 27 17:37:43 1989
    ***************
    *** 2124,2129 ****
	    tree part_type = TREE_TYPE (part);
	    tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part, 0);
	    parts = tree_cons (to_be_saved,
    ! 			   build (RTL_EXPR, part_type, 0, (tree) assign_stack_local (TYPE_MODE (part_type), int_size_in_bytes (part_type))),
			       parts);
	    store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
    --- 2124,2133 ----
	    tree part_type = TREE_TYPE (part);
	    tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part, 0);
    + 	rtx target = assign_stack_local (TYPE_MODE (part_type),
    + 					 int_size_in_bytes (part_type));
    + 	if (! memory_address_p (TYPE_MODE (part_type), XEXP (target, 0)))
    + 	  target = change_address (target, TYPE_MODE (part_type), 0);
	    parts = tree_cons (to_be_saved,
    ! 			   build (RTL_EXPR, part_type, 0, (tree) target),
			       parts);
	    store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
    arkesden% 

Michael