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 topic with the function calls inside assume() >

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

2019-06-28 Thread Paul Eggert
Pip Cet wrote: eassume (global == 0); eassume (f ()); #else eassume (global == 0 && f ()); ... extern int global; int f(void) { return ++global; } This is not a valid use of 'assume'. It's documented that assume's argument should be free of side effects. It would be nice if

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

2019-06-28 Thread Paul Eggert
Bruno Haible wrote: I think we should change the documentation of 'assume' to say that when it invokes functions, these functions should be marked '__attribute__ ((__always_inline__))', otherwise performance will be worse than without the 'assume', not better. I suggest something simpler and a

Re: bug#36342: accept4 detection on illumos needs -lsocket -lnsl

2019-06-28 Thread Bruno Haible
Hi Michal and Mark, > > GNU Guile 2.2.5 build fails because accept4 detection on OpenIndiana > > 2019.04 (illumos distribution) [1] fails due to "-lsocket -lnsl" not > > being part of the linking process and the build system then tries to > > build it's vendored accept4: > > I believe this is an

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

2019-06-28 Thread Bruno Haible
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 topic with the function calls inside assume() comes from! I agree it's an important case (more important than

Re: [PATCH 1/2] copy-file-range: new module

2019-06-28 Thread Bruno Haible
Florian Weimer wrote: > > In the NEWS entry, Florian writes: > > > >Applications which use the > >copy_file_range function will have to be run on kernels which implement > >the copy_file_range system call. > > > > I find this misleading. Coreutils will want to continue to use > >

Re: bug#36342: accept4 detection on illumos needs -lsocket -lnsl

2019-06-28 Thread Mark H Weaver
Hi Michal, Michal Nowak writes: > GNU Guile 2.2.5 build fails because accept4 detection on OpenIndiana > 2019.04 (illumos distribution) [1] fails due to "-lsocket -lnsl" not > being part of the linking process and the build system then tries to > build it's vendored accept4: I believe this is

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 5.4.0, 6.5.0, 7.4.0, 8.3.0, and

Re: [PATCH 1/2] copy-file-range: new module

2019-06-28 Thread Florian Weimer
* Bruno Haible: > Pádraig Brady wrote: >> https://sourceware.org/ml/libc-alpha/2019-06/msg00873.html > > In the NEWS entry, Florian writes: > >Applications which use the >copy_file_range function will have to be run on kernels which implement >the copy_file_range system call. > > I

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

2019-06-28 Thread Bruno Haible
On Freitag, 28. Juni 2019 19:15:06 CEST Pip Cet wrote: > 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);

Re: [PATCH 1/2] copy-file-range: new module

2019-06-28 Thread Bruno Haible
Pádraig Brady wrote: > https://sourceware.org/ml/libc-alpha/2019-06/msg00873.html In the NEWS entry, Florian writes: Applications which use the copy_file_range function will have to be run on kernels which implement the copy_file_range system call. I find this misleading. Coreutils

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); > > eassume(f(ptr)); > > These mean the same thing. I'm really convinced

Re: [PATCH 1/2] copy-file-range: new module

2019-06-28 Thread Pádraig Brady
On 07/06/19 09:04, Paul Eggert wrote: > Although I agree with both of Bruno's reasons, on further thought it makes > sense > for Gnulib to provide a stub instead of an emulation for this particular > function. > > The primary use for copy_file_range is to copy files more efficiently than a >

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

2019-06-28 Thread Bruno Haible
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 5.4.0, 6.5.0, 7.4.0, 8.3.0, and 9.1.0. 1. Take the files foo.c and bar.c from

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

2019-06-28 Thread Paul Eggert
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); eassume(f(ptr)); These mean the same thing. Both tell the compiler that a certain condition (A && B) is known to be true, and that behavior is undefined

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, sloppy wording there. You're right.

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-28 Thread Bruno Haible
Pip Cet wrote: > Or, more realistically: > > extern int potentially_inlined_function(int i); > > int main(void) > { > ... > eassume(potentially_inlined_function(i)); > return i >= 0; > } OK, I see... > This makes it safe to use function expressions in eassume, whether the > function is

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

2019-06-28 Thread Bruno Haible
Oops, the test case that I meant to show is this one: foo.c = #include #define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) //#define assume(R) (!__builtin_constant_p (!(R) == !(R)) || (R) ? (void) 0 :