[PATCH] Fix PR libstdc++/19510: Uninitialized variable in some iterators
Volker Reichelt
reichelt@igpm.rwth-aachen.de
Thu Jan 20 19:04:00 GMT 2005
Martin Sebor pointed to
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#408
where we have:
Issue 235, which defines reverse_iterator's default constructor more
precisely, has some relevance to this issue. However, it is not the
whole story.
The issue was whether
reverse_iterator() { }
is allowed, vs.
reverse_iterator() : current() { }
The difference is when T is char*, where the first leaves the member
uninitialized, and possibly equal to an existing pointer value, or
(on some targets) may result in a hardware trap when copied.
Or for short: Copying uninitialized pointers may result in a hardware trap.
This means we really should do the initialization in 3.4, not only for the
sake of easier debugging.
OK if I prepare a patch for 3.3, too?
Regards,
Volker
More information about the Libstdc++
mailing list