Hi Bob, On Mon, Jun 10, 2019 at 09:54:29PM +0000, Zakharychev, Bob wrote: > FWIW: after a bit of experimentation and a quick dumb behavior comparison > program I found that FD_SET is compiled incorrectly by GCC 8.3.0 under Cygwin > with optimization level of -O2 and up. I compared native FD_SET/FD_ISSET with > hap_fd_set/hap_fd_isset and while the latter always functions correctly, the > former broke with -O2 and beyond. Further playing with optimizations enabled > by -O2 I was able to narrow the offender down to -ftree-pre, which enables > partial redundancy elimination (PRE) on trees. When tree PRE is enabled, GCC > generates wrong code for inlined FD_SET in map initialization loop which > results in most, and eventually all, bits of the map set when they shouldn't, > which explains those superfluous escapes that caused reg-tests failures. When > compiled with -fno-tree-pre, most reg-tests now pass. Still, since there is > already native implementation of bit address lookup and it seems to work > correctly with all optimizations enabled, maybe it's better just to switch to > it.
Very interesting analysis, thank you for sharing it. In the mean time, as I mentioned in the ticket, I got rid of FD_SET/FD_ISSET(). The relevant commit is : commit 1bfd6020ce5f54120efd87906fd3675515ce4b8e Author: Willy Tarreau <[email protected]> Date: Fri Jun 7 11:10:07 2019 +0200 MINOR: logs: use the new bitmap functions instead of fd_sets for encoding maps The fd_sets we've been using in the log encoding functions are not portable and were shown to break at least under Cygwin. This patch gets rid of them in favor of the new bitmap functions. (...) It's in latest 2.0-dev, was merged just after dev6. It should work just fine in your situation. Thanks! Willy

