Martin Michlmayr <[EMAIL PROTECTED]> writes:

> I definitely see it on x86 too using the following testcase:

> 2292:[EMAIL PROTECTED]: ~/tmp/src] gcc-4.1 -c t.c
> t.c: In function ā€˜f’:
> t.c:9: error: assignment of read-only variable ā€˜__v’
> zsh: exit 1     gcc-4.1 -c t.c
> 2293:[EMAIL PROTECTED]: ~/tmp/src] cat t.c
> struct rx_length_info
> {
>   unsigned short tag;
> };
> void f(void)
> {
>   const struct rx_length_info *length_info;
>   __typeof__ (*(&length_info->tag)) __v;
>   __v = *(&length_info->tag);
> }
> 2294:[EMAIL PROTECTED]: ~/tmp/src] uname -a
> Linux deprecation 2.6.17-1-686 #1 SMP Fri Jun 23 17:38:22 UTC 2006 i686 
> GNU/Linux

There must be some sort of an optimizer difference between AMD64 and x86
that's causing this behavior to not show up on x86 for the particular file
in the remctl package, but still show up for other files.  I was able to
reproduce it on my AMD64 system without any difficulties.

I think the GCC behavior actually makes sense, and this macro needs to be
written a different way so that it can operate on const int values, but I
have no idea how one would go about doing that.  I'm releasing a new
version of remctl that just doesn't declare the struct const, which isn't
my favorite workaround but which seems cleaner than adding a bunch of
casts.  It should be uploaded to Debian later today.

Thank you very much for the report!

-- 
Russ Allbery ([EMAIL PROTECTED])               <http://www.eyrie.org/~eagle/>

Reply via email to