Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-20 Thread Martin Sebor
On 07/20/2018 05:34 AM, Rainer Orth wrote: Hi Martin, On 07/19/2018 03:51 PM, Jeff Law wrote: On 07/13/2018 05:45 PM, Martin Sebor wrote: + offset_int ofr[] = { + wi::to_offset (fold_convert (ptrdiff_type_node, vr->min)), + wi::to_offset (fold_convert (ptrdiff_type_node,

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-20 Thread Rainer Orth
Hi Martin, > On 07/19/2018 03:51 PM, Jeff Law wrote: >> On 07/13/2018 05:45 PM, Martin Sebor wrote: + offset_int ofr[] = { + wi::to_offset (fold_convert (ptrdiff_type_node, vr->min)), + wi::to_offset (fold_convert (ptrdiff_type_node, vr->max)) + };

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-19 Thread Martin Sebor
On 07/19/2018 03:51 PM, Jeff Law wrote: On 07/13/2018 05:45 PM, Martin Sebor wrote: + offset_int ofr[] = { + wi::to_offset (fold_convert (ptrdiff_type_node, vr->min)), + wi::to_offset (fold_convert (ptrdiff_type_node, vr->max)) + }; huh. Do you maybe want to use

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-19 Thread Jeff Law
On 07/13/2018 05:45 PM, Martin Sebor wrote: >> >> +  offset_int ofr[] = { >> +   wi::to_offset (fold_convert (ptrdiff_type_node, vr->min)), >> +   wi::to_offset (fold_convert (ptrdiff_type_node, vr->max)) >> +  }; >> >> huh.  Do you maybe want to use widest_int for ofr[]?  What's

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-15 Thread Jeff Law
On 07/13/2018 05:09 PM, Martin Sebor wrote: >>> +  /* At level 2 check also intermediate offsets.  */ >>> +  int i = 0; >>> +  if (extrema[i] < -strbounds[1] >>> +  || extrema[i = 1] > strbounds[1] + eltsize) >>> +    { >>> +  HOST_WIDE_INT tmpidx = extrema[i].to_shwi () / eltsize.to_shwi

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-13 Thread Martin Sebor
On 05/02/2018 01:22 AM, Richard Biener wrote: On Fri, Jan 26, 2018 at 3:16 AM, Martin Sebor wrote: PR tree-optimization/83776 - [6/7/8 Regression] missing -Warray-bounds indexing past the end of a string literal, identified a not-so-recent improvement to constant propagation as the reason for

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-07-13 Thread Martin Sebor
+/* Checks one MEM_REF in REF, located at LOCATION, for out-of-bounds + references to string constants. If VRP can determine that the array + subscript is a constant, check if it is outside valid range. + If the array subscript is a RANGE, warn if it is non-overlapping + with valid

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-05-02 Thread Richard Biener
On Fri, Jan 26, 2018 at 3:16 AM, Martin Sebor wrote: > PR tree-optimization/83776 - [6/7/8 Regression] missing > -Warray-bounds indexing past the end of a string literal, > identified a not-so-recent improvement to constant propagation > as the reason for GCC no longer being

Re: [PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-04-30 Thread Jeff Law
On 01/25/2018 07:16 PM, Martin Sebor wrote: > PR tree-optimization/83776 - [6/7/8 Regression] missing > -Warray-bounds indexing past the end of a string literal, > identified a not-so-recent improvement to constant propagation > as the reason for GCC no longer being able to detect out-of- > bounds 

[PATCH] restore -Warray-bounds for string literals (PR 83776)

2018-01-25 Thread Martin Sebor
PR tree-optimization/83776 - [6/7/8 Regression] missing -Warray-bounds indexing past the end of a string literal, identified a not-so-recent improvement to constant propagation as the reason for GCC no longer being able to detect out-of- bounds accesses to string literals. The root cause is that