Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Werror breaks toolchain compilation with clang #108

Open
j-stephan opened this issue Feb 5, 2021 · 4 comments
Open

-Werror breaks toolchain compilation with clang #108

j-stephan opened this issue Feb 5, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@j-stephan
Copy link
Member

In an attempt to work around #107 I tried to compile the toolchain with Ubuntu 20.04's default clang:

> clang --version
clang version 10.0.0-4ubuntu1 
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

I configured & ran the build system:

> CC=clang CXX=clang++ python buildbot/configure.py -t Release
> python buildbot/compile.py

Near the end of the compilation some warnings are triggered. Due to -Werror the build fails:

[2394/2587] Building CXX object tools/sycl/source/CMakeFiles/sycl_object.dir/backend/opencl.cpp.o
FAILED: tools/sycl/source/CMakeFiles/sycl_object.dir/backend/opencl.cpp.o 
/usr/bin/clang++ -DCL_TARGET_OPENCL_VERSION=220 -DXPTI_ENABLE_INSTRUMENTATION -DXPTI_STATIC_LIBRARY -D_DEBUG -D_GLIBCXX_ASSERTIONS=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/sycl/source -I/home/jan/sycl-workspace/sycl/sycl/source -Iinclude -I/home/jan/sycl-workspace/sycl/llvm/include -I/home/jan/sycl-workspace/sycl/xpti/include -I/home/jan/sycl-workspace/sycl/sycl/include -Itools/sycl/OpenCL/inc -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wextra -Wno-deprecated-declarations -Werror -O3  -UNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -Winstantiation-after-specialization -std=c++2a -MD -MT tools/sycl/source/CMakeFiles/sycl_object.dir/backend/opencl.cpp.o -MF tools/sycl/source/CMakeFiles/sycl_object.dir/backend/opencl.cpp.o.d -o tools/sycl/source/CMakeFiles/sycl_object.dir/backend/opencl.cpp.o -c /home/jan/sycl-workspace/sycl/sycl/source/backend/opencl.cpp

In file included from /home/jan/sycl-workspace/sycl/sycl/source/backend/opencl.cpp:10:
In file included from /home/jan/sycl-workspace/sycl/sycl/source/detail/platform_impl.hpp:14:
In file included from /home/jan/sycl-workspace/sycl/sycl/source/detail/platform_info.hpp:14:
In file included from /home/jan/sycl-workspace/sycl/sycl/source/detail/plugin.hpp:14:
/home/jan/sycl-workspace/sycl/sycl/source/detail/plugin_printers.hpp:120:14: error: unused parameter 'val' [-Werror,-Wunused-parameter]
  printOut(T val) {}
             ^
In file included from /home/jan/sycl-workspace/sycl/sycl/source/backend/opencl.cpp:12:
In file included from /home/jan/sycl-workspace/sycl/sycl/source/detail/program_impl.hpp:17:
In file included from /home/jan/sycl-workspace/sycl/sycl/source/detail/context_impl.hpp:17:
In file included from /home/jan/sycl-workspace/sycl/sycl/source/detail/device_impl.hpp:14:
/home/jan/sycl-workspace/sycl/sycl/source/detail/device_info.hpp:282:3: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
  default:
  ^
2 warnings and 2 errors generated.

(I removed some harmless warnings that are triggered by including cl_ext_intel.h.)

Let me know if I can do something to investigate or help.

@j-stephan j-stephan added the bug Something isn't working label Feb 5, 2021
@j-stephan
Copy link
Member Author

This is still an issue with clang 12, although the warning changed:

[11/146] Building CXX object tools/sycl/source/CMakeFiles/sycl_object.dir/detail/memory_manager.cpp.o
FAILED: tools/sycl/source/CMakeFiles/sycl_object.dir/detail/memory_manager.cpp.o 
/usr/bin/clang++ -DCL_TARGET_OPENCL_VERSION=220 -DSYCL2020_DISABLE_DEPRECATION_WARNINGS -DXPTI_ENABLE_INSTRUMENTATION -DXPTI_STATIC_LIBRARY -D_DEBUG -D_GLIBCXX_ASSERTIONS=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/jan/sycl-workspace/sycl/build/tools/sycl/source -I/home/jan/sycl-workspace/sycl/sycl/source -I/home/jan/sycl-workspace/sycl/build/include -I/home/jan/sycl-workspace/sycl/llvm/include -I/home/jan/sycl-workspace/sycl/xpti/include -I/home/jan/sycl-workspace/sycl/sycl/include -isystem /home/jan/sycl-workspace/sycl/build/_deps/ocl-headers-src -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wextra -Wno-deprecated-declarations -Werror -O3 -DNDEBUG -UNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden -Winstantiation-after-specialization -std=c++20 -MD -MT tools/sycl/source/CMakeFiles/sycl_object.dir/detail/memory_manager.cpp.o -MF tools/sycl/source/CMakeFiles/sycl_object.dir/detail/memory_manager.cpp.o.d -o tools/sycl/source/CMakeFiles/sycl_object.dir/detail/memory_manager.cpp.o -c /home/jan/sycl-workspace/sycl/sycl/source/detail/memory_manager.cpp
/home/jan/sycl-workspace/sycl/sycl/source/detail/memory_manager.cpp:29:21: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'const sycl::id<3>' and 'sycl::id<3>') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
  return (SrcOffset == sycl::id<3>{0, 0, 0}) && (SrcSize == DstAccessRange) &&
          ~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/jan/sycl-workspace/sycl/sycl/include/CL/sycl/detail/array.hpp:89:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
  bool operator==(const array<dimensions> &rhs) const {
       ^
/home/jan/sycl-workspace/sycl/sycl/source/detail/memory_manager.cpp:31:21: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'const sycl::id<3>' and 'const sycl::id<3>') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
         (SrcOffset == DstOffset);
          ~~~~~~~~~ ^  ~~~~~~~~~
/home/jan/sycl-workspace/sycl/sycl/include/CL/sycl/detail/array.hpp:89:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
  bool operator==(const array<dimensions> &rhs) const {
       ^
/home/jan/sycl-workspace/sycl/sycl/source/detail/memory_manager.cpp:548:18: error: ISO C++20 considers use of overloaded operator '!=' (with operand types 'sycl::id<3>' and 'sycl::id<3>') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
      (SrcOffset != sycl::id<3>{0, 0, 0} || DstOffset != sycl::id<3>{0, 0, 0} ||
       ~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/jan/sycl-workspace/sycl/sycl/include/CL/sycl/detail/array.hpp:89:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
  bool operator==(const array<dimensions> &rhs) const {
       ^
/home/jan/sycl-workspace/sycl/sycl/source/detail/memory_manager.cpp:548:55: error: ISO C++20 considers use of overloaded operator '!=' (with operand types 'sycl::id<3>' and 'sycl::id<3>') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
      (SrcOffset != sycl::id<3>{0, 0, 0} || DstOffset != sycl::id<3>{0, 0, 0} ||
                                            ~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
/home/jan/sycl-workspace/sycl/sycl/include/CL/sycl/detail/array.hpp:89:8: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
  bool operator==(const array<dimensions> &rhs) const {
       ^
4 errors generated.

@gogo2
Copy link
Contributor

gogo2 commented Oct 19, 2021

You can use --no-werror parameter with configure.py to suppress this. That's what I do.

I'm not a triSYCL/sycl dev, but I suppose they just don't care about this kind o warnings at this stage of development.

@j-stephan
Copy link
Member Author

Thanks, that helps.

@keryell
Copy link
Member

keryell commented Oct 19, 2021

I have seen that upstream they have removed some warnings when compiling with C++20. Perhaps there will be less warning after next merge from upstream. But not before CppCon 2021...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants