Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-07-05 Thread Richard Biener
On July 4, 2014 10:50:01 PM CEST, Jakub Jelinek ja...@redhat.com wrote: On Mon, Jun 23, 2014 at 04:40:43PM +0200, Richard Biener wrote: Can we instead refactor expmed.c to avoid allocating rtx_def directly? Like by using rtx in init_expmed_rtl and allocating from an obstack (or not care and

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-07-04 Thread Jakub Jelinek
On Mon, Jun 23, 2014 at 04:40:43PM +0200, Richard Biener wrote: Can we instead refactor expmed.c to avoid allocating rtx_def directly? Like by using rtx in init_expmed_rtl and allocating from an obstack (or not care and GC-allocate anyway). So like this? Bootstrapped/regtested on x86_64-linux

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-23 Thread Richard Henderson
On 06/20/2014 01:42 PM, Marek Polacek wrote: 2014-06-20 Marek Polacek pola...@redhat.com * genpreds.c (verify_rtx_codes): New function. (main): Call it. * rtl.h (RTX_FLD_WIDTH, RTX_HWINT_WIDTH): Define. (struct rtx_def): Use them. Looks pretty good. Just a few

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-23 Thread Richard Biener
On Mon, Jun 23, 2014 at 4:25 PM, Richard Henderson r...@redhat.com wrote: On 06/20/2014 01:42 PM, Marek Polacek wrote: 2014-06-20 Marek Polacek pola...@redhat.com * genpreds.c (verify_rtx_codes): New function. (main): Call it. * rtl.h (RTX_FLD_WIDTH, RTX_HWINT_WIDTH):

[PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-20 Thread Marek Polacek
When implementing -fsanitize=bounds I noticed a whole slew of errors about accessing u.fld[] field in rtx_def. Turned out this is indeed a bug, the array should have a size of 8; u.hwint[] array had similar issue. Thus fixed, plus I added some verification code to genpreds.c (can't do it in

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-20 Thread Jakub Jelinek
On Fri, Jun 20, 2014 at 07:36:41PM +0200, Marek Polacek wrote: 2014-06-20 Marek Polacek pola...@redhat.com * genpreds.c (verify_rtx_codes): New function. (main): Call it. * rtl.h (RTX_FLD_WIDTH, RTX_HWINT_WIDTH): Define. (struct rtx_def): Use them. Note, e.g.

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-20 Thread Jeff Law
On 06/20/14 13:01, Jakub Jelinek wrote: On Fri, Jun 20, 2014 at 07:36:41PM +0200, Marek Polacek wrote: 2014-06-20 Marek Polacek pola...@redhat.com * genpreds.c (verify_rtx_codes): New function. (main): Call it. * rtl.h (RTX_FLD_WIDTH, RTX_HWINT_WIDTH): Define.

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-20 Thread Marek Polacek
On Fri, Jun 20, 2014 at 09:01:14PM +0200, Jakub Jelinek wrote: On Fri, Jun 20, 2014 at 07:36:41PM +0200, Marek Polacek wrote: 2014-06-20 Marek Polacek pola...@redhat.com * genpreds.c (verify_rtx_codes): New function. (main): Call it. * rtl.h (RTX_FLD_WIDTH,

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-20 Thread Jakub Jelinek
On Fri, Jun 20, 2014 at 01:55:41PM -0600, Jeff Law wrote: like spot. Most RTLs are allocated through rtx_alloc and the size is determined from RTX_HDR_SIZE (i.e. offsetof) and/or RTX_CODE_SIZE, so your rtl.h change IMHO shouldn't affect anything but make the expmed.c init_expmed_rtl structure

Re: [PATCH] Fix arrays in rtx.u + add minor rtx verification

2014-06-20 Thread Marek Polacek
On Fri, Jun 20, 2014 at 11:10:18PM +0200, Jakub Jelinek wrote: On Fri, Jun 20, 2014 at 01:55:41PM -0600, Jeff Law wrote: like spot. Most RTLs are allocated through rtx_alloc and the size is determined from RTX_HDR_SIZE (i.e. offsetof) and/or RTX_CODE_SIZE, so your rtl.h change IMHO