Article View: gnu.gcc.bug
Article #1338mips/decstation gcc 2.3.1 emits _mcount in a bad place
From: Christopher Maeda
Date: Tue, 10 Nov 1992 22:51
Date: Tue, 10 Nov 1992 22:51
74 lines
3147 bytes
3147 bytes
When compiling the following code, gcc emits a call to mcount that
trashes register 2 (the value return register). What's wrong here?
MC8 /usr0/cmaeda : cat testgcc.c
struct xxx {
struct xxx *next;
struct xxx *prev;
int data;
} foo;
void
function()
{
foo.next = foo.prev = &foo;
}
MC8 /usr0/cmaeda : gcc -v -S -O -pg testgcc.c
Reading specs from /usr/misc/.gnu-comp/lib/gcc-lib/mips-dec-mach/2.3.1/specs
gcc version 2.3.1
/usr/misc/.gnu-comp/lib/gcc-lib/mips-dec-mach/2.3.1/cpp -lang-c -v -iprefix /afs/cs.cmu.edu/project/mach3/latest/release/@sys/lib/gcc-mips-dec-mach/2.3.1/ -undef -D__GNUC__=2 -D__ANSI_COMPAT -DMIPSEL -DR3000 -DSYSTYPE_BSD -Dbsd4_2 -Dhost_mips -Dmips -Dpmax -Dunix -DMACH -DCMU -DCMUCS -DMTXINU -D__ANSI_COMPAT -D__MIPSEL__ -D__R3000__ -D__SYSTYPE_BSD__ -D__bsd4_2__ -D__host_mips__ -D__mips__ -D__pmax__ -D__unix__ -D__MACH__ -D__CMU__ -D__CMUCS__ -D__MTXINU__ -D__ANSI_COMPAT -D__MIPSEL -D__R3000 -D__SYSTYPE_
BSD -D__bsd4_2 -D__host_mips -D__mips -D__pmax -D__unix -D__MACH -D__CMU -D__CMUCS -D__MTXINU -D__OPTIMIZE__ -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C testgcc.c /usr/tmp/cc000517.i
GNU CPP version 2.3.1 [AL 1.1, MM 28] DECstation running Mach
/usr/misc/.gnu-comp/lib/gcc-lib/mips-dec-mach/2.3.1/cc1 /usr/tmp/cc000517.i -mgpopt -quiet -dumpbase testgcc.c -O -version -p -o testgcc.s
GNU C version 2.3.1 [AL 1.1, MM 28] DECstation running Mach compiled by GNU C version 2.3.1.
MC8 /usr0/cmaeda : cat testgcc.s
.file 1 "testgcc.c"
.set nobopt
# GNU C 2.3.1 [AL 1.1, MM 28] DECstation running Mach compiled by GNU C
# Cc1 defaults:
# Cc1 arguments (-G value = 8, Cpu = default, ISA = 1):
# -mgpopt -quiet -dumpbase -O -version -p -o
gcc2_compiled.:
.space 4
.text
.align 2
.globl function
.comm foo,16
.text
.loc 1 10
.ent function
function:
.frame $sp,0,$31 # vars= 0, regs= 0/0, args = 0, extra= 0
.mask 0x00000000,0
.fmask 0x00000000,0
la $2,foo
.data
.align 2
$LP1:
.word 0
.text
.set noreorder
.set noat
move $1,$31 # save current return address
jal _mcount
subu $sp,$sp,8 # _mcount pops 2 words from stack
.set reorder
.set at
sw $2,4($2)
.set noreorder
.set nomacro
j $31
sw $2,0($2)
.set macro
.set reorder
.end function
Technical Details
Message-ID:
<9211102251.AA28642@life.ai.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mc8.mach.cs.cmu.edu!cmaedaShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!mc8.mach.cs.cmu.edu!cmaeda From: cmaeda@mc8.mach.cs.cmu.edu (Christopher Maeda) Subject: mips/decstation gcc 2.3.1 emits _mcount in a bad place Message-ID: <9211102251.AA28642@life.ai.mit.edu> Sender: gnulists@ai.mit.edu Reply-To: cmaeda@cs.cmu.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 10 Nov 1992 22:51:06 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 74