This is the mail archive of the
mailing list for the GCC project.
Re: An alias bug
- To: law at cygnus dot com
- Subject: Re: An alias bug
- From: hjl at lucon dot org (H.J. Lu)
- Date: Sun, 12 Jul 1998 23:10:51 -0700 (PDT)
- Cc: davem at dm dot cobaltmicro dot com, egcs-bugs at cygnus dot com, mark at markmitchell dot com
> In message <199807120617.XAA31802@dm.cobaltmicro.com>you write:
> > I see this come up now and again, so I'm finally going to ask.
> > How do we tell users they can take one type, and look at "pieces" of
> > it, when they use gcc? Or are you saying that we declare "long long"
> > as a special case in this regard?
> Put them in a union and extract elements from the union.
> Or use memcpy to extract the bits from one thing and put them in another
> of a different type.
> Or claim one of the things is volatile.
> HJ's testcase basically as a useless cast to try and trip the "bug".
> you can remove the whole ((long_long_type *)&u)->l and replace it
> with just (u & 0xffffffff). Actually HJ's testcase could just as
> easily fail with gcc-2.7 since the "bug" it's trying to trigger exists
> there too.
That is not true. My testcase works with egcs 1.0.3 and gcc 220.127.116.11.
Mark suggested another patch which fixes it.