Heimdal working around gcc strcmp issue, can someone check Samba

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Wed Nov 17 04:45:45 UTC 2021

On 16/11/21 7:01 pm, Andrew Bartlett via samba-technical wrote:
> I just got notified of this PR for Heimdal:
> https://github.com/heimdal/heimdal/pull/855
> Can someone work out how much this bites Samba (and can we just ban the
> buggy compilers?)


     if (strcmp(a, b)) {

is contrary to our target style, my reading of the bug is that it does 
not affect strcmp, AND it does not affect the

     if (memcmp(a, b, len)) {

case, because of the implicit `!= 0` there. See

In other words, as noted in its comments, the Heimdal PR is mixing 
general style changes with compiler-bug-workaround changes.

What we need to look out for is

      cmp = memcmp(...)


      return memcmp(...)

of which git grep says we have 61 and 25 of respectively. Which is quite 
a bit, especially given changing these would mostly not be a style 

The good news is there's no memcmp() at all under bin/default.

Banning buggy compilers would be nice, if it left us any. Judging by a 
glance at changelogs and running the test in 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189#c31, the default gcc 
(9.3.0) in Ubuntu 20.04 is affected at -O2.


More information about the samba-technical mailing list