Re: Current int & float overflow checking is slow.

Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>

From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker )
To: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, "pgsql-hackers\@postgresql.org" <pgsql-hackers@postgresql.org>, Greg Stark <stark@mit.edu>
Date: 2017-10-30T18:12:58Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:

>> 0003) Removes -fwrapv. I'm *NOT* suggesting we apply this right now, but
>>       it seems like an important test for the new facilities. Without
>>       0002, tests would fail after this, after it all tests run
>>       successfully.
>
> I suggest that if we think we don't need -fwrapv any more, we ought to
> remove it.  Otherwise, we won't find out if we're wrong.

Without -fwrapv signed overflow is undefined behaviour.  We should test
thoroughly with -ftrapv or -fsanitize=signed-integer-overflow to be
confident the code is free of such things.  We might even want to enable
-ftrapv by default in cassert-enabled builds.

- ilmari
-- 
"I use RMS as a guide in the same way that a boat captain would use
 a lighthouse.  It's good to know where it is, but you generally
 don't want to find yourself in the same spot." - Tollef Fog Heen


Commits

  1. Provide overflow safe integer math inline functions.

  2. Use new overflow aware integer operations.