pab@naucse.UUCP (Paul Balyoz) (03/12/89)
Having fixed the toupper and malloc strlen+1 bugs in QRT,
we still couldn't run it successfully on any of the demo
".qrt" files supplied. After 5-15 minutes of run-time on
our Microvax 3500 running Ultrix 2.2, the program would
core-dump reporting an "illegal instruction error".
After many hours of debugging I finally discovered that
in some portions of the code, CINFO structures are alloc-
ated and then copied elsewhere without first being init-
ialized. Other data types such as ints and longs would
put up with this behavior, but not floats! On our machine,
if the data at the address in memory where a float was
allocated just happens to be 32768 (decimal), the float
equivalent of it is actually infinite, and all attempts
to read it cause a core dump. It's really unsettling when
dbx core-dumps itself and kicks you back to the shell
while trying to track something like this down! (And all
the time I thought this sort of thing would be a "Floating-
Point Exception"....)
Anyway, here's a context diff which solves the problem.
It's a kludge; my only purpose was to get it running with
the least modifications. If you've been having problems
like we have, then use this patch; otherwise wait for the
official (and more aesthetic) patch to come from the
author himself.
QRT is really a nice ray tracer! Much thanks to Mr. Koren
for allowing others to use his fine program.
-- paul
*** /tmp/,RCSt1016666 Sat Mar 11 20:39:19 1989
--- inout.c Sat Mar 11 17:56:01 1989
***************
*** 75,80
CINFO cinfo;
int found;
name=NULL; queue=NULL;
VectEqZero(&loc);
VectEqZero(&rad);
--- 75,82 -----
CINFO cinfo;
int found;
+ def_colorinfo (&cinfo); /* Initialize it to SOMETHING! pab */
+
name=NULL; queue=NULL;
VectEqZero(&loc);
VectEqZero(&rad);
***************
*** 468,473
VECTOR loc, lk, up, dir, v3, upper, lower;
CINFO cinfo;
int end, f, found;
end=f=0;
up.x = up.z = 0; up.y = 1;
--- 470,477 -----
VECTOR loc, lk, up, dir, v3, upper, lower;
CINFO cinfo;
int end, f, found;
+
+ def_colorinfo (&cinfo); /* Initialize it to SOMETHING! pab */
end=f=0;
up.x = up.z = 0; up.y = 1;
*** /tmp/,RCSt1016686 Sat Mar 11 20:39:33 1989
--- stack.c Sat Mar 11 17:50:05 1989
***************
*** 204,209
VECTOR loc,v1,v2,v3, upper, lower;
OBJ_PTR line;
VectEqZero(&loc);
VectEqZero(&v1);
VectEqZero(&v2);
--- 204,211 -----
VECTOR loc,v1,v2,v3, upper, lower;
OBJ_PTR line;
+ def_colorinfo (&cinfo); /* Initialize cinfo to SOMETHING! pab */
+
VectEqZero(&loc);
VectEqZero(&v1);
VectEqZero(&v2);
--
Paul Balyoz, Software Specialist II ...!arizona!naucse!root
Northern Arizona University --or--
PO Box 15600 ...!arizona!naucse!pab
Flagstaff, AZ 86011