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 to stop GCC from shifting by a negative number


Steve Ellcey <sje@cup.hp.com> writes:

> > +  /* You want to truncate to a _what_?  */
> > +  if (GET_MODE_CLASS (mode) != MODE_INT
> > +      && GET_MODE_CLASS (mode) != MODE_PARTIAL_INT)
> > +    abort ();
> > +
> 
> I ran the test suite with your patch and hit this abort a couple of
> times on the PA64 HP-UX platform with tests
> gcc.c-torture/execute/20020227-1.c and gcc.c-torture/compile/simd-1.c
> using -O2 optmization.
> 
> In 20020227-1.c I enter simplify_binary_operation
> with
> 
> code=LSHIFTRT
> mode=SCmode
> op0=(const_int -1 [0xffffffffffffffff])
> op1=(const_int 32 [0x20])
> 
> In simd-1.c I enter simplify_binary_operation
> with
> 
> code=ASHIFT
> mode=V2SImode
> op0=(const_int 4294967295 [0xffffffff])
> op1=(const_int 32 [0x20])
> 
> and in both cases I call trunc_int_for_mode right at the end of
> simplify_binary_operation with a mode of either SCmode or V2SImode which
> then causes the abort to be hit.
> 
> Any ideas on what a good fix for these cases would be?

I think the bug must be before this (that is,
simplify_binary_operation shouldn't be called this way) because a
right-shift of a complex number is nonsense.  From context, I think it
should be called with DImode.  I bet this is coming from
simplify_subreg or similar and someone used the wrong mode variable.

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>


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