This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: WG: Problems using gcc-3.xx


On Sunday 03 March 2002 03:58, Dr. Sergio Nicola Ern? wrote:
> -----Ursprüngliche Nachricht-----
> Von: Dr. Sergio Nicola Erné [mailto:sergio-nicola.erne@zibmt.uni-ulm.de]
> Gesendet: Sonntag, 3. März 2002 12:50
> An: bug-PROGRAM@gnu.org
> Betreff: Problems using gcc-3.xx
>
>
> I was, together with coworker and students happy user of gcc for many
> years. Passing
> to gcc-3.xx we have severe trouble. Probably this is not a real bug, but we
> need some help.
> I did not find at the site of gnu.org a more suitable address for our
> problem.
The gcc-help mail list may be more suitable.
>
> we have developed over years alrge program for the analysis of biomagnetic
> and Magnetic resonanz imaging.
> The project include C++, C, and Fortran libraries.
> All this years using gcc-2.95.xx we had a Makefile using
>
> g++ for the C++ parts, g77 for Fortran and gcc for the C parts.
> we used gcc as linker.
>
> the linking sequence was organized as follow:
>
> C++ libraries, C libraries, system libraries, math library (-lm),
> fotran library, -lg2c
>
> when we passed to gcc-3.xx using gcc as linker was not more possible
> (linking impossible du to missing functions new and delete), using g++ as
> linker works, the program is linked whitout error or warnings.
> But at runtime there are errors on the mathematical library, namely often
> the results of sqrt is nan.
What kind of system are you running on?  The math libraries are not supplied 
by gcc; gcc links with the pre-existing libraries visible on your system.  
However, it is possible that the new version of gcc is using a builtin_sqrt 
where the previous one used a library function call.  Normally, that would be 
desirable, on account of increased performance.  Or, if you are running on an 
architecture with fused multiply-accumulate instructions, which the new gcc 
has decided to employ, you may find that minor inconsistencies in round-off 
produce small negative values where you expected 0.  It is conceivable that 
such an event could occur on x87 code as a result of changes in compiler 
optimization.
> The same project runs whitout errors under  UPUX, using Hp compilers and
> linkers.
>
>
> as attachment I include a copy of the Makefile
>
>
> Perhaps there is some experts that is familiar with the problem and can
> advice me in the proper procedure,
> or at least can suggest a workaround
You could modify your source to capture negative or NaN arguments to sqrt(), 
or set them to 0. if they are within tolerance.  You should be able to 
prevent use of a builtin_sqrt in C by some tactic such as #undef sqrt, and 
you could link in your own temporary sqrt() which could perform such 
checking, possibly helping you find the problem with the debugger.
You could build a copy of gcc with the .md file modified to remove the sqrt() 
and/or MAC instructions, if those are suspected as a problem.   The MIPSPro 
compilers had to include a switch to disable the use of MAC instructions, as 
it was not unusual for such a problem to occur, and they changed their later 
chips to include a MAC instruction which produced the same result as separate 
multiply and add.
>
> Thank you in advance
>
> S.N. Erné
> Biosignals and Imgaging Technology
> Central Institute for Biomedical Engineering
> University Ulm
> ULM
> Germany

-- 
Tim Prince


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]