Re: bug#22357: grep -f not only huge memory usage, but also huge time cost

2016-12-14 Thread Paul Eggert
On 12/12/2016 03:49 AM, Bruno Haible wrote: Part of the problem appears to be that position-set merging, even with his latest proposed changes, is O(N**2) where N is the pattern size I'm confused. Which code are you talking about? I was referring to code with his proposed patch installed

Re: checked integer arithmetic

2016-12-14 Thread Bruno Haible
Paul Eggert wrote: > Come to think of it, I suppose we should change xalloc_oversized to > report an overflow if the resulting size would be greater than > PTRDIFF_MAX. That should catch more potential problems in Gnulib and in > Gnulib-using code. > ... > Here is an example of why arrays larger

xalloc-oversized PTRDIFF_MAX fix (was: checked integer arithmetic)

2016-12-14 Thread Paul Eggert
On 12/14/2016 04:26 PM, Paul Eggert wrote: I suppose we should change xalloc_oversized to report an overflow if the resulting size would be greater than PTRDIFF_MAX. That should catch more potential problems in Gnulib and in Gnulib-using code. Attached is a proposed patch to do that. From 2d

Re: checked integer arithmetic

2016-12-14 Thread Paul Eggert
On 12/14/2016 02:56 PM, Bruno Haible wrote: Are you saying that -fsanitize=undefined or -fsanitize=signed-integer-overflow (or -ftrapv, when using an older GCC) can detect integer overflow for signed integers, whereas no such option exists and won't exist for unsigned integers (because there are

Re: FYI: dfa: add an assertion to avoid coverity false positive

2016-12-14 Thread Paul Eggert
I somehow managed to install the wrong version. Sorry about that. Should be fixed by the attached. From 9c5c43cdd808a6f0e9cccf8b8ae8a73ea3526bc3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 14 Dec 2016 15:11:28 -0800 Subject: [PATCH] dfa: fix glitches in previous commit Sorry, I don't k

Re: checked integer arithmetic

2016-12-14 Thread Eric Blake
On 12/14/2016 04:56 PM, Bruno Haible wrote: > Hi Paul, > > Possibly dumb questions, but: >> over time I am >> becoming more inclined to like the Emacs model, where object counts are >> typically kept as nonnegative but signed integers. This approach makes C >> code a bit more reliable, as compi

Re: checked integer arithmetic

2016-12-14 Thread Bruno Haible
Hi Paul, Possibly dumb questions, but: > over time I am > becoming more inclined to like the Emacs model, where object counts are > typically kept as nonnegative but signed integers. This approach makes C > code a bit more reliable, as compiling with -fsanitize=undefined is more > likely to ca

Re: FYI: dfa: add an assertion to avoid coverity false positive

2016-12-14 Thread Paul Eggert
On 12/13/2016 10:49 PM, Jim Meyering wrote: It took me a few minutes to convince myself that a coverity warning was unwarranted, so I've added an assert that should suppress it. I looked at it for a bit and found a way to justify some sort of warning in that area, although the failure is extre