[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#79225: further information needed for your Debian report #79225



Matthias Klose wrote:
Martin, is there anything we can do without further information?

There is clearly a bug in the compiler: the compiler should have rejected the code in the first place. In

http://gcc.gnu.org/ml/gcc/2002-08/msg00401.html

a patch for this bug is mentioned, but I don't know if anything ever came out of this.

The reason this is a bug in the compiler is that (void*)x is an rvalue, and you can't take the address of an rvalue.

The reason that this leads to wrong code, depending on precise situation and optimization is that the compiler sometimes produces a temporary to store the result of the cast, and then uses the address of that temporary. For the specific code in question, this is fatal, since the caller expects that the variable changes, not a temporary.

There is a related GNU C extension (documented in (gcc)Lvalues), where a cast is an lvalue in gcc, however, this extension explicitly rules out taking the address of a cast.

Regards,
Martin




Reply to: