This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: Fix powerpc64 g77




--On Thursday, August 01, 2002 08:08:25 PM +0200 Gabriel Dos Reis <gdr@integrable-solutions.net> wrote:

David Edelsohn <dje@watson.ibm.com> writes:

| 	The protected code is:
|
| #if HOST_BITS_PER_WIDE_INT == 32
| 	  ...
| #else
| 	  low |= high << 32;
| 	  low <<= POINTER_SIZE - GET_MODE_BITSIZE (mode);
| 	  high = (HOST_WIDE_INT) low >> 32;
| 	  low &= 0xffffffff;
| #endif
|
| If the conditional used if() instead of #if (so that GCC always parsed
| both branches) and HOST_BITS_PER_WIDE_INT == 32, one would received the
| following GCC warnings:
|
| warning: left shift count >= width of type
| warning: right shift count >= width of type

If that does happen, then it is a bug (in the compiler).
Why would that be a bug?

I think the real problem here is that we are doing different things
based on HOST_BITS_PER_WIDE_INT.  There should be integer-manipulation
routines that abstract away from these representation details so that
we do not need any kind of conditional.

Since there are not, I agree with David; better to use #if and avoid
the warnings.  Even as the original proponent of the runtime-if rule,
I think David makes a good case for an exception.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


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