another c bug?

brahms at spp5.UUCP.UUCP brahms at spp5.UUCP.UUCP
Sat Aug 2 08:48:00 AEST 1986


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



More information about the Mod.computers.pyramid mailing list