Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-30 Thread Pip Cet
On Sat, Jun 29, 2019 at 10:31 AM Bruno Haible wrote: > Pip Cet wrote: > > I would like to state that the current assume does > > behave very badly when combined with -fno-inline-small-functions > > -fno-inline. > > Since we can't address this limitation t

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-30 Thread Pip Cet
On Sat, Jun 29, 2019 at 5:31 PM Paul Eggert wrote: > >> This is not a valid use of 'assume'. It's documented that assume's argument > >> should be free of side effects. > > > > But the compiler makes no such assumption > > Sure, but if the caller uses 'assume' contrary to its documentation,

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-29 Thread Pip Cet
On Sat, Jun 29, 2019 at 5:41 AM Paul Eggert wrote: > Pip Cet wrote: > >eassume (global == 0); > >eassume (f ()); > > #else > >eassume (global == 0 && f ()); > > ... > > extern int global; > > > > int f(void) > > { >

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-28 Thread Pip Cet
On Fri, Jun 28, 2019 at 11:30 PM Bruno Haible wrote: > Pip Cet wrote: > > have started believing the "an inline function is as fast as a macro" > > mantra*, assuming you include inline functions with "function calls". > > Ah, that's where the entire to

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-28 Thread Pip Cet
> OptionsResult > none increment > -DASSUME_GNULIBincrement > -DTWO_ASSUMES single-store > -DASSUME_GNULIB -DTWO_ASSUMES increment Thanks, I should have included that. However, please note that in the

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-28 Thread Pip Cet
On Fri, Jun 28, 2019 at 7:11 PM Bruno Haible wrote: > Pip Cet wrote: > > Sorry, can't reproduce that here. I'm sure the changes I need to make > > are obvious once I've found them, but can you let me know your gcc > > version? > > I reproduce this with GCC versions

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-28 Thread Pip Cet
On Fri, Jun 28, 2019 at 5:46 PM Paul Eggert wrote: > Pip Cet wrote: > > It's way too easy > > to do something like > > > > eassume(ptr->field >= 0 && f(ptr)); > > > > when what you mean is > > > > eassume(ptr->field >= 0); &g

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-28 Thread Pip Cet
On Fri, Jun 28, 2019 at 12:14 PM Bruno Haible wrote: > Pip Cet wrote: > > This makes it safe to use function expressions in eassume, whether the > > function is inlined or not. > > By "safe" you mean that you want the function call to not be evaluated. Sorry, slo

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-28 Thread Pip Cet
On Thu, Jun 27, 2019 at 11:45 PM Bruno Haible wrote: > Can you please show an example code on which the change makes a difference? int main(void) { eassume (printf("hi\n")); return 0; } Or, more realistically: extern int potentially_inlined_function(int i); int main(void) { ...

Re: bug#36370: 27.0.50; XFIXNAT called on negative numbers

2019-06-27 Thread Pip Cet
On Thu, Jun 27, 2019 at 9:13 PM Paul Eggert wrote: > On 6/27/19 12:56 PM, Pip Cet wrote: > > The eassume tells GCC i is nonnegative, since (!(i >= 0) == !(i >= 0)) > > is indeed a constant. > > Ah! Thanks, I didn't catch that subtle point. Would the attached