Compiling software with different compiler than cc or clang results in unusable output

O. Hartmann ohartman at mail.zedat.fu-berlin.de
Sat Sep 11 09:28:34 UTC 2010


Dear Sirs,

you see me a kind of desperate. I wrote my own a small piece of  
software in C, calculating the orbit and position of astronomical 
objects, astroids, in a heliocentric coordinate system from Keplerian 
orbital elements. So far. The software calculates the set of points of 
an ellipse based upon ephemeridal datas taken from the Minor Planet 
Cataloge. Again, so far, everything all right. The set of points of an 
orbit is all right and correct. But when it comes to positions at a 
specific time, then I loose hair!

Compiling this piece of software with FreeBSD's gcc (V4.2) and clang 
(clang devel) on my private and lab's FreeBSD boxes (both most recent 
FreeBSD 8.1/amd64), this program does well, the calculated orbital 
positions are very close to professional applications or observational 
checks. But when compiling the sources with gcc44 or gcc45 (same source, 
same CFLAG setting, mostly no CFLAGS set), then there is a great 
discrepancy. Sometimes when plotting positions, the results plotted 
seconds before differs from the most recent. The ellipses are allways 
correct, but the position of a single point at a specific time isn't 
correct.

I use the GNU autotools to build the package.

I suspekt miscompilations in memory alloction or in some time- or 
mathematical functions like sin, cos.

before I digg deeper I'd like to ask the community for some hints how to 
hunt down such a problem.

regards,
Oliver


More information about the freebsd-questions mailing list