This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR 15069: types.signed_type lang hook misunderstanding
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Apr 2004 20:27:08 -0700
- Subject: Re: [PATCH] PR 15069: types.signed_type lang hook misunderstanding
- References: <Pine.LNX.4.44.0404240937530.10159-100000@www.eyesopen.com>
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~