For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > compilation on different machines led to different executables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author compilation on different machines led to different executables
bau12374

2005-05-30, 3:58 pm

I was provided with the source code and the executable of a numerical
model, which I have to use for my studies.

After compiling the code on my machine I tried to run the executable.
Unfortunately, it stopped due to a "division by zero" forced by a
mistake in the code for special input values equal zero. I do not
encounter this problem with the original executable, although it is
based on the very same code.

Can anyone provide me with an explanation - given the code, compiler
and compiler flags being the same -
1) why the original executable somehow handles the error (division by
zero should always lead to an abort) and
2) why there are different executables when compiling it on different
machines (both windows)?
Solutions or Workarounds are welcome, but I'm mainly interested in a
general explanation.

Thank you for your help.
Jens

Tim Prince

2005-05-30, 8:57 pm

bau12374 wrote:

> I was provided with the source code and the executable of a numerical
> model, which I have to use for my studies.
>
> After compiling the code on my machine I tried to run the executable.
> Unfortunately, it stopped due to a "division by zero" forced by a
> mistake in the code for special input values equal zero. I do not
> encounter this problem with the original executable, although it is
> based on the very same code.
>
> Can anyone provide me with an explanation - given the code, compiler
> and compiler flags being the same -
> 1) why the original executable somehow handles the error (division by
> zero should always lead to an abort) and
> 2) why there are different executables when compiling it on different
> machines (both windows)?
> Solutions or Workarounds are welcome, but I'm mainly interested in a
> general explanation.
>
>

Without more detail, I doubt you will get a satisfactory answer. Certain
compilers could choose optimization for the style of CPU detected at
compile time, or even provide for multiple code execution paths for
differing CPUs, so you will have to look up the options of your compiler.
There isn't a generally accepted model for dealing with division by zero on
Windows, other than to use the default IEEE floating point model.
--
Tim Prince
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com