🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1472

G++ 1.27.0 Segementation Violation

#1472
From: Clark Cooper
Date: Thu, 06 Oct 1988 16:23
106 lines
4889 bytes
Version:	G++ 1.27.0
Hardware:	Sun 3/50
OS:		SunOS 3.5
Configuration:	tm.h -> tm-sun3+.h
		md -> m68k.md

Input file:	scene.cc from InterViews 2.3

Symptoms:	Segmentation Violation in c++

=========================
Script started on Thu Oct  6 10:12:24 1988
sculptorq% g++ -v -g -O -DX11 -c scene.cc
g++ version 1.27.0
 /usr/local/lib/gcc-cpp+ -v -DX11 -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ scene.cc /tmp/cca01201.cpp
GNU CPP version 1.27.0
 /usr/local/lib/gcc-c++ /tmp/cca01201.cpp -quiet -dumpbase scene.cc -opt -version -G -o /tmp/cca01201.s
GNU C++ version 1.27.0 (68k, MIT syntax) compiled by CC.

At top level:
scene.cc:18: warning: use of obsolete scope operator `.'; use `::' instead

In function void Scene::DoMap (struct Interactor *):
scene.cc:336: Segmentation violation
/usr/sculptorq/gnu/src/g++/g++: Program c++ got fatal signal 11.
sculptorq% gdb+ /usr/sculptorq/gnu/gcc-c++ core
GDB 2.8.0 (GNU C++ 1.27.0 compatible), Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /usr/sculptorq/gnu/gcc-c++...done.
Core file is from "gcc-c++".
Program terminated with signal 11, Segmentation fault.
Type "help" for a list of commands.
(gdb+) directory /usr/sculptorq/gnu/src/g++
Source directories searched: /usr.MC68020/sculptorq/gnu/src/InterViews/src/lib:/usr/sculptorq/gnu/src/g++
(gdb+) where
#0  0x3171e in fixup_memory_subreg (x=(rtx) 0x10f84c) (stmt.c line 2524)
#1  0x31204 in fixup_var_refs_1 (var=(rtx) 0x10f4c0, x=(rtx) 0x10f84c, insn=(rtx) 0x10f87c) (stmt.c line 2380)
#2  0x3168a in fixup_var_refs_1 (var=(rtx) 0x10f4c0, x=(rtx) 0x10f870, insn=(rtx) 0x10f87c) (stmt.c line 2499)
#3  0x3112a in fixup_var_refs (var=(rtx) 0x10f4c0) (stmt.c line 2327)
#4  0x31080 in put_var_into_stack (decl=(union tree_node *) 0x10f468) (stmt.c line 2300)
#5  0x1d92c in mark_addressable (exp=(union tree_node *) 0x10f468) (typecheck.c line 3476)
#6  0x1d192 in build_unary_op (code=ADDR_EXPR, xarg=(union tree_node *) 0x10f468, noconvert=0) (typecheck.c line 3197)
#7  0x1c8a6 in build_x_unary_op (code=ADDR_EXPR, xarg=(union tree_node *) 0x10f468) (typecheck.c line 2840)
#8  0x5428 in yyparse () (parse.y line 458)
#9  0x31f0 in compile_file (name=(char *) 0xefffd24 "/tmp/cca01201.cpp") (toplev.c line 905)
#10 0x4862 in main (argc=10, argv=(char **) 0xefffcbc, envp=(char **) 0xefffce8) (toplev.c line 1716)
(gdb+) list fixup_memory_subreg
2512	   return an rtx (MEM:m1 newaddr) which is equivalent.  */
2513	
2514	static rtx
2515	fixup_memory_subreg (x)
2516	     rtx x;
2517	{
2518	  int offset = SUBREG_WORD (x) * UNITS_PER_WORD;
2519	  rtx addr = XEXP (SUBREG_REG (x), 0);
2520	  enum machine_mode mode = GET_MODE (x);
2521	
(gdb+) 
2522	#ifdef BYTES_BIG_ENDIAN
2523	  offset += (MIN (UNITS_PER_WORD, GET_MODE_SIZE (SUBREG_REG (x)))
2524		     - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
2525	#endif
2526	  return change_address (SUBREG_REG (x), mode,
2527				 plus_constant (addr, offset));
2528	}
2529	^L
2530	#if 0
2531	/* Fix up any references to stack slots that are invalid memory addresses
(gdb+) quit
sculptorq% ^D
script done on Thu Oct  6 10:14:55 1988
=========================

Recommended Patch:

*** stmt.c~     Sun Sep 11 00:54:53 1988
--- stmt.c      Thu Oct  6 10:16:15 1988
***************
*** 2519,2528 ****
    rtx addr = XEXP (SUBREG_REG (x), 0);
    enum machine_mode mode = GET_MODE (x);
  
  #ifdef BYTES_BIG_ENDIAN
!   offset += (MIN (UNITS_PER_WORD, GET_MODE_SIZE (SUBREG_REG (x)))
!            - MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (x))));
  #endif
    return change_address (SUBREG_REG (x), mode,
                         plus_constant (addr, offset));
  }
--- 2519,2528 ----
    rtx addr = XEXP (SUBREG_REG (x), 0);
    enum machine_mode mode = GET_MODE (x);
  
  #ifdef BYTES_BIG_ENDIAN
!   offset += (MIN (UNITS_PER_WORD, GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
!            - MIN (UNITS_PER_WORD, GET_MODE_SIZE (mode)));
  #endif
    return change_address (SUBREG_REG (x), mode,
                         plus_constant (addr, offset));
  }
--
Clark Cooper       cooper@gecrux.steinmetz.ge.com, coopercc@crd.ge.com,
                   coopercc@ge-crd.arpa, ...!uunet!steinmetz!cooper
Technical Details
Message-ID: <COOPER.88Oct6122657@gecrux.steinmetz.ge.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!steinmetz!kbsvax!cooper

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!uunet!steinmetz!kbsvax!cooper
From: cooper@gecrux.steinmetz.ge.com (Clark Cooper)
Newsgroups: gnu.g++.bug
Subject: G++ 1.27.0 Segementation Violation
Message-ID: <COOPER.88Oct6122657@gecrux.steinmetz.ge.com>
Date: 6 Oct 88 16:23:56 GMT
Sender: news@steinmetz.ge.com
Organization: GE Corporate Research & Development
Lines: 106