On Fri, 27 Dec 2002 00:02:28 +0300, Dmitry Bely said:
"Stephen J. Turnbull" <stephen(a)xemacs.org> writes:
> Dmitry> Well, looking into the C99 I don't see why the union
> Dmitry> assignment could be a problem. Can you or Ben cite the gcc
> Dmitry> developers reply, explaining why it is dangerous and not
> Dmitry> conforming to the C standard?
>
> Ah, we agree then. The standard _seems_ to allow our usage, but it
> doesn't, and nobody (except a language lawyer trying to cover the
> vendor's ass) can explain why. I say, this is bogus.
Are you absolutely sure that the bug is caused by improper union assignment
implementation by compiler vendors, not something else?
At the risk of being pedantic, the question *should* be "are you absolutely
sure that the bug is caused by a union assignment implementation that
doesn't match our expectations?". I'm at least provisionally assuming that
we're in one of those fuzzy areas where both the gcc compiler and xemacs
code are technically in compliance...
Agree completely. The problem is that we only have Ben's
conclusion
(theoretically he can be mistaken, right?) and cannot verify it ourselves
until more info is supplied.
Amen to that. Of course, language lawyers have been around at least since
before Tom Duff created the Duff Device, so we're following in a time-honored
tradition. On the other hand, over the years, I've been at both ends of
the war - I've tripped over real compiler/optimizer bugs in multiple vendor's
language suites, and I've had optimizers reveal subtle user-program bugs.
I wonder if simply re-arranging the order of the fields in the union would
suffice to work around the bug (as he ducks for cover ;)
--
Valdis Kletnieks
Computer Systems Senior Engineer
Virginia Tech