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: [PATCH] PR 15069: types.signed_type lang hook misunderstanding


On Sat, Apr 24, 2004 at 10:06:03AM -0600, Roger Sayle wrote:
> The issue is that in the PR the type of A is an enumeration type,
> represented by a three-bit wide unsigned integer.  Fold then calls
> lang_hooks.types.signed_type on this type expecting to get a three-bit
> wide signed type.  Unfortunately, the C++ front-end actually returns
> a signed char.  This miscommunication means that the tree "(signed)A"
> doesn't actually preserve the sign-bit, as the unsigned enumerated type
> is zero-extended to fill the signed char.  Doh!

This, IMO, is the bug.  The C++ front end should either 

  (1) Return a signed integer/enum type with the same precision
or
  (2) Return NULL.

If you put this check where you do, that suddenly means every 
other use of lang_hooks.types.signed_type is likely also wrong.



r~


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