Re: [PATCH] Fix ICE in strlen () > 0 folding (PR tree-optimization/89314)

2019-02-14 Thread Richard Biener
On Wed, Feb 13, 2019 at 12:14 AM Jakub Jelinek wrote: > > Hi! > > fold_binary_loc verifies that strlen argument is a pointer, but doesn't > verify what the pointee is. > The following patch just always converts it to the right pointer type > (const char *) and dereferences only that. > Another opt

[PATCH] Fix ICE in strlen () > 0 folding (PR tree-optimization/89314)

2019-02-12 Thread Jakub Jelinek
Hi! fold_binary_loc verifies that strlen argument is a pointer, but doesn't verify what the pointee is. The following patch just always converts it to the right pointer type (const char *) and dereferences only that. Another option would be punt if the pointee (TYPE_MAIN_VARIANT) is not char_type_