public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Chris Lattner <sabre@nondot.org>
To: Nathan Sidwell <nathan@codesourcery.com>
Cc: Joe Buck <jbuck@synopsys.com>, <gcc@gcc.gnu.org>,
	<gcc-patches@gcc.gnu.org>
Subject: Re: Forced initializing scalars
Date: Fri, 14 Feb 2003 18:56:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.44.0302141232040.21596-100000@nondot.org> (raw)


>> For floating point, a signaling NaN can be used.  For integers,
>> 0xdeadbeef or some such.
>> [ cases where gcc can't figure out that a variable is uninitialized ]
>>>> Despite the small cost, this could be a real help to some people...
>> It should be possible to turn the feature off.
>turned on at -O0, off at other levels?
>nathan

That would make sense to me.  Actually, it seems like two different
flavors of this option could be useful:

* At -O0, initialize stuff to SNaNs, deadbeef, or any other value that
  is likely to trip people up.  Arrays are probably best left
  uninitialized.  We could even go so far as to transform a call to malloc
  into a call to malloc and memset of some non-zero value... there are a
  lot of permutations to this which could be useful...
* When optimizing, have a (defaulting to off) -fzero-initialize-scalars
  option, which could be used for people whose code stops working the same
  when optimization is turned on.

The former would be great for people developing with GCC, the later would
be useful for people who (for some reason) don't want to debug their code,
and it breaks under optimization.

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/

                 reply	other threads:[~2003-02-14 18:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0302141232040.21596-100000@nondot.org \
    --to=sabre@nondot.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jbuck@synopsys.com \
    --cc=nathan@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).