🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Christopher Maeda Tue, 10 Nov 1992 22:51
mips/decstation gcc 2.3.1 emits _mcount in a bad place
#1338
Author: Christopher Maeda
Date: Tue, 10 Nov 1992 22:51
74 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads