This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/7696: Spurious shift warning
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 6 Apr 2003 15:26:00 -0000
- Subject: Re: c/7696: Spurious shift warning
- Reply-to: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
The following reply was made to PR c/7696; it has been noted by GNATS.
From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
To: "Christian Ehrhardt" <ehrhardt at mathematik dot uni-ulm dot de>
Cc: gcc-gnats at gcc dot gnu dot org, schwab at suse dot de, gcc-bugs at gcc dot gnu dot org,
nobody at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org
Subject: Re: c/7696: Spurious shift warning
Date: 06 Apr 2003 16:50:37 +0200
"Christian Ehrhardt" <ehrhardt at mathematik dot uni-ulm dot de> writes:
> struct ia64_psr {
> unsigned long cpl : 2;
> } x = {1};
>
> unsigned long y = ((unsigned long) x.cpl) << 40;
>
> According to gdb the cast is thrown away early (build_binary_op
> doesn't see it at all), probably because the bitfield is of type
> unsigned long.
All casts of bit-fields to the same type get discarded. This is a very
long standing bug and has already been reported as c/3325, c/3326,
c/6346, c/6515 and target/9620. We also have xfailing
gcc.c-torture/execute/bitfld-1.c for it.
--
Falk