Re: [PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-20 Thread Jakub Jelinek
On Fri, Sep 20, 2013 at 02:33:25PM +0200, Marek Polacek wrote: > Agreed. Added that assert in there. How does it look now? Ok. > 2013-09-20 Marek Polacek > > PR sanitizer/58413 > * ubsan.c (get_ubsan_type_info_for_type): Use TYPE_SIZE instead of > TYPE_PRECISION. Add asse

Re: [PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-20 Thread Marek Polacek
On Fri, Sep 20, 2013 at 10:37:57AM +0200, Jakub Jelinek wrote: > On Fri, Sep 20, 2013 at 10:22:43AM +0200, Marek Polacek wrote: > > > --- gcc/ubsan.c.mp2013-09-16 18:13:01.075903156 +0200 > > > +++ gcc/ubsan.c 2013-09-16 18:13:20.514974154 +0200 > > > @@ -233,7 +233,13 @@ ubsan_source_loc

Re: [PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-20 Thread Jakub Jelinek
On Fri, Sep 20, 2013 at 10:22:43AM +0200, Marek Polacek wrote: > > --- gcc/ubsan.c.mp 2013-09-16 18:13:01.075903156 +0200 > > +++ gcc/ubsan.c 2013-09-16 18:13:20.514974154 +0200 > > @@ -233,7 +233,13 @@ ubsan_source_location (location_t loc) > > static unsigned short > > get_ubsan_type_info_

Re: [PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-20 Thread Marek Polacek
On Mon, Sep 16, 2013 at 06:18:11PM +0200, Marek Polacek wrote: > On Mon, Sep 16, 2013 at 06:04:23PM +0200, Jakub Jelinek wrote: > > On Mon, Sep 16, 2013 at 05:59:28PM +0200, Marek Polacek wrote: > > > Regtested/ran bootstrap-ubsan on x86_64-linux. > > > > That looks wrong. ubsan_type_descriptor s

Re: [PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-16 Thread Marek Polacek
On Mon, Sep 16, 2013 at 06:04:23PM +0200, Jakub Jelinek wrote: > On Mon, Sep 16, 2013 at 05:59:28PM +0200, Marek Polacek wrote: > > Regtested/ran bootstrap-ubsan on x86_64-linux. > > That looks wrong. ubsan_type_descriptor shouldn't change TYPE_PRECISION of > the type it has been called with, whe

[PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-16 Thread Marek Polacek
This patch ought to fix the unexpected size of type 'long long unsigned int:40' issue in PR58413. Since libubsan will fail when the precision of a type is not 32/64/128, we can't pass the width of a bitfield, instead we should pass the TYPE_SIZE of the base type, I guess. What is not very nice is

Re: [PATCH] Handle bit-fields in ubsan.c (PR sanitizer/58413)

2013-09-16 Thread Jakub Jelinek
On Mon, Sep 16, 2013 at 05:59:28PM +0200, Marek Polacek wrote: > Regtested/ran bootstrap-ubsan on x86_64-linux. That looks wrong. ubsan_type_descriptor shouldn't change TYPE_PRECISION of the type it has been called with, whether type is a bitfield or not can change what typedescriptor is generate