This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug fix for c-torture test execute/bf-sign-2.c



  In message <199710221507.QAA18257@phal.cygnus.co.uk>you write:
  > > I don't remember this failing for the mn10200, which is a 16bit int
  > > target.  Maybe you should describe why it's failing on yours so that
  > > we can understand your patch.
  > 
  > The 31 bit unsigned bitfield is promoted to unsigned long int, not
  > signed long int.  Hence the check fails.  I found this for the d10v
  > port (which also supports 64 bit long long), and then checked the h8300:
  > it does the promotion the same way (but it doesn't show for a torture
  > test because the h8300 has only 32 bit long long, hence the test is skipped).
Seems to me that the bug is in the compiler, not the test.

Yes, ANSI doesn't mandate we handle this case since ANSI doesn't handle a
bitfied > sizeof (int), but we want to do the "expected thing" if possible.

So, it would seem to me, that for a 16bit int/32bit long target that a
31bit unsigned long field should promote to a "signed long" type.

jeff

ps.  Except for the d10v, I don't think we have a 16bit int machine that
has 64bit long longs.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]