(j3.2006) (SC22WG5.3931) Two requirements for critical software at JPL
Bill Long
longb
Thu Jan 29 00:00:35 UTC 2009
Van Snyder wrote:
> I have just gotten a document frou the JPL Laboratory for Reliable
> Software, specifying coding requirements and recommendations to increase
> the reliability of critical software in C. Most of these are to work
> around defects in C, but two (which are requirements, not
> recommendations) are germane to Fortran development:
>
> 1. Declare data objects at smallest possible level of scope.
>
> We've added the BLOCK construct. The facility it provides to
> encapsulate declarations in a region smaller than a scoping unit would
> more likely be used if a specification part were allowed in every
> <block>, not just a BLOCK construct.
>
> 2. Use static and dynamic assertions as sanity checks.
>
> These were on the J3 list in 2005, but didn't make it to WG5.
>
> One of the justifications for this requirement was a study reported in
> http://research.microsoft.com/apps/pubs/default.aspx?id=70290
> ("Assessing the relationship between software assertions and code
> quality"). The abstract remarks "... with an increase in the assertion
> density in a file there is a statistically significant decrease in fault
> density. Further, the usage of software assertions in these components
> found a large percentage of the faults in the bug database."
>
>
But then the "Lessons Learned" conclusion to the paper remarks "We
believe enforcing the use of assertions would not work well."
We have recently added features to Fortran that we now have to document
with comments along the lines of "this feature is supported by the
compiler because it is in the language spec, but we strongly recommend
that it not be used in actual codes" because of disastrous performance
implications. I hesitate to add more such features.
I would note that our compiler (as a C program itself) contains an
enormous number of asserts. They help in pinpointing bugs closer to the
point where something went wrong (as opposed to much farther down the
execution sequence when the consequences of the bug manifest as a fatal
error). As such they are useful. We also get complaints that the
compiler is slow. For a compiler that's not horribly serious. For
production Fortran code poor performance is a non-starter. Different
environments and different objectives. At a minimum, if we wanted
asserts in Fortran, there would have to be a simple way to make them
appear to be comments to the compiler. (Basically the old "D" lines.)
Cheers,
Bill
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
More information about the J3
mailing list