Maurice Lombardi wrote:
Hi all, I have found a strange bug which popped up in the last beta. when compiling the following short program
program bug; var x:real; y:LongReal; begin x:=1; y:=1; writeln(cos(x)); writeln(cos(y)); writeln(cos(pi*x)); end.
the linker says that it cannot find module cosl
(* Not module cosl, but the C routine cosl(). *)
in the lines containing the second and third writeln which demand for cos(longreal) either directly or indirecly (presumably pi is long real).
Yes, that's a new bug. Since it only shows on systems without cosl() etc. in their libm, like DJGPP, we didn't note it so far.
Here's the fix, if you have the GPC sources and can recompile them:
diff -p -r -U3 -N -X /home/frank/script/gpcdiff.exclude orig/p/rts.c p/rts.c --- orig/p/rts.c Wed Feb 17 21:56:06 1999 +++ p/rts.c Wed Feb 24 02:01:13 1999 @@ -78,16 +78,16 @@ struct rts_symbol rts[] = {
{ r_COLLECT,"_p_collect", NULL_RTX, NULL_TREE, 0},
- { p_ARCTAN, "atan", NULL_RTX, NULL_TREE, 0}, - { p_COS, "cos", NULL_RTX, NULL_TREE, 0}, + { p_ARCTAN, "_p_arctan", NULL_RTX, NULL_TREE, 0}, + { p_COS, "_p_cos", NULL_RTX, NULL_TREE, 0}, { p_EXP, "_p_exp", NULL_RTX, NULL_TREE, 0}, { p_LN, "_p_ln", NULL_RTX, NULL_TREE, 0}, - { p_SIN, "sin", NULL_RTX, NULL_TREE, 0}, + { p_SIN, "_p_sin", NULL_RTX, NULL_TREE, 0}, { p_SQRT, "_p_sqrt", NULL_RTX, NULL_TREE, 0},
- { pp_ARCTAN, "atanl", NULL_RTX, NULL_TREE, 0}, - { pp_SIN, "sinl", NULL_RTX, NULL_TREE, 0}, - { pp_COS, "cosl", NULL_RTX, NULL_TREE, 0}, + { pp_ARCTAN, "_pp_arctan", NULL_RTX, NULL_TREE, 0}, + { pp_SIN, "_pp_sin", NULL_RTX, NULL_TREE, 0}, + { pp_COS, "_pp_cos", NULL_RTX, NULL_TREE, 0}, { pp_EXP, "_pp_exp", NULL_RTX, NULL_TREE, 0}, { pp_LN, "_pp_ln", NULL_RTX, NULL_TREE, 0}, { pp_SQRT, "_pp_sqrt", NULL_RTX, NULL_TREE, 0},
Otherwise, you can work around the bug until the next release by linking the following C file:
#include <math.h> long double sinl (long double x) { return sin (x); } long double cosl (long double x) { return cos (x); } long double sqrtl (long double x) { return sqrt (x); } long double logl (long double x) { return log (x); } long double expl (long double x) { return exp (x); } long double atanl (long double x) { return atan (x); } long double powl (long double x, long double y) { return pow (x, y); }
Frank