Hans Petter Selasky
2014-Jul-04 18:09 UTC
[HEADS-UP] Problem with clang in 9-stable [was: r268244 (stable/9) seems to break "sysctl hw.ncpu"]
Hi, Can you try to reproduce this: Checkout 9-stable's src/sbin/sysctl only. cd /usr/9-stable/src/sbin/sysctl env CC=clang make clean all ./sysctl -n hw.ncpu Then: env CC=gcc make clean all ./sysctl -n hw.ncpu clang --version FreeBSD clang version 3.2 (tags/RELEASE_32/final 170710) 20121221 Target: x86_64-unknown-freebsd9.1 Thread model: posix gcc --version gcc (GCC) 4.2.1 20070831 patched [FreeBSD] Copyright (C) 2007 Free Software Foundation, Inc. .... When compiling the code with clang, no output is happening. When compiling with gcc, the FreeBSD 9-stable sysctl operates correctly. How do we proceed? Can more people check this and reproduce? When compiling the -10 and -11 version of sysctl with clang and gcc, everything is fine! Thank you! --HPS
David Wolfskill
2014-Jul-04 18:18 UTC
[HEADS-UP] Problem with clang in 9-stable [was: r268244 (stable/9) seems to break "sysctl hw.ncpu"]
On Fri, Jul 04, 2014 at 08:09:21PM +0200, Hans Petter Selasky wrote:> Hi, > > Can you try to reproduce this: > > Checkout 9-stable's src/sbin/sysctl only. > > cd /usr/9-stable/src/sbin/sysctl > > env CC=clang make clean all > ./sysctl -n hw.ncpu > > Then: > > env CC=gcc make clean all > ./sysctl -n hw.ncpu > > > clang --version > FreeBSD clang version 3.2 (tags/RELEASE_32/final 170710) 20121221 > Target: x86_64-unknown-freebsd9.1 > Thread model: posix > > gcc --version > gcc (GCC) 4.2.1 20070831 patched [FreeBSD] > Copyright (C) 2007 Free Software Foundation, Inc. > ....Hmm... I should have mentioned this part earlier (sorry!): I've been using clang as the system compiler since about ... autumn 2012 (long ago enough that I forgot that it might be "odd" for stable/9).> When compiling the code with clang, no output is happening. When > compiling with gcc, the FreeBSD 9-stable sysctl operates correctly. How > do we proceed? > > Can more people check this and reproduce?Well, here's what I see: g1-252(9.3-P)[22] svn co file:///svn/freebsd/src/base/stable/9/sbin/sysctl A sysctl/sysctl.c A sysctl/sysctl.8 A sysctl/Makefile U sysctl Checked out revision 268249. g1-252(9.3-P)[23] cd sysctl/ g1-252(9.3-P)[24] env CC=clang make clean all rm -f sysctl sysctl.o sysctl.8.gz sysctl.8.cat.gz Warning: Object directory not changed from original /tmp/hps/sysctl clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -c sysctl.c clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -o sysctl sysctl.o gzip -cn sysctl.8 > sysctl.8.gz g1-252(9.3-P)[25] ./sysctl -n hw.ncpu g1-252(9.3-P)[26] env CC=gcc make clean all rm -f sysctl sysctl.o sysctl.8.gz sysctl.8.cat.gz Warning: Object directory not changed from original /tmp/hps/sysctl clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -c sysctl.c clang -O2 -pipe -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -o sysctl sysctl.o gzip -cn sysctl.8 > sysctl.8.gz g1-252(9.3-P)[27] ./sysctl -n hw.ncpu g1-252(9.3-P)[28]> When compiling the -10 and -11 version of sysctl with clang and gcc, > everything is fine!That's moderately seriously kinky.... And not in a Good Way. :-/> Thank you!At least I have some evidence that I might not be merely hallucinating.... Peace, david -- David H. Wolfskill david at catwhisker.org Taliban: Evil cowards with guns afraid of truth from a 14-year old girl. See http://www.catwhisker.org/~david/publickey.gpg for my public key. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 949 bytes Desc: not available URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140704/94aa43de/attachment.sig>
Hans Petter Selasky
2014-Jul-04 18:33 UTC
Re: [HEADS-UP] Problem with clang in 9-stable [was: r268244 (stable/9) seems to break "sysctl hw.ncpu"]
Hi, I've reverted the MFC of r267960: http://svnweb.freebsd.org/changeset/base/268263 I did some checking and the patch makes access to a non-initialized variable, due to other missing patches prior to mine, probably making compiler differences show up on my side. It appears the patch cannot be ported to 9-stable then. So I'll just leave it there. David: Thank you for your error-report. --HPS _______________________________________________ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"