Willy,

> > Looks like it decided that non-letter characters had to be encoded. 
> > We're using FD_ISSET() to look up the characters in the character 
> > encoding map because this was convenient in the past, but maybe it's 
> > time to have a native implementation of a bit address lookup and get rid of 
> > this now.
>
> I've just created an issue about this one so we don't forget it.
>
> Willy

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.

Bob

Reply via email to