On Tue, 2005-08-23 at 07:44, Bernd Schmidt wrote: > Jim Wilson once suggested we should just emit insns to make sure every > register is initialized and be done with it - problem solved. I had > started to work on that, if people think it's a good idea I can dig that > stuff out again.
I'd like this because of an IA-64 specific problem. IA-64 has Not-a-Thing (NaT) bits, which are used for speculation. If a speculative load fails, the NaT bit is set, which indicates that we must refetch the value before using it. NaT bits propagate through most operations, allowing us to speculate a series of instructions instead of just loads. However, they will generate an illegal instruction exception if used in an operation with side-effects, like a store. So the problem here is that any use of an uninitialized register may generate an exception, if the instruction has side-effects, and the uninitialized register just happens to have the NaT bit set. Mostly we get by because gcc doesn't have speculation support yet, but it is only a matter of time before someone writes it. Meanwhile, there are some hand-written glibc routines that do use speculation, and could potentially trigger this problem. This is a disaster waiting to happen for anyone using gcc on IA-64 machines. I created PR 21111 for this problem, and it contains an artificial testcase that demonstrates the problem using bitfield assignments. -- Jim Wilson, GNU Tools Support, http://www.specifix.com