Gabi Voiculescu <boy3dfx2@xxxxxxxxx> writes: > When running, the function llrint() using and returning 64 bit variables fails to call rint(), and instead calls itself!?!. > > #include <stdio.h> > extern double rint(double x); > > long long llrint(double x); > long long llrint(double x) > { > printf("%s,%d llrint entry\n", __func__, __LINE__); //-gabi 07/08/2009 > return (long long) rint(x); > } > > When calling llrint I see the print statement repeated forever, without calling rint() or returning from llrint(). gcc is outsmarting itself. When it sees "(long long) rint(x)", it converts that into "llrint(x)". This is normally a safe conversion, but of course it is unsafe when you are trying to implement llrint itself. You can avoid this problem by using the -fno-builtin-rint option. Ian