Bug in Pc
utzoo!decvax!duke!ucf!whm
utzoo!decvax!duke!ucf!whm
Wed Nov 11 23:17:26 AEST 1981
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.]
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list