Re: [RFC] overflow checks optimized away - Mailing list pgsql-hackers

From Greg Stark
Subject Re: [RFC] overflow checks optimized away
Date
Msg-id CAM-w4HNvwguCS9DxuS4eA+UEZoxHYb2nODXKmkNhNrm-sasANw@mail.gmail.com
Whole thread Raw
In response to Re: [RFC] overflow checks optimized away  (Greg Stark <stark@mit.edu>)
Responses Re: [RFC] overflow checks optimized away  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [RFC] overflow checks optimized away  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Tue, Dec 1, 2015 at 5:17 PM, Greg Stark <stark@mit.edu> wrote:
> Sorry, I didn't look at it since. At the time I was using Xi Wang's software
> to find the overflow checks that need to be redone. He published a paper on
> it and it's actually pretty impressive. It constructs a constraint problem
> and then throws a kSAT solver at it to find out if there's any code that a
> compiler could optimize away regardless of whether any existant compiler is
> actually capable of detecting the case and optimizing it away.
> https://pdos.csail.mit.edu/papers/stack:sosp13.pdf

I did get this code running again (it was quite a hassle actually).
Attached is the report.

I'm leaning towards using the builtin functions described here

http://clang.llvm.org/docs/LanguageExtensions.html#checked-arithmetic-builtins
https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html

They aren't in older GCC and clang and probably won't be in icc and
the like but we could probably implement replacements. The downside is
that then we wouldn't be able to use the generic one and would have to
use the type-specific ones which would be annoying. The Linux kernel
folk wrote wrappers that don't have that problem but they depend on
type_min() and type_max() which I've never heard of and have no idea
what support they have?

What version of GCC and other compilers did we decide we're targeting now?



--
greg

Attachment

pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: Passing initially_valid values instead of !skip_validation to StoreRelCheck() in AddRelationNewConstraints()
Next
From: Simon Riggs
Date:
Subject: Re: Logical replication and multimaster