Package: clang-3.2
Version: 1:3.2repack-6
Severity: normal

Dear Maintainer,

The attached (minimal) application hangs when it is compiled with:
    clang++ -D_FORTIFY_SOURCE=2 -O1 -o clang_hang clang_hang.cpp
You need to run it as ./clang_hang clang_hang.cpp

The application works correctly if you remove either the -D or the -O1, or change the -O1 to -O0, -O2 or -O3. Correctly in this case is printing the lines of clang_hang.cpp and exiting within a few milliseconds.

This is (likely) the reason why openttd FTBFS when using clang; the code is the minimized variant of the application that fails during openttd's build.

The application works correctly with GCC on at least versions 4.4, 4.6, 4.7 and 4.8.

Regards,
Remko 'Rubidium' Bijker

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.8-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages clang-3.2 depends on:
ii  libc6                2.17-3
ii  libclang-common-dev  1:3.2repack-6
ii  libffi6              3.0.13-4
ii  libgcc1              1:4.8.0-7
ii  libllvm3.2           1:3.2repack-6
ii  libstdc++6           4.8.0-7
ii  libstdc++6-4.7-dev   4.7.3-4

Versions of packages clang-3.2 recommends:
pn  llvm-3.2-dev  <none>
ii  python        2.7.3-5

clang-3.2 suggests no packages.

-- no debconf information
#include <stdio.h>

struct FileStringReader {
	FILE *fh;
	FileStringReader(const char *file) : fh(fopen(file, "rb")) {}
	char *ReadLine(char *buffer, size_t size) {
		return fgets(buffer, size, this->fh);
	}
};

int main(int argc, char *argv[]) {
	FileStringReader *reader = new FileStringReader(argv[1]);
	char buffer[2048], *line;
	while ((line = reader->ReadLine(buffer, sizeof(buffer))) != NULL) printf("%s", line);
	return 0;
}

Reply via email to