diff --git a/binaries/aarch64/ip2net b/binaries/aarch64/ip2net index ce09b8f..04241d2 100755 Binary files a/binaries/aarch64/ip2net and b/binaries/aarch64/ip2net differ diff --git a/binaries/arm/ip2net b/binaries/arm/ip2net index 0d4b02f..1f876fd 100755 Binary files a/binaries/arm/ip2net and b/binaries/arm/ip2net differ diff --git a/binaries/mac64/ip2net b/binaries/mac64/ip2net index 58fbf5a..e13c9be 100755 Binary files a/binaries/mac64/ip2net and b/binaries/mac64/ip2net differ diff --git a/binaries/mips32r1-lsb/ip2net b/binaries/mips32r1-lsb/ip2net index bc85e07..696e422 100755 Binary files a/binaries/mips32r1-lsb/ip2net and b/binaries/mips32r1-lsb/ip2net differ diff --git a/binaries/mips32r1-msb/ip2net b/binaries/mips32r1-msb/ip2net index 0c910a2..368fdf7 100755 Binary files a/binaries/mips32r1-msb/ip2net and b/binaries/mips32r1-msb/ip2net differ diff --git a/binaries/mips64r2-msb/ip2net b/binaries/mips64r2-msb/ip2net index bc032ba..ffc362f 100755 Binary files a/binaries/mips64r2-msb/ip2net and b/binaries/mips64r2-msb/ip2net differ diff --git a/binaries/ppc/ip2net b/binaries/ppc/ip2net index cd07940..5b856eb 100755 Binary files a/binaries/ppc/ip2net and b/binaries/ppc/ip2net differ diff --git a/binaries/x86/ip2net b/binaries/x86/ip2net index 9f89b04..32d53dc 100755 Binary files a/binaries/x86/ip2net and b/binaries/x86/ip2net differ diff --git a/binaries/x86_64/ip2net b/binaries/x86_64/ip2net index 0ddba99..ef9fd6b 100755 Binary files a/binaries/x86_64/ip2net and b/binaries/x86_64/ip2net differ diff --git a/ip2net/ip2net.c b/ip2net/ip2net.c index b24ec78..2a83e34 100644 --- a/ip2net/ip2net.c +++ b/ip2net/ip2net.c @@ -94,8 +94,16 @@ static void mask_from_bitcount6(uint32_t zct, struct in6_addr *a) // result = a & b static void ip6_and(const struct in6_addr *a, const struct in6_addr *b, struct in6_addr *result) { + // POSSIBLE GCC COMPILER BUG . when using uint64_t and -O2/-O3 optimizations this function gets inlined with the wrong code and produces wrong results +#if defined(__GNUC__) && !defined(__llvm__) && !defined(__NO_INLINE__) + ((uint32_t*)result->s6_addr)[0] = ((uint32_t*)a->s6_addr)[0] & ((uint32_t*)b->s6_addr)[0]; + ((uint32_t*)result->s6_addr)[1] = ((uint32_t*)a->s6_addr)[1] & ((uint32_t*)b->s6_addr)[1]; + ((uint32_t*)result->s6_addr)[2] = ((uint32_t*)a->s6_addr)[2] & ((uint32_t*)b->s6_addr)[2]; + ((uint32_t*)result->s6_addr)[3] = ((uint32_t*)a->s6_addr)[3] & ((uint32_t*)b->s6_addr)[3]; +#else ((uint64_t*)result->s6_addr)[0] = ((uint64_t*)a->s6_addr)[0] & ((uint64_t*)b->s6_addr)[0]; ((uint64_t*)result->s6_addr)[1] = ((uint64_t*)a->s6_addr)[1] & ((uint64_t*)b->s6_addr)[1]; +#endif } static void rtrim(char *s) @@ -259,7 +267,7 @@ int main(int argc, char **argv) /* for(uint32_t i=0;i> 24; u2 = (ip_start >> 16) & 0xFF;