Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Matthew Fernandez via cfe-users
> On Oct 31, 2019, at 14:30, Hans Åberg via cfe-users > wrote: > >> >> On 31 Oct 2019, at 22:07, David Blaikie wrote: >> >>> On Thu, Oct 31, 2019 at 1:51 PM Hans Åberg wrote: >>> On 31 Oct 2019, at 21:40, David Blaikie wrote: Such that it's not practical for the compiler d

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
> On 30 Oct 2019, at 23:50, David Blaikie wrote: > >> On Wed, Oct 30, 2019 at 2:29 PM Hans Åberg wrote: >> Indeed, very hard to figure out. If it is some hidden undefined behavior >> causing it, the UBSan should have caught it, but it does not. >> > Right - but especially with numerics (espec

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
> On 31 Oct 2019, at 22:07, David Blaikie wrote: > >> On Thu, Oct 31, 2019 at 1:51 PM Hans Åberg wrote: >> >> > On 31 Oct 2019, at 21:40, David Blaikie wrote: >> > >> >> On Thu, Oct 31, 2019 at 12:00 PM Hans Åberg wrote: >> >> >> >> > On 31 Oct 2019, at 18:40, David Blaikie wrote: >> >> >

[cfe-users] clang-format single line if

2019-11-01 Thread Michael Pozulp via cfe-users
If I build clang-format from tip of master and run it using this .clang-format file AllowShortIfStatementsOnASingleLine: Always it will change this single line if statement if (x) { x++; } into this three line if statement if (x) { x++; } How do I keep it as one line? If I delete

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
Indeed, very hard to figure out. If it is some hidden undefined behavior causing it, the UBSan should have caught it, but it does not. The link that Matthew gave says that the GMP developers experienced a number of such issues with Clang. One can though turn off the optimizer, and the tests pass

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
> On 31 Oct 2019, at 01:53, David Blaikie wrote: > >> Yes, but assuming that the GMP adheres to the C standard, there should be no >> difference in the arithmetical values produced. > > Not necessarily - C (well, I don't know the C standard as well as I know the > C++ standard, admittedly) do

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
> On 31 Oct 2019, at 00:28, David Blaikie wrote: > > > > On Wed, Oct 30, 2019 at 4:25 PM Hans Åberg wrote: > >> I believe that GMP is just using integer types, and then uses that to make >> multiprecision integers, rational numbers, and floating point numbers. At >> least MPFR uses only t

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
> On 31 Oct 2019, at 18:40, David Blaikie wrote: > >> Right, but that is something one would avoid when computing arithmetical >> results. > > One would try to, yes - but that's sort of what the whole discussion is > resolving around: Is the code correct? I don't know. I wouldn't assume it is

Re: [cfe-users] Clang9 UBSan and GMP

2019-11-01 Thread Hans Åberg via cfe-users
> On 31 Oct 2019, at 21:40, David Blaikie wrote: > >> On Thu, Oct 31, 2019 at 12:00 PM Hans Åberg wrote: >> >> > On 31 Oct 2019, at 18:40, David Blaikie wrote: >> > >> >> Right, but that is something one would avoid when computing arithmetical >> >> results. >> > >> > One would try to, yes