Michael McConville wrote: > This isn't a grave issue, but I came across it while exploring integer > overflow and think it's worth sharing. > > grep represents line numbers with an int, which predictably overflows > for inputs with >= 2^31 newlines. This is easy to demonstrate using the > -n option and a debugging printf. > > The below diff fixes this, and tunes up a for loop while I'm in there. > > ok?
I may also have found a gcc bug in the process. When I build with: > env CC=clang CFLAGS=' -fwrapv ' make it aborts on overflow, as expected. However, > env CFLAGS=' -fwrapv ' make overflows withough complaint. Am I missing something?
