This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: single to double conversion


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


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