From: Arjen M. <arj...@de...> - 2011-01-27 10:36:36
|
Hi Alan, I get an error message with gfortran 4.6, but not with ifort. The value is -2147483648, which is the largest negative number that actually fits into a 32-bits twos-complement integer. I think this is a bug in gfortran: setting PL_FCI_MARK to -2147483647 and then printing PL_FCI_MARK-1 gives the original value but printing PL_FCI_MARK-2 produces a compile error: program boz integer, parameter :: PL_FCI_MARK = -2147483647 integer, parameter :: PL_FCI_SERIF = z'1' write(*,*) PL_FCI_MARK-1 write(*,*) PL_FCI_MARK-2 end program produces: boz.f90:8.10: write(*,*) PL_FCI_MARK-2 1 Error: Arithmetic overflow at (1) I will report this. Meanwhile the solution would be to add the option -fno-range-check. Regards, Arjen On 2011-01-27 11:11, Alan W. Irwin wrote: > On 2011-01-27 01:20-0800 Alan W. Irwin wrote: > >> Hi Arjen: >> >> I have the sed script almost working for f95. The only problematic >> statement generated is >> >> integer, parameter :: PL_FCI_MARK = z'80000000' >> >> That z'80000000' causes an integer overflow. The problem is that >> z'80000000' is not a normal 4-byte integer. Assuming twos-complement >> integers, then the negative of that number is also z'80000000'. That >> is, it is a "negative" zero or zero with the sign bit set. Do you know >> how to put that exact pattern of bits into a 4-byte integer in fortran? >> >> For now, I have simply dropped PL_FCI_MARK (since it is not used in >> any of the examples), but it would be nice to include it for >> completeness if you can figure out an equivalent of the above >> parameter statement that will put that exact pattern into the >> PL_FCI_MARK 4-byte integer. >> >> Also, could you comment on BOZ constants used in parameter statements >> such as >> >> integer, parameter :: PL_FCI_SERIF = z'1' >> >> gfortran is happy to accept those, but I am not sure other Fortran >> compilers are able to. The issue is that hexadecimal constants are >> sometimes used in plplotcapi.i (and the equivalent #defines in >> include/plplot.h) so I have converted those to the BOZ form using the >> sed script. If the BOZ form is not acceptable to some Fortran >> compilers in the above context, then I could use a python script to do >> the conversions from hexadecimal constants to decimal constants. >> >> Further changes to the Fortran 95 examples are required by this sed >> script approach since you cannot have local parameters in the examples >> trying to override the parameter values set by the module. So with >> luck it should only be a matter of removing all those local parameters >> that are set in the Fortran 95 examples, testing to make sure >> everything works as before, then doing the commit. I plan to continue >> with those steps after I get some sleep. > > Hi Arjen: > > Well, I stayed up a bit later and I finished these described Fortran > 95 changes as of revision 11511. So please take a look at the > generated bindings/f95/plplot_parameters.h and let me know if there > are any concerns about the BOZ form (actually just Z form) used to > define the values of some of the parameters there. And the above > question about a Fortran method of setting the negative zero bit > pattern for PL_FCI_MARK still remains as well. > > Aside from these questions and committing the sed script and > a CMake custom target to use that script appropriately, I am > done with Fortran 95 for a while. Also, the only thing > left on my Fortran 77 agenda is an equivalent sed-script > approach there for generating bindings/f77/plplot_parameters.h. > > Alan > __________________________ > Alan W. Irwin > > Astronomical research affiliation with Department of Physics and Astronomy, > University of Victoria (astrowww.phys.uvic.ca). > > Programming affiliations with the FreeEOS equation-of-state implementation > for stellar interiors (freeeos.sf.net); PLplot scientific plotting software > package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of > Linux Links project (loll.sf.net); and the Linux Brochure Project > (lbproject.sf.net). > __________________________ > > Linux-powered Science > __________________________ > DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. |