This is the mail archive of the mailing list for the GCC 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: Forced initializing scalars

>> 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?

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.



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