This is the mail archive of the
mailing list for the GCC project.
Re: [SPARC] Fix PR target/60941
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 26 Apr 2014 17:02:18 +0200
- Subject: Re: [SPARC] Fix PR target/60941
- Authentication-results: sourceware.org; auth=none
- References: <3316944 dot sc4MgGFZdG at polaris> <1723181 dot Y3gD841okm at polaris> <20140425112922 dot GO1817 at tucnak dot redhat dot com> <5910732 dot kQfqzErysb at polaris>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sat, Apr 26, 2014 at 03:30:25PM +0200, Eric Botcazou wrote:
> > > Not clear to me, (2U << i) should be zero if the shift count is masked.
> > 2U << 31 is undefined behavior on those targets.
> Precisely not, or else we are not talking about the same notion of masking.
Eh, C99, 6.5.7/3:
"If the value of the right operand is negative or is
greater than or equal to the width of the promoted left operand, the
behavior is undefined."
So, if you have int16 target, where unsigned int is 16-bit and UINT_MAX 65535,
then shift count must be >= 0 and < 16, therefore, 2U << 31 is undefined