[PATCH] Make out of range type conversions explicit

Gary Benson gbenson@redhat.com
Fri Jul 3 13:09:45 GMT 2020


Pedro Alves wrote:
> On 7/3/20 10:30 AM, Gary Benson wrote:
> > Pedro Alves wrote:
> > > diff --git a/gdb/testsuite/gdb.base/structs2.c b/gdb/testsuite/gdb.base/structs2.c
> > > index 7c8be035221..aac7bce8c15 100644
> > > --- a/gdb/testsuite/gdb.base/structs2.c
> > > +++ b/gdb/testsuite/gdb.base/structs2.c
> > > @@ -13,7 +13,7 @@ main ()
> > >  
> > >    bkpt = 0;
> > >    param_reg (120, 130, 32000, 33000);
> > > -  param_reg (130, 120, 33000, 32000);
> > > +  param_reg (-120, 130, -32000, 33000);
> > >  
> > >    return 0;
> > >  }
> > 
> > On first glance I thought this was a copy-paste error.  I don't
> > think it is, but, just in case, can you confirm the change above
> > is what you intended?
> 
> What do you mean by "this"?  If you mean, the proposed change
> instead of:
> 
>     param_reg (120, 130, 32000, 33000);
>  -  param_reg (130, 120, 33000, 32000);
>  +  param_reg (-130, 120, -33000, 32000);
> 
> It's just that -130 and -33000 overflows, so I swapped the
> numbers back.

Cool, thank you.

Cheers,
Gary

-- 
Gary Benson - he / him / his
Principal Software Engineer, Red Hat



More information about the Gdb-patches mailing list