rob@baloo.eng.ohio-state.edu (Rob Carriere) (08/15/88)
The following program breaks the MWC C compiler (v3.0, I don't know
about others):
------- try.c -----
float foo( bar )
float (*bar)();
{
return (*bar)(3.0); /* breaks here */
}
float sqr( sink )
float sink;
{
return sink*sink;
}
main()
{
printf( "%g\n", foo( sqr ));
exit(0);
}
------- end of try.c ---
Compile this with
cc -f try.c
to get an ``internal compiler error'' referring to the line commented
with ``breaks here''. I called MWC tech support, and they told that
they knew of the problem and were working on it, but for the time
being there was a very simple solution: change the declaration for bar
to
double (*bar)();
and it will work.
Making the appropriate changes indeed causes the program to compile
and link without errors; when run, it gives the correct output
(9.00000), and terminates normally.
BTW: tech support from MWC was very good: I was talking to the right
guy in under 30 seconds, and he was polite, helpful, to the point, and
knew what he was doing. They left a good impression there.
Rob Carriere