🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mod.computers.pyramid
Article #31

another c bug?

#31
From: brahms
Date: Fri, 01 Aug 1986 22:48
77 lines
2488 bytes
The following problem came up while I was trying to compile larn on a
pyramid.  I'm curious to know if it is a bug with the Pyramid C compiler
or something that just happens to work on a number of other machines but
not the Pyramid?  It appears that the called procedure writes information
on what is believes is the top of the stack.  Anyway, to get around it, I
modifed lprintf from larn to included extra arguments such as in
five_int_args below.

Script started on Fri Aug  1 15:39:12 1986
demo: cat t.c
#include <stdio.h>

five_int_args (args, a, b, c, d)
int args, a, b, c, d;

{
    int     *pargs;
    int     i;

    pargs = &args;
    while (*pargs != 0)
        printf ("%d : ", *pargs++);
    printf ("%d\n", 0);
}

show_int_args (args)
int args;

{
    int     *pargs;
    int     i;

    pargs = &args;
    while (*pargs != 0)
        printf ("%d : ", *pargs++);
    printf ("%d\n", 0);
}

main()
{
    show_int_args (0);
    show_int_args (1, 0);
    show_int_args (1, 2, 0);
    show_int_args (1, 2, 3, 0);
    show_int_args (1, 2, 3, 4, 0);
    show_int_args (1, 2, 3, 4, 5, 0);
    five_int_args (1, 2, 3, 4, 0);
}
demo: cc -o t t.c
demo: t
0
1 : 0
1 : 2 : -1072901880 : 320 : 12 : -1072902016 : 0
1 : 2 : -1072901880 : 0
1 : 2 : -1072901880 : 4 : 0
1 : 2 : -1072901880 : 4 : 5 : 0
1 : 2 : 3 : 4 : 0
demo: what /lib/ccom
/lib/ccom
        CCOMP_3.1.9     Mar 19 16:50:26 1986
        yaccpar 4.1     (Berkeley)      2/11/83
        FLUSH.c 1.2 6/10/81
        NEW.c 1.3 6/10/81
        UNIT.c 1.2 6/10/81
        WRITLN.c 1.2 6/10/81
        ERROR.c 1.10 1/10/83
        PCEXIT.c 1.1 10/30/80
        PCLOSE.c 1.6 1/21/83
        PCSTART.c 1.8 1/10/83
        PFCLOSE.c       1.3     (Berkeley)      1/21/83
        PERROR.c 1.2 1/10/83
        PFLUSH.c 1.2 1/21/83
        EXCEPT.c 1.3 1/10/83
        malloc.c        4.3 (Berkeley) 9/16/83

script done on Fri Aug  1 15:40:23 1986
Technical Details
Message-ID: <8608012248.AA06827@spp5.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!decvax!decwrl!ucbvax!spp5.UUCP!brahms

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!decvax!decwrl!ucbvax!spp5.UUCP!brahms
From: brahms@spp5.UUCP.UUCP
Newsgroups: mod.computers.pyramid
Subject: another c bug?
Message-ID: <8608012248.AA06827@spp5.UUCP>
Date: Fri, 1-Aug-86 18:48:00 EDT
Article-I.D.: spp5.8608012248.AA06827
Posted: Fri Aug  1 18:48:00 1986
Date-Received: Sat, 2-Aug-86 03:21:22 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 77
Approved: info-pyramid@mimsy.umd.edu