possible clang (2.9) bug affecting ssh-keygen

Darren Tucker dtucker at zip.com.au
Tue Jul 3 23:34:28 EST 2012

Hi all.

Has anyone had any success building openssh 6.0p1 using clang 2.9?  I
think I found a compiler bug, at least in the 2.9 that ships with fedora
16 (i386). It causes (at least) ssh-keygen to spin indefinitely eating CPU.

I've reduced it to the following test case:

$ cat clang-test.c
#include <unistd.h>

char hostname[64];
main(int argc, char **argv)
	gethostname(hostname, sizeof(hostname));

$ clang -O2 -D_FORTIFY_SOURCE clang-test.c 
$ ./a.out

It works fine with gcc and clang 3.1 (built from source) on the same
machine and clang 3.0 on ubuntu x86_64.  Removing either -O2 or
-D_FORTIFY_SOURCE, or moving hostname from a global to a local variable
causes it to work with 2.9.

Given that it seems to be fixed in the newer clang versions I don't
intend filing a bug unless there's some evidence it affects newer
versions too.


Darren Tucker (dtucker at zip.com.au)
GPG key 8FF4FA69 / D9A3 86E9 7EEE AF4B B2D4  37C9 C982 80C7 8FF4 FA69
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

More information about the openssh-unix-dev mailing list