------- Comment #33 from acahalan at gmail dot com 2006-09-26 04:44 ------- (In reply to comment #28) > If you exclude strict type-based rules, the answer to "what can foo > clobber" in the example is the same as asking "what can the first > argument of foo access in foo and its callees". Because of the > type-based rules, we end up with a disconnect. It would be undefined > to dereference the first argument of foo without casting it first. In > effect, the strict-type rules allow you can take an unaliased pointer > in a caller, and validly turn it back into an aliased pointer in the > callee.
Although it wouldn't work for the example code, extending the aliasing behavior of (char*) to (void*) would fix the problem for LOTS of code out in the wild. People normally use a (void*) when they want a generic pointer type to play casting games with. This is a case where the C standard is very far from the reality of how people write code. The example code is fairly unusual. -- acahalan at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acahalan at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28778