single to double conversion

Richard E Maine Richard.Maine@nasa.gov
Wed Sep 27 17:19:00 GMT 2006


On Sep 27, 2006, at 10:01 AM, Tim Prince wrote:

> Brian Barnes wrote:
>
>> However, in g77, the real*4 of the function was 'detected' and
>> auto-promoted to real*8 in the subroutine.

> Sorry, but you persist in ignoring the fact that g77 works this way  
> only when using the f2c compatibility option, where function  
> results are passed as C double, because that is the way C worked  
> when f2c was first developed.  g77 is not recognizing the source  
> code error and correcting it; it just happens to work that way on  
> the platforms and with the options you chose to use.

In fact, I don't know of *ANY* Fortran compiler that has ever  
detected that kind of error and corrected it. I have run into people  
who thought that was happening, but they were always wrong - yes,  
that is always. For example, the last person who told me he knew of a  
compiler that was being "smart" about this turned out to be using a  
system with the old IBM mainframe floating point representation (his  
system wasn't an IBM, but used that representation). It just happened  
that with that representation, and with the right byte sex, passing a  
double actual argument to a single dummy worked - sort of -  
sometimes. It wasn't a "smart" compiler at all. The buggy code was  
just close enough to working that the symptoms were hidden. Worse,  
there were people who intentionally took advantage of that as a  
"feature"; the codes broke severely when moved to any other system.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain



More information about the Fortran mailing list