bug related to "cc -p" on SUN's

Jim Franklin jwf at vaxine.UUCP
Fri Aug 2 01:28:06 AEST 1985


There is a bug related to the C profiler switch (i.e., cc -p) on
SUN Microsystems 4.2BSD systems.  Take the following C program
and call it "junk.c".

main ()
{
        int i, j;

        i = -2147483648;
        j = i / 10;
        printf ("%d\n", j);
}

Then do the following on your SUN:

        > cc junk.c -o junk
        > junk
        -214748364                      (right)
        > cc -p junk.c -o junk
        > junk
        214748364                       (oops)

We are running 4.2BSD, SUN version 1.2.  This works fine on our VAXen.
I looked at the .s files for the profiled and normal compile, the only
difference is the mcount call.  The SUN compiler calls ldivt() to do the
integer divide.  I suspect that the problem is in the ldivt() you get
from the profiling version of libc.a (/usr/lib/libc_p.a).



More information about the Comp.unix.wizards mailing list