Aucf.212
net.4bsd-bugs
utzoo!decvax!duke!ucf!whm
Wed Nov 11 23:17:26 1981
Bug in Pc
This describes a strange problem that I am having with pc.

The following program works just fine:
-------------------------------------
program x(input,output);
var mdate,stime,abcd: alfa ;
begin
       writeln(' x.p  test');
       time(stime);
       writeln(' time:',stime:10);
       date(mdate);
       writeln(' date:',mdate:10);
end.

While the following program gets "Illegal Instruction"
-------------------------------------
program x(input,output);
var mdate,stime,ctime: alfa ;
begin
       writeln(' x.p  test');
       time(stime);
       writeln(' time:',stime:10);
       date(mdate);
       writeln(' date:',mdate:10);
end.
-------------------------------------
Although I was getting "Illegal Instruction", I was getting no core dump.

I tried running it with adb and found that the trace back indicated that
_ctime was being called from _TIME at the time of failure.

I consulted the source for "time" in /usr/src/lib/pc/TIME.c and found that
ctime is declared as an extern.  It is curious that the linker is getting
mixed up by this and not flagging it.  I grepped in lib/pc for other externs
and found that index and malloc were also declared as externs.  I tried
substituting malloc for ctime and found that ld flagged malloc as
multiply-defined.

Well, this seems like a fairly serious bug that needs to be fixed, although
it can be gotten around.

                                       Bill Mitchell
                                       Univ. of Central Florida
ps.
This was compiled under a 4.1 system that was shipped about one week ago.
We had a similar problem under 4.0, but that was just before we switched
over and I didn't have a chance to pursue it then.
[My apologies if this is mentioned in the documentation somewhere and I
missed it.]

-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <[email protected]>
of http://communication.ucsd.edu/A-News/


This Usenet Oldnews Archive
article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.

2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.