Hi, Clang prints garbage in one of its warnings: > clang35 -v clang version 3.5.1 (tags/RELEASE_351/final) Target: x86_64-portbld-freebsd9.3 Thread model: posix > bmake -m $PWD/share/mk CC=/usr/local/bin/clang35 LD=/usr/local/bin/ld buildkernel -DNO_CLEAN -DNO_KERNELDEPEND WERROR="" /usr/img/freebsd/sys/modules/sppp/../../net/if_spppsubr.c:5372:15: warning: format specifies type 'unsigned char *' but the argument has ���������������`������������0������P���������� --HPS
Can you please provide a minimal repro?
1) Checkout FreeBSD 11-current sources: commit 5cfb29320af7efe68fe6aa83e89cc3650167c5f0 Author: ganbold <ganbold@FreeBSD.org> Date: Wed May 13 05:46:04 2015 +0000 Delete cpu_do_powersave which is set but never used/tested serving no useful purpose. 3) Install clang35 from pkg under FreeBSD 9-stable. 4) In /etc/make.conf: CC=/usr/local/bin/clang35 LD=/usr/local/bin/ld COMPILER_TYPE=clang COMPILER_VERSION=30500 5) cd /usr/img/freebsd/sys/modules/sppp 6) bmake -m /usr/img/freebsd/share/mk Should reproduce.
"Minimal" in this context means a preprocessed .c or .cpp file, without any external dependencies. Also, the exact command line flags used to invoke clang are almost always needed.
Command line: /usr/local/bin/clang35 -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -mno-aes -mno-avx -std=iso9899:1999 -c if_spppsubr.c See attached if_spppsubr.c Thank you! --HPS
Created attachment 14327 [details] Preprocessed file
Right, this is a bug in the FreeBSD-specific -fformat-extensions support, added in the lang/clang35 port. This flag isn't supported by upstream clang, and has been replaced by the __format__(__freebsd_kprintf__, x, y) attribute in trunk. For reference, a minimal example is: void foo(int, const char *, ...) __attribute__((__format__(__printf__, 2, 3))); void bar(const unsigned char *p, unsigned short len) { foo(-1, " %*D", len, p, "-"); } Let's move this bug over to the FreeBSD bug tracker: https://bugs.freebsd.org/200193