public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Signalling NaNs for floating point initialization?
@ 1998-12-17  8:35 Thomas Koenig
  1998-12-17 11:03 ` Dave Love
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Koenig @ 1998-12-17  8:35 UTC (permalink / raw)
  To: egcs

One of the most useful options on an SGI Fortran compiler I've worked
with some years ago was to set all floating point variables to
signalling NaNs upon startup of a program, which helped a lot in
converting old code and in finding quite a few bugs in new ones.

What do you think about implementing this in g77?
-- 
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Signalling NaNs for floating point initialization?
  1998-12-17  8:35 Signalling NaNs for floating point initialization? Thomas Koenig
@ 1998-12-17 11:03 ` Dave Love
  1998-12-17 21:22   ` Jeffrey A Law
  1998-12-19  0:32   ` Craig Burley
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Love @ 1998-12-17 11:03 UTC (permalink / raw)
  To: Thomas König; +Cc: egcs

>>>>> "TK" == Thomas Koenig <ig25@mvmap66.ciw.uni-karlsruhe.de> writes:

 TK> One of the most useful options on an SGI Fortran compiler I've
 TK> worked with some years ago was to set all floating point
 TK> variables to signalling NaNs upon startup of a program, which
 TK> helped a lot in converting old code and in finding quite a few
 TK> bugs in new ones.

Indeed, for values of `One of the most useful options' equal to `about
the only good thing', at least as of a couple of years ago...

 TK> What do you think about implementing this in g77?

AFAIR, it's on the todo list and definitely a good idea.  It's
probably straightforward for scalars by analogy with
-finit-local-zero, but not for arrays; the backend doesn't seem to
provide a facility for initializing aggregates to a repeating bit
pattern other than zeroes (presumably reflecting what assemblers give
you).

Craig had some objection to work on this which I can't recall but
perhaps he can; it was probably to doing only part of the job,
i.e. scalars, which probably aren't the main source of such bugs.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Signalling NaNs for floating point initialization?
  1998-12-17 11:03 ` Dave Love
@ 1998-12-17 21:22   ` Jeffrey A Law
  1998-12-18 12:23     ` Dave Love
  1998-12-19  0:32   ` Craig Burley
  1 sibling, 1 reply; 6+ messages in thread
From: Jeffrey A Law @ 1998-12-17 21:22 UTC (permalink / raw)
  To: Dave Love; +Cc: Thomas K nig, egcs

  In message < rzq3e6efv6r.fsf@djlvig.dl.ac.uk >you write:
  > -finit-local-zero, but not for arrays; the backend doesn't seem to
  > provide a facility for initializing aggregates to a repeating bit
  > pattern other than zeroes (presumably reflecting what assemblers give
  > you).
But handling this is a relatively straightforward extension to clear_storage.  


jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Signalling NaNs for floating point initialization?
  1998-12-17 21:22   ` Jeffrey A Law
@ 1998-12-18 12:23     ` Dave Love
  1998-12-18 20:03       ` Jeffrey A Law
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Love @ 1998-12-18 12:23 UTC (permalink / raw)
  To: egcs

>>>>> "Jeff" == Jeffrey A Law <law@upchuck.cygnus.com> writes:

 Jeff> But handling this is a relatively straightforward extension to
 Jeff> clear_storage.

Given sufficient guidance, I can probably volunteer.  g77 doesn't
currently use clear_storage AFAICT, but I'm highly ignorant of the
backend stuff.

(This should be useful for all languages, of course.)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Signalling NaNs for floating point initialization?
  1998-12-18 12:23     ` Dave Love
@ 1998-12-18 20:03       ` Jeffrey A Law
  0 siblings, 0 replies; 6+ messages in thread
From: Jeffrey A Law @ 1998-12-18 20:03 UTC (permalink / raw)
  To: Dave Love; +Cc: egcs

  In message < rzq1zlxdwsf.fsf@djlvig.dl.ac.uk >you write:
  > >>>>> "Jeff" == Jeffrey A Law <law@upchuck.cygnus.com> writes:
  > 
  >  Jeff> But handling this is a relatively straightforward extension to
  >  Jeff> clear_storage.
  > 
  > Given sufficient guidance, I can probably volunteer.  g77 doesn't
  > currently use clear_storage AFAICT, but I'm highly ignorant of the
  > backend stuff.
clear_storage happens implicitly for some initializers and for some calls
to memset.  See expr.c

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Signalling NaNs for floating point initialization?
  1998-12-17 11:03 ` Dave Love
  1998-12-17 21:22   ` Jeffrey A Law
@ 1998-12-19  0:32   ` Craig Burley
  1 sibling, 0 replies; 6+ messages in thread
From: Craig Burley @ 1998-12-19  0:32 UTC (permalink / raw)
  To: d.love; +Cc: burley

>Craig had some objection to work on this which I can't recall but
>perhaps he can; it was probably to doing only part of the job,
>i.e. scalars, which probably aren't the main source of such bugs.

Maybe, but I can't recall, other than, long ago when this was first
suggested, I liked it (and wrote it down), but was probably very
nervous about how such changes would affect the "back end" of the g77
front end, especially if they required changes in the gcc/g77 back end
itself.

Now that g77 is egcs-ized, I feel a lot less "ownerous" about it, and
don't mind if others try things out.  It's a lot easier to approve
other peoples' patches, for example, when I don't have to do all the
work myself to apply them, do basic testing, document them, package
up alpha releases, upload, and announce them...and undo it all if
the patches don't work out somehow!

        tq vm, (burley)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-12-19  0:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-12-17  8:35 Signalling NaNs for floating point initialization? Thomas Koenig
1998-12-17 11:03 ` Dave Love
1998-12-17 21:22   ` Jeffrey A Law
1998-12-18 12:23     ` Dave Love
1998-12-18 20:03       ` Jeffrey A Law
1998-12-19  0:32   ` Craig Burley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).