From owner-freebsd-toolchain@freebsd.org Thu Jun 29 10:04:23 2017 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28779D98A5B for ; Thu, 29 Jun 2017 10:04:23 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: from asp.reflexion.net (outbound-mail-210-15.reflexion.net [208.70.210.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA3357E16E for ; Thu, 29 Jun 2017 10:04:22 +0000 (UTC) (envelope-from markmi@dsl-only.net) Received: (qmail 12079 invoked from network); 29 Jun 2017 10:04:21 -0000 Received: from unknown (HELO mail-cs-02.app.dca.reflexion.local) (10.81.19.2) by 0 (rfx-qmail) with SMTP; 29 Jun 2017 10:04:21 -0000 Received: by mail-cs-02.app.dca.reflexion.local (Reflexion email security v8.40.1) with SMTP; Thu, 29 Jun 2017 06:04:21 -0400 (EDT) Received: (qmail 1759 invoked from network); 29 Jun 2017 10:04:20 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (AES256-SHA encrypted) SMTP; 29 Jun 2017 10:04:20 -0000 Received: from [192.168.1.114] (c-76-115-7-162.hsd1.or.comcast.net [76.115.7.162]) by iron2.pdx.net (Postfix) with ESMTPSA id 37AD1EC8A8B; Thu, 29 Jun 2017 03:04:20 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: head -r320458 (e.g.) amd64 -> powerpc (32-bit) cross-buildworld fails for time libc++ static_asserts and overflow/underflow of long long (system clang/clang++ 4 based build) From: Mark Millard In-Reply-To: <5B12D9A6-C9A2-4B0D-B32D-D04D7DB1E3BC@dsl-only.net> Date: Thu, 29 Jun 2017 03:04:19 -0700 Cc: FreeBSD Toolchain , FreeBSD Current , FreeBSD PowerPC ML Content-Transfer-Encoding: quoted-printable Message-Id: References: <5B12D9A6-C9A2-4B0D-B32D-D04D7DB1E3BC@dsl-only.net> To: Justin Hibbits X-Mailer: Apple Mail (2.3273) X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jun 2017 10:04:23 -0000 [The libc++ code in question appears to not be ready for 32-bit contexts with 64 bit times. Disable experimental/filesystem for now? I've submitted llvm bugzilla 33638 for the issue and have added it to llvm's 25780, the FreeBSD META for clang.] On 2017-Jun-29, at 2:21 AM, Mark Millard wrote: > [TARGET_ARCH=3Dpowerpc64 fails similarly in its world32 > part of its build.] >=20 > On 2017-Jun-29, at 1:33 AM, Mark Millard wrote: >=20 >> Beyond static_assert failures and overflow/underflow of long long >> it also it complains in some cases about: >>=20 >> static_assert expression is not an integral constant expression >>=20 >>=20 >> [I will note that attempting a gcc 4.2.1 build did not >> stop and report such things for its libstdc++. The below >> is somehow libc++ and/or clang 4 specific.] >>=20 >>=20 >> Context: >>=20 >> # uname -apKU >> FreeBSD FreeBSDx64OPC 12.0-CURRENT FreeBSD 12.0-CURRENT r320458M = amd64 amd64 1200036 1200036 >>=20 >> buildworld for TARGET_ARCH=3Dpowerpc resulted in: >>=20 >> --- filesystem/operations.o --- >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:579:1: = error: static_assert failed "" >> static_assert(is_representable({max_time_t, 999999999}), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:580:1: = error: static_assert failed "" >> static_assert(is_representable({max_time_t, 1000000000}), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:581:1: = error: static_assert failed "" >> static_assert(is_representable({min_time_t, 0}), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:603:1: = error: static_assert failed "" >> static_assert(!is_representable(file_time_type::max()), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:604:1: = error: static_assert failed "" >> static_assert(!is_representable(file_time_type::min()), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:605:15:= error: static_assert expression is not an integral constant expression >> static_assert(is_representable(file_time_type(seconds(max_time_t))), = ""); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> /usr/src/contrib/libc++/include/chrono:386:59: note: value = 9223372036854775807000000 is outside the range of representable values = of type 'long long' >> static_cast<_Ct>(__fd.count()) * = static_cast<_Ct>(_Period::num))); >> ^ >> /usr/src/contrib/libc++/include/chrono:413:12: note: in call to = '&__duration_cast >, = std::__1::chrono::duration > = >()->operator()(seconds(max_time_t))' >> return __duration_cast, = _ToDuration>()(__fd); >> ^ >> /usr/src/contrib/libc++/include/chrono:560:26: note: in call to = 'duration_cast(seconds(max_time_t))' >> : = __rep_(_VSTD::chrono::duration_cast(__d).count()) {} >> ^ >> /usr/src/contrib/libc++/include/__config:390:15: note: expanded from = macro '_VSTD' >> #define _VSTD std::_LIBCPP_NAMESPACE >> ^ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:605:47:= note: in call to 'duration(seconds(max_time_t), 0)' >> static_assert(is_representable(file_time_type(seconds(max_time_t))), = ""); >> ^ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:606:15:= error: static_assert expression is not an integral constant expression >> static_assert(is_representable(file_time_type(seconds(min_time_t))), = ""); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> /usr/src/contrib/libc++/include/chrono:386:59: note: value = -9223372036854775808000000 is outside the range of representable values = of type 'long long' >> static_cast<_Ct>(__fd.count()) * = static_cast<_Ct>(_Period::num))); >> ^ >> /usr/src/contrib/libc++/include/chrono:413:12: note: in call to = '&__duration_cast >, = std::__1::chrono::duration > = >()->operator()(seconds(min_time_t))' >> return __duration_cast, = _ToDuration>()(__fd); >> ^ >> /usr/src/contrib/libc++/include/chrono:560:26: note: in call to = 'duration_cast(seconds(min_time_t))' >> : = __rep_(_VSTD::chrono::duration_cast(__d).count()) {} >> ^ >> /usr/src/contrib/libc++/include/__config:390:15: note: expanded from = macro '_VSTD' >> #define _VSTD std::_LIBCPP_NAMESPACE >> ^ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:606:47:= note: in call to 'duration(seconds(min_time_t), 0)' >> static_assert(is_representable(file_time_type(seconds(min_time_t))), = ""); >> ^ >> . . . >> --- lib__L --- >> 7 errors generated. >> *** [filesystem/operations.o] Error code 1 >>=20 >> make[5]: stopped in /usr/src/lib/libc++experimental >> .ERROR_TARGET=3D'filesystem/operations.o' >> = .ERROR_META_FILE=3D'/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/lib= /libc++experimental/_usr_obj_powerpcvtsc_clang_powerpc.powerpc_usr_src_lib= _libc++experimental_filesystem_operations.o.meta' >> .MAKE.LEVEL=3D'5' >> MAKEFILE=3D'' >> .MAKE.MODE=3D'meta missing-filemon=3Dyes missing-meta=3Dyes = silent=3Dyes verbose' >> _ERROR_CMD=3D'c++ -target powerpc-unknown-freebsd12.0 = --sysroot=3D/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/tmp = -B/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/tmp/usr/bin -O2 = -pipe -fstack-protector-strong -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 = -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch = -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses = -Qunused-arguments -fpic -isystem /usr/src/contrib/libc++/include = -nostdinc++ -nostdlib -D_LIBCPP_BUILDING_LIBRARY -DLIBCXXRT -std=3Dc++14 = -Wno-c++11-extensions -c = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp -o = filesystem/operations.o;' >> .CURDIR=3D'/usr/src/lib/libc++experimental' >>=20 >>=20 >> # more = /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/lib/libc++experimental/= _usr_obj_powerpcvtsc_clang_powerpc.powerpc_usr_src_lib_libc++experimental_= filesystem_operations.o.meta >> # Meta data file = /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/lib/libc++experimental/= _usr_obj_powerpcvtsc_clang_powerpc.powerpc_usr_src_lib_libc++experimental_= filesystem_operations.o.meta >> CMD c++ -target powerpc-unknown-freebsd12.0 = --sysroot=3D/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/tmp = -B/usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/tmp/usr/bin -O2 = -pipe -fstack-protector-strong -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 = -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch = -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses = -Qunused-arguments -fpic -isystem /usr/src/contrib/libc++/include = -nostdinc++ -nostdlib -D_LIBCPP_BUILDING_LIBRARY -DLIBCXXRT -std=3Dc++14 = -Wno-c++11-extensions -c = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp -o = filesystem/operations.o >> CWD = /usr/obj/powerpcvtsc_clang/powerpc.powerpc/usr/src/lib/libc++experimental >> TARGET filesystem/operations.o >> -- command output -- >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:579:1: = error: static_assert failed "" >> static_assert(is_representable({max_time_t, 999999999}), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:580:1: = error: static_assert failed "" >> static_assert(is_representable({max_time_t, 1000000000}), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:581:1: = error: static_assert failed "" >> static_assert(is_representable({min_time_t, 0}), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:603:1: = error: static_assert failed "" >> static_assert(!is_representable(file_time_type::max()), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:604:1: = error: static_assert failed "" >> static_assert(!is_representable(file_time_type::min()), ""); >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:605:15:= error: static_assert expression is not an integral constant expression >> static_assert(is_representable(file_time_type(seconds(max_time_t))), = ""); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> /usr/src/contrib/libc++/include/chrono:386:59: note: value = 9223372036854775807000000 is outside the range of representable values = of type 'long long' >> static_cast<_Ct>(__fd.count()) * = static_cast<_Ct>(_Period::num))); >> ^ >> /usr/src/contrib/libc++/include/chrono:413:12: note: in call to = '&__duration_cast >, = std::__1::chrono::duration > = >()->operator()(seconds(max_time_t))' >> return __duration_cast, = _ToDuration>()(__fd); >> ^ >> /usr/src/contrib/libc++/include/chrono:560:26: note: in call to = 'duration_cast(seconds(max_time_t))' >> : = __rep_(_VSTD::chrono::duration_cast(__d).count()) {} >> ^ >> /usr/src/contrib/libc++/include/__config:390:15: note: expanded from = macro '_VSTD' >> #define _VSTD std::_LIBCPP_NAMESPACE >> ^ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:605:47:= note: in call to 'duration(seconds(max_time_t), 0)' >> static_assert(is_representable(file_time_type(seconds(max_time_t))), = ""); >> ^ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:606:15:= error: static_assert expression is not an integral constant expression >> static_assert(is_representable(file_time_type(seconds(min_time_t))), = ""); >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> /usr/src/contrib/libc++/include/chrono:386:59: note: value = -9223372036854775808000000 is outside the range of representable values = of type 'long long' >> static_cast<_Ct>(__fd.count()) * = static_cast<_Ct>(_Period::num))); >> ^ >> /usr/src/contrib/libc++/include/chrono:413:12: note: in call to = '&__duration_cast >, = std::__1::chrono::duration > = >()->operator()(seconds(min_time_t))' >> return __duration_cast, = _ToDuration>()(__fd); >> ^ >> /usr/src/contrib/libc++/include/chrono:560:26: note: in call to = 'duration_cast(seconds(min_time_t))' >> : = __rep_(_VSTD::chrono::duration_cast(__d).count()) {} >> ^ >> /usr/src/contrib/libc++/include/__config:390:15: note: expanded from = macro '_VSTD' >> #define _VSTD std::_LIBCPP_NAMESPACE >> ^ >> = /usr/src/contrib/libc++/src/experimental/filesystem/operations.cpp:606:47:= note: in call to 'duration(seconds(min_time_t), 0)' >> static_assert(is_representable(file_time_type(seconds(min_time_t))), = ""); >> ^ >> 7 errors generated. >> *** Error code 1 >>=20 >>=20 >>=20 >> Build configuration: >>=20 >>=20 >> # svnlite info /usr/src/ | grep "Re[plv]" >> Relative URL: ^/head >> Repository Root: svn://svn.freebsd.org/base >> Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f >> Revision: 320458 >> Last Changed Rev: 320458 >>=20 >>=20 >> # more = ~/sys_build_scripts.amd64-host/make_powerpcvtsc_nodebug_clang_bootstrap-am= d64-host.sh=20 >> kldload -n filemon && \ >> script = ~/sys_typescripts/typescript_make_powerpcvtsc_nodebug_clang_bootstrap-amd6= 4-host-$(date +%Y-%m-%d:%H:%M:%S) \ >> env __MAKE_CONF=3D"/root/src.configs/make.conf" SRCCONF=3D"/dev/null" = SRC_ENV_CONF=3D"/root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-h= ost" \ >> WITH_META_MODE=3Dyes \ >> MAKEOBJDIRPREFIX=3D"/usr/obj/powerpcvtsc_clang" \ >> make $* >>=20 >>=20 >> # more /root/src.configs/src.conf.powerpc-clang-bootstrap.amd64-host >> TO_TYPE=3Dpowerpc >> # >> KERNCONF=3DGENERICvtsc-NODBG >> TARGET=3D${TO_TYPE} >> .if ${.MAKE.LEVEL} =3D=3D 0 >> TARGET_ARCH=3D${TO_TYPE} >> .export TARGET_ARCH >> .endif >> # >> WITH_CROSS_COMPILER=3D >> WITHOUT_SYSTEM_COMPILER=3D >> # >> WITH_LIBCPLUSPLUS=3D >> WITH_BINUTILS_BOOTSTRAP=3D >> WITH_ELFTOOLCHAIN_BOOTSTRAP=3D >> WITH_CLANG_BOOTSTRAP=3D >> WITH_CLANG=3D >> WITH_CLANG_IS_CC=3D >> WITH_CLANG_FULL=3D >> WITH_CLANG_EXTRAS=3D >> WITH_LLD=3D >> # lldb requires missing atomic 8-byte operations for powerpc (non-64) >> WITHOUT_LLDB=3D >> # >> WITH_BOOT=3D >> WITHOUT_LIB32=3D >> # >> WITHOUT_GCC_BOOTSTRAP=3D >> WITHOUT_GCC=3D >> WITHOUT_GCC_IS_CC=3D >> WITHOUT_GNUCXX=3D >> # >> NO_WERROR=3D >> # >> # Use WERROR to avoid stopping at the likes of: >> # error: implicit conversion from 'int' to 'int8_t' (aka 'signed = char') changes value from 128 to -128 [-Werror,-Wconstant-conversion] >> WERROR=3D >> MALLOC_PRODUCTION=3D >> # >> WITH_REPRODUCIBLE_BUILD=3D >> WITH_DEBUG_FILES=3D >=20 >=20 > The world32 part of a TARGET_ARCH=3Dpowerpc64 cross-buildworld > also gets the same errors. Turns out the libc++ code in question looks like: _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(TimeSpec const& tm) { if (tm.tv_sec >=3D 0) { return (tm.tv_sec < max_seconds) || (tm.tv_sec =3D=3D max_seconds && tm.tv_nsec <=3D max_nsec); } else if (tm.tv_sec =3D=3D (min_seconds - 1)) { return tm.tv_nsec >=3D min_nsec_timespec; } else { return (tm.tv_sec >=3D min_seconds); } } #ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR #if defined(__LP64__) . . . #else static_assert(is_representable({max_time_t, 999999999}), ""); static_assert(is_representable({max_time_t, 1000000000}), ""); static_assert(is_representable({min_time_t, 0}), ""); #endif #endif =20 _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(file_time_type const& tm) { auto secs =3D duration_cast(tm.time_since_epoch()); auto nsecs =3D duration_cast(tm.time_since_epoch() - = secs); if (nsecs.count() < 0) { secs =3D secs + seconds(1); nsecs =3D nsecs + seconds(1); } using TLim =3D numeric_limits; if (secs.count() >=3D 0) return secs.count() <=3D TLim::max(); return secs.count() >=3D TLim::min(); } #ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR #if defined(__LP64__) . . . #else static_assert(!is_representable(file_time_type::max()), ""); static_assert(!is_representable(file_time_type::min()), ""); static_assert(is_representable(file_time_type(seconds(max_time_t))), = ""); static_assert(is_representable(file_time_type(seconds(min_time_t))), = ""); #endif #endif _LIBCPP_CONSTEXPR_AFTER_CXX11 file_time_type convert_timespec(TimeSpec const& tm) { auto adj_msec =3D = duration_cast(nanoseconds(tm.tv_nsec)); if (tm.tv_sec >=3D 0) { auto Dur =3D seconds(tm.tv_sec) + microseconds(adj_msec); return file_time_type(Dur); } else if = (duration_cast(nanoseconds(tm.tv_nsec)).count() =3D=3D 0) = { return file_time_type(seconds(tm.tv_sec)); } else { // tm.tv_sec < 0 auto adj_subsec =3D duration_cast(seconds(1) - = nanoseconds(tm.tv_nsec)); auto Dur =3D seconds(tm.tv_sec + 1) - adj_subsec; return file_time_type(Dur); } } #ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR #if defined(__LP64__) . . . #else // FIXME add tests for 32 bit builds #endif #endif That "FIXME" likely gives a clue as to the status of of the handling for ILP32 contexts. There seems to be the expectation that IPL32 will not have 64-bit time_t as well. =3D=3D=3D Mark Millard markmi at dsl-only.net