Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
On Sun, 5 Apr 2020 at 15:41, David Zarzycki via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Subjectively speaking, using char8_t instead of char shouldn’t feel like a > regression. So yes, making the builtin mem* functions work with char8_t > again seems right. As for strlen, I can see arguments either way. > Personally, if you’re concerned about clever macros, then I’d make the > overload only visible in C++20 mode where char8_t was introduced. > I don't think that solves the problem. For example, the glibc headers do clever things with __builtin_strlen (which they do, at least in some cases), then this may still result in miscompiles. Eg, consider: struct microseconds { operator const char*() { return "us"; } operator const char8_t*() { return "µs"; } }; char buffer[32]; strcpy(buffer, microseconds()); This should compile, but won't if the implementation of strcpy is a macro that calls __builtin_strlen (as it sometimes is with glibc). Worse would be if the char8_t conversion function is preferred over the char conversion function for some reason, where strcpy might expand to `memcpy(buffer, microseconds(), __builtin_strlen(microseconds()))`, potentially resulting in a buffer overflow (copying using the length of the char8_t string but the content of the char string). If we want to introduce a strlen builtin for char8_t, I think we should give it a different name. I've realized that my suggestion of using __builtin_memchr(p, 0) - p for strlen doesn't actually work, for the usual reason that memchr is mostly useless in constant expressions (because it returns a void*). So maybe we should add a __builtin_memchr_char8_t to parallel the existing __builtin_memchr_char, or maybe make __builtin_memchr_char overloaded on character type? -- > Sent from my iPhone > > On Apr 5, 2020, at 18:18, Richard Smith wrote: > > > On Sun, 5 Apr 2020 at 14:44, David Zarzycki via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> We have overloaded builtins. Can that not solve __builtin_strlen? >> > > I suppose it could, but we generally want __builtin_ to behave > the same as . (The difference would not be visible most of the > time, but there's enough pre-existing use of __builtin_strlen through > "clever" macros and the like that I'd be worried that this would break > something important.) Maybe we should just make the mem* functions work > again for char8_t; then you can use __builtin_memchr(p, 0) - p as an > optimized compile-time strlen. > > >> -- >> Sent from my iPhone >> >> On Apr 5, 2020, at 14:53, Richard Smith wrote: >> >> >> Thanks. We need to figure out what the right way to support char8_t with >> string builtins is. These ones could work in principle, whereas things like >> __builtin_strlen would never work because they take operands of the wrong >> types (and we can't cast const char8_t* -> const char* in a constant >> expression). >> >> On Sun, 5 Apr 2020 at 04:14, David Zarzycki via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Hi Richard, >>> >>> I'm going to commit a narrow fix to clang to make the libcxx test suite >>> pass again by allowing char8_t again. If you feel that this is the wrong >>> long-term solution, please help the libcxx folks with whatever adjustments >>> they need. >>> >>> Thanks! >>> >>> Dave >>> >>> >>> On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: >>> > Hi Richard, >>> > >>> > This breaks libcxx. Can we please revert this or is a quick fix to >>> > libcxx possible? >>> > >>> > >>> > FAIL: libc++ :: >>> > >>> std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp >>> (58624 of 62672) >>> > TEST 'libc++ :: >>> > >>> std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' >>> FAILED >>> > Command: ['/p/tllvm/bin/clang++', '-o', >>> > >>> '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', >>> '-x', 'c++', >>> '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', >>> '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', >>> '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', >>> '-I/home/dave/s/lp/libcxx/include', >>> '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', >>> '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', >>> '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', >>> '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', >>> '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', >>> '-Wno-unused-command-line-argument', '-Wno-attributes', >>> '-Wno-pessimizing-move', '-Wno-c++11-extensions', >>> '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', >>> '-Wunused-variable', '-Wunused-parameter', '-Wunrea
Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
Subjectively speaking, using char8_t instead of char shouldn’t feel like a regression. So yes, making the builtin mem* functions work with char8_t again seems right. As for strlen, I can see arguments either way. Personally, if you’re concerned about clever macros, then I’d make the overload only visible in C++20 mode where char8_t was introduced. -- Sent from my iPhone > On Apr 5, 2020, at 18:18, Richard Smith wrote: > > >> On Sun, 5 Apr 2020 at 14:44, David Zarzycki via cfe-commits >> wrote: > >> We have overloaded builtins. Can that not solve __builtin_strlen? > > I suppose it could, but we generally want __builtin_ to behave the > same as . (The difference would not be visible most of the time, but > there's enough pre-existing use of __builtin_strlen through "clever" macros > and the like that I'd be worried that this would break something important.) > Maybe we should just make the mem* functions work again for char8_t; then you > can use __builtin_memchr(p, 0) - p as an optimized compile-time strlen. > >> -- >> Sent from my iPhone >> On Apr 5, 2020, at 14:53, Richard Smith wrote: >>> >>> Thanks. We need to figure out what the right way to support char8_t with >>> string builtins is. These ones could work in principle, whereas things like >>> __builtin_strlen would never work because they take operands of the wrong >>> types (and we can't cast const char8_t* -> const char* in a constant >>> expression). >>> On Sun, 5 Apr 2020 at 04:14, David Zarzycki via cfe-commits wrote: Hi Richard, I'm going to commit a narrow fix to clang to make the libcxx test suite pass again by allowing char8_t again. If you feel that this is the wrong long-term solution, please help the libcxx folks with whatever adjustments they need. Thanks! Dave On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: > Hi Richard, > > This breaks libcxx. Can we please revert this or is a quick fix to > libcxx possible? > > > FAIL: libc++ :: > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp > (58624 of 62672) > TEST 'libc++ :: > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' > FAILED > Command: ['/p/tllvm/bin/clang++', '-o', > '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', > '-x', 'c++', > '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', > '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', > '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', > '-I/home/dave/s/lp/libcxx/include', > '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', > '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', > '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', > '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', > '-Wall', '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', > '-Wno-unused-command-line-argument', '-Wno-attributes', > '-Wno-pessimizing-move', '-Wno-c++11-extensions', > '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', > '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] > Exit Code: 1 > Standard Error: > -- > clang version 11.0.0 (https://github.com/llvm/llvm-project.git > 22127da8f17c03c69231f3631472f7f99ad9cb7f) > Target: x86_64-unknown-linux-gnu > Thread model: posix > InstalledDir: /p/tllvm/bin > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 > Candidate multilib: .;@m64 > Candidate multilib: 32;@m32 > Selected multilib: .;@m64 > (in-process) > "/p/tllvm/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu > -emit-obj -mrelax-all -disable-free -disable-llvm-verifier > -discard-value-names -main-file-name compare.pass.cpp > -mrelocation-model static -mthread-model posix -mframe-pointer=all > -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables > -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining > -debugger-tuning=gdb -v -nostdinc++ -resource-dir > /p/tllvm/lib64/clang/11.0.0 -include > /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I > /home/dave/s/lp/libcxx/include -I > /tmp/_update_lc/t/projects/libcxx/include/c++build -D > __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS > -I /home/dave/s/lp/libcx
Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
On Sun, 5 Apr 2020 at 15:17, Richard Smith wrote: > On Sun, 5 Apr 2020 at 14:44, David Zarzycki via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> We have overloaded builtins. Can that not solve __builtin_strlen? >> > > I suppose it could, but we generally want __builtin_ to behave > the same as . (The difference would not be visible most of the > time, but there's enough pre-existing use of __builtin_strlen through > "clever" macros and the like that I'd be worried that this would break > something important.) Maybe we should just make the mem* functions work > again for char8_t; then you can use __builtin_memchr(p, 0) - p as an > optimized compile-time strlen. > I see you already did this for memcmp in llvmorg-11-init-7822-g2c88a485c71 :) I added documentation and testing and extended this to also cover memchr in llvmorg-11-init-7851-g7f24db01751. > >> -- >> Sent from my iPhone >> >> On Apr 5, 2020, at 14:53, Richard Smith wrote: >> >> >> Thanks. We need to figure out what the right way to support char8_t with >> string builtins is. These ones could work in principle, whereas things like >> __builtin_strlen would never work because they take operands of the wrong >> types (and we can't cast const char8_t* -> const char* in a constant >> expression). >> >> On Sun, 5 Apr 2020 at 04:14, David Zarzycki via cfe-commits < >> cfe-commits@lists.llvm.org> wrote: >> >>> Hi Richard, >>> >>> I'm going to commit a narrow fix to clang to make the libcxx test suite >>> pass again by allowing char8_t again. If you feel that this is the wrong >>> long-term solution, please help the libcxx folks with whatever adjustments >>> they need. >>> >>> Thanks! >>> >>> Dave >>> >>> >>> On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: >>> > Hi Richard, >>> > >>> > This breaks libcxx. Can we please revert this or is a quick fix to >>> > libcxx possible? >>> > >>> > >>> > FAIL: libc++ :: >>> > >>> std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp >>> (58624 of 62672) >>> > TEST 'libc++ :: >>> > >>> std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' >>> FAILED >>> > Command: ['/p/tllvm/bin/clang++', '-o', >>> > >>> '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', >>> '-x', 'c++', >>> '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', >>> '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', >>> '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', >>> '-I/home/dave/s/lp/libcxx/include', >>> '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', >>> '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', >>> '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', >>> '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', >>> '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', >>> '-Wno-unused-command-line-argument', '-Wno-attributes', >>> '-Wno-pessimizing-move', '-Wno-c++11-extensions', >>> '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', >>> '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] >>> > Exit Code: 1 >>> > Standard Error: >>> > -- >>> > clang version 11.0.0 (https://github.com/llvm/llvm-project.git >>> > 22127da8f17c03c69231f3631472f7f99ad9cb7f) >>> > Target: x86_64-unknown-linux-gnu >>> > Thread model: posix >>> > InstalledDir: /p/tllvm/bin >>> > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 >>> > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 >>> > Candidate multilib: .;@m64 >>> > Candidate multilib: 32;@m32 >>> > Selected multilib: .;@m64 >>> > (in-process) >>> > "/p/tllvm/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu >>> > -emit-obj -mrelax-all -disable-free -disable-llvm-verifier >>> > -discard-value-names -main-file-name compare.pass.cpp >>> > -mrelocation-model static -mthread-model posix -mframe-pointer=all >>> > -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables >>> > -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining >>> > -debugger-tuning=gdb -v -nostdinc++ -resource-dir >>> > /p/tllvm/lib64/clang/11.0.0 -include >>> > /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I >>> > /home/dave/s/lp/libcxx/include -I >>> > /tmp/_update_lc/t/projects/libcxx/include/c++build -D >>> > __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS >>> > -I /home/dave/s/lp/libcxx/test/support -D >>> > _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem >>> > /usr/local/include -internal-isystem >>> > /p/tllvm/lib64/clang/11.0.0/include -internal-externc-isystem /include >>> > -internal-externc-isystem /usr/include -Werror=thread-safety -Wall >>> > -Wextra -Werror
Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
On Sun, 5 Apr 2020 at 14:44, David Zarzycki via cfe-commits < cfe-commits@lists.llvm.org> wrote: > We have overloaded builtins. Can that not solve __builtin_strlen? > I suppose it could, but we generally want __builtin_ to behave the same as . (The difference would not be visible most of the time, but there's enough pre-existing use of __builtin_strlen through "clever" macros and the like that I'd be worried that this would break something important.) Maybe we should just make the mem* functions work again for char8_t; then you can use __builtin_memchr(p, 0) - p as an optimized compile-time strlen. > -- > Sent from my iPhone > > On Apr 5, 2020, at 14:53, Richard Smith wrote: > > > Thanks. We need to figure out what the right way to support char8_t with > string builtins is. These ones could work in principle, whereas things like > __builtin_strlen would never work because they take operands of the wrong > types (and we can't cast const char8_t* -> const char* in a constant > expression). > > On Sun, 5 Apr 2020 at 04:14, David Zarzycki via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Hi Richard, >> >> I'm going to commit a narrow fix to clang to make the libcxx test suite >> pass again by allowing char8_t again. If you feel that this is the wrong >> long-term solution, please help the libcxx folks with whatever adjustments >> they need. >> >> Thanks! >> >> Dave >> >> >> On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: >> > Hi Richard, >> > >> > This breaks libcxx. Can we please revert this or is a quick fix to >> > libcxx possible? >> > >> > >> > FAIL: libc++ :: >> > >> std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp >> (58624 of 62672) >> > TEST 'libc++ :: >> > >> std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' >> FAILED >> > Command: ['/p/tllvm/bin/clang++', '-o', >> > >> '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', >> '-x', 'c++', >> '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', >> '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', >> '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', >> '-I/home/dave/s/lp/libcxx/include', >> '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', >> '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', >> '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', >> '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', >> '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', >> '-Wno-unused-command-line-argument', '-Wno-attributes', >> '-Wno-pessimizing-move', '-Wno-c++11-extensions', >> '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', >> '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] >> > Exit Code: 1 >> > Standard Error: >> > -- >> > clang version 11.0.0 (https://github.com/llvm/llvm-project.git >> > 22127da8f17c03c69231f3631472f7f99ad9cb7f) >> > Target: x86_64-unknown-linux-gnu >> > Thread model: posix >> > InstalledDir: /p/tllvm/bin >> > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 >> > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 >> > Candidate multilib: .;@m64 >> > Candidate multilib: 32;@m32 >> > Selected multilib: .;@m64 >> > (in-process) >> > "/p/tllvm/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu >> > -emit-obj -mrelax-all -disable-free -disable-llvm-verifier >> > -discard-value-names -main-file-name compare.pass.cpp >> > -mrelocation-model static -mthread-model posix -mframe-pointer=all >> > -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables >> > -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining >> > -debugger-tuning=gdb -v -nostdinc++ -resource-dir >> > /p/tllvm/lib64/clang/11.0.0 -include >> > /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I >> > /home/dave/s/lp/libcxx/include -I >> > /tmp/_update_lc/t/projects/libcxx/include/c++build -D >> > __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS >> > -I /home/dave/s/lp/libcxx/test/support -D >> > _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem >> > /usr/local/include -internal-isystem >> > /p/tllvm/lib64/clang/11.0.0/include -internal-externc-isystem /include >> > -internal-externc-isystem /usr/include -Werror=thread-safety -Wall >> > -Wextra -Werror -Wuser-defined-warnings -Wshadow >> > -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move >> > -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type >> > -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code >> > -std=c++2a -fdeprecated-macro -fdebug-compilation-dir >> > >> /tmp/_update_lc/t/projects/libcxx
Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
We have overloaded builtins. Can that not solve __builtin_strlen? -- Sent from my iPhone > On Apr 5, 2020, at 14:53, Richard Smith wrote: > > > Thanks. We need to figure out what the right way to support char8_t with > string builtins is. These ones could work in principle, whereas things like > __builtin_strlen would never work because they take operands of the wrong > types (and we can't cast const char8_t* -> const char* in a constant > expression). > >> On Sun, 5 Apr 2020 at 04:14, David Zarzycki via cfe-commits >> wrote: >> Hi Richard, >> >> I'm going to commit a narrow fix to clang to make the libcxx test suite pass >> again by allowing char8_t again. If you feel that this is the wrong >> long-term solution, please help the libcxx folks with whatever adjustments >> they need. >> >> Thanks! >> >> Dave >> >> >> On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: >> > Hi Richard, >> > >> > This breaks libcxx. Can we please revert this or is a quick fix to >> > libcxx possible? >> > >> > >> > FAIL: libc++ :: >> > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp >> > (58624 of 62672) >> > TEST 'libc++ :: >> > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' >> > FAILED >> > Command: ['/p/tllvm/bin/clang++', '-o', >> > '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', >> > '-x', 'c++', >> > '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', >> > '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', >> > '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', >> > '-I/home/dave/s/lp/libcxx/include', >> > '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', >> > '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', >> > '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', >> > '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', >> > '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', >> > '-Wno-unused-command-line-argument', '-Wno-attributes', >> > '-Wno-pessimizing-move', '-Wno-c++11-extensions', >> > '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', >> > '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] >> > Exit Code: 1 >> > Standard Error: >> > -- >> > clang version 11.0.0 (https://github.com/llvm/llvm-project.git >> > 22127da8f17c03c69231f3631472f7f99ad9cb7f) >> > Target: x86_64-unknown-linux-gnu >> > Thread model: posix >> > InstalledDir: /p/tllvm/bin >> > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 >> > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 >> > Candidate multilib: .;@m64 >> > Candidate multilib: 32;@m32 >> > Selected multilib: .;@m64 >> > (in-process) >> > "/p/tllvm/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu >> > -emit-obj -mrelax-all -disable-free -disable-llvm-verifier >> > -discard-value-names -main-file-name compare.pass.cpp >> > -mrelocation-model static -mthread-model posix -mframe-pointer=all >> > -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables >> > -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining >> > -debugger-tuning=gdb -v -nostdinc++ -resource-dir >> > /p/tllvm/lib64/clang/11.0.0 -include >> > /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I >> > /home/dave/s/lp/libcxx/include -I >> > /tmp/_update_lc/t/projects/libcxx/include/c++build -D >> > __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS >> > -I /home/dave/s/lp/libcxx/test/support -D >> > _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem >> > /usr/local/include -internal-isystem >> > /p/tllvm/lib64/clang/11.0.0/include -internal-externc-isystem /include >> > -internal-externc-isystem /usr/include -Werror=thread-safety -Wall >> > -Wextra -Werror -Wuser-defined-warnings -Wshadow >> > -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move >> > -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type >> > -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code >> > -std=c++2a -fdeprecated-macro -fdebug-compilation-dir >> > /tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t >> > -ftemplate-depth 270 -ferror-limit 19 -fgnuc-version=4.2.1 >> > -fno-implicit-modules -fcxx-exceptions -fexceptions -faddrsig -o >> > /tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o >> > -x c++ >> > /home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.tra
Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
Thanks. We need to figure out what the right way to support char8_t with string builtins is. These ones could work in principle, whereas things like __builtin_strlen would never work because they take operands of the wrong types (and we can't cast const char8_t* -> const char* in a constant expression). On Sun, 5 Apr 2020 at 04:14, David Zarzycki via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Hi Richard, > > I'm going to commit a narrow fix to clang to make the libcxx test suite > pass again by allowing char8_t again. If you feel that this is the wrong > long-term solution, please help the libcxx folks with whatever adjustments > they need. > > Thanks! > > Dave > > > On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: > > Hi Richard, > > > > This breaks libcxx. Can we please revert this or is a quick fix to > > libcxx possible? > > > > > > FAIL: libc++ :: > > > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp > (58624 of 62672) > > TEST 'libc++ :: > > > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' > FAILED > > Command: ['/p/tllvm/bin/clang++', '-o', > > > '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', > '-x', 'c++', > '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', > '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', > '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', > '-I/home/dave/s/lp/libcxx/include', > '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', > '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', > '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', > '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', > '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', > '-Wno-unused-command-line-argument', '-Wno-attributes', > '-Wno-pessimizing-move', '-Wno-c++11-extensions', > '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', > '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] > > Exit Code: 1 > > Standard Error: > > -- > > clang version 11.0.0 (https://github.com/llvm/llvm-project.git > > 22127da8f17c03c69231f3631472f7f99ad9cb7f) > > Target: x86_64-unknown-linux-gnu > > Thread model: posix > > InstalledDir: /p/tllvm/bin > > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 > > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 > > Candidate multilib: .;@m64 > > Candidate multilib: 32;@m32 > > Selected multilib: .;@m64 > > (in-process) > > "/p/tllvm/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu > > -emit-obj -mrelax-all -disable-free -disable-llvm-verifier > > -discard-value-names -main-file-name compare.pass.cpp > > -mrelocation-model static -mthread-model posix -mframe-pointer=all > > -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables > > -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining > > -debugger-tuning=gdb -v -nostdinc++ -resource-dir > > /p/tllvm/lib64/clang/11.0.0 -include > > /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I > > /home/dave/s/lp/libcxx/include -I > > /tmp/_update_lc/t/projects/libcxx/include/c++build -D > > __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS > > -I /home/dave/s/lp/libcxx/test/support -D > > _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem > > /usr/local/include -internal-isystem > > /p/tllvm/lib64/clang/11.0.0/include -internal-externc-isystem /include > > -internal-externc-isystem /usr/include -Werror=thread-safety -Wall > > -Wextra -Werror -Wuser-defined-warnings -Wshadow > > -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move > > -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type > > -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code > > -std=c++2a -fdeprecated-macro -fdebug-compilation-dir > > > /tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t > -ftemplate-depth 270 -ferror-limit 19 -fgnuc-version=4.2.1 > -fno-implicit-modules -fcxx-exceptions -fexceptions -faddrsig -o > /tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o > -x c++ > /home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp > > clang -cc1 version 11.0.0 based upon LLVM 11.0.0git default target > > x86_64-unknown-linux-gnu > > ignoring nonexistent directory "/include" > > #include "..." search starts here: > > #include <...> search starts here: > > /home/dave/s/lp/libcxx/include > > /tmp/_up
Re: [libcxx-dev] [clang] 4ede887 - PR45402: Make the restrictions on constant evaluation of memcmp and
Hi Richard, I'm going to commit a narrow fix to clang to make the libcxx test suite pass again by allowing char8_t again. If you feel that this is the wrong long-term solution, please help the libcxx folks with whatever adjustments they need. Thanks! Dave On Sat, Apr 4, 2020, at 9:55 AM, David Zarzycki via libcxx-dev wrote: > Hi Richard, > > This breaks libcxx. Can we please revert this or is a quick fix to > libcxx possible? > > > FAIL: libc++ :: > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp > (58624 of 62672) > TEST 'libc++ :: > std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp' > FAILED > Command: ['/p/tllvm/bin/clang++', '-o', > '/tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o', > '-x', 'c++', > '/home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp', > '-c', '-v', '-Werror=thread-safety', '-std=c++2a', '-include', > '/home/dave/s/lp/libcxx/test/support/nasty_macros.h', '-nostdinc++', > '-I/home/dave/s/lp/libcxx/include', > '-I/tmp/_update_lc/t/projects/libcxx/include/c++build', > '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', > '-D__STDC_CONSTANT_MACROS', '-I/home/dave/s/lp/libcxx/test/support', > '-ftemplate-depth=270', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', > '-Wextra', '-Werror', '-Wuser-defined-warnings', '-Wshadow', > '-Wno-unused-command-line-argument', '-Wno-attributes', > '-Wno-pessimizing-move', '-Wno-c++11-extensions', > '-Wno-user-defined-literals', '-Wno-noexcept-type', '-Wsign-compare', > '-Wunused-variable', '-Wunused-parameter', '-Wunreachable-code', '-c'] > Exit Code: 1 > Standard Error: > -- > clang version 11.0.0 (https://github.com/llvm/llvm-project.git > 22127da8f17c03c69231f3631472f7f99ad9cb7f) > Target: x86_64-unknown-linux-gnu > Thread model: posix > InstalledDir: /p/tllvm/bin > Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 > Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/9 > Candidate multilib: .;@m64 > Candidate multilib: 32;@m32 > Selected multilib: .;@m64 > (in-process) > "/p/tllvm/bin/clang-11" -cc1 -triple x86_64-unknown-linux-gnu > -emit-obj -mrelax-all -disable-free -disable-llvm-verifier > -discard-value-names -main-file-name compare.pass.cpp > -mrelocation-model static -mthread-model posix -mframe-pointer=all > -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables > -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining > -debugger-tuning=gdb -v -nostdinc++ -resource-dir > /p/tllvm/lib64/clang/11.0.0 -include > /home/dave/s/lp/libcxx/test/support/nasty_macros.h -I > /home/dave/s/lp/libcxx/include -I > /tmp/_update_lc/t/projects/libcxx/include/c++build -D > __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS > -I /home/dave/s/lp/libcxx/test/support -D > _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem > /usr/local/include -internal-isystem > /p/tllvm/lib64/clang/11.0.0/include -internal-externc-isystem /include > -internal-externc-isystem /usr/include -Werror=thread-safety -Wall > -Wextra -Werror -Wuser-defined-warnings -Wshadow > -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move > -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type > -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code > -std=c++2a -fdeprecated-macro -fdebug-compilation-dir > /tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t > -ftemplate-depth 270 -ferror-limit 19 -fgnuc-version=4.2.1 > -fno-implicit-modules -fcxx-exceptions -fexceptions -faddrsig -o > /tmp/_update_lc/t/projects/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/Output/compare.pass.cpp.o > -x c++ > /home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp > clang -cc1 version 11.0.0 based upon LLVM 11.0.0git default target > x86_64-unknown-linux-gnu > ignoring nonexistent directory "/include" > #include "..." search starts here: > #include <...> search starts here: > /home/dave/s/lp/libcxx/include > /tmp/_update_lc/t/projects/libcxx/include/c++build > /home/dave/s/lp/libcxx/test/support > /usr/local/include > /p/tllvm/lib64/clang/11.0.0/include > /usr/include > End of search list. > /home/dave/s/lp/libcxx/test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char8_t/compare.pass.cpp:53:19: > error: static_assert expression is not an integral constant expression > static_assert(test_constexpr(), "" ); > ^~~~ > /home/dave/