Opened 3 years ago

Last modified 2 years ago

#63101 assigned defect

clang-12 @12.0.0: error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.7.99
Keywords: highsierra Cc: jeremyhu (Jeremy Huddleston Sequoia), cooljeanius (Eric Gallager)
Port: clang-12

Description

I can't build clang-12 on High Sierra (with the universal variant in case that's relevant):

.../llvm-project-12.0.0.src/flang/lib/Evaluate/constant.cpp:254:30: error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned long') in initializer list [-Wc++11-narrowing]
    std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Attachments (3)

main.log.bz2 (84.4 KB) - added by ryandesign (Ryan Carsten Schmidt) 3 years ago.
clang-12-compiled-with-clang-10.main.log.bz2 (21.5 KB) - added by ryandesign (Ryan Carsten Schmidt) 3 years ago.
clang-12-compiled-with-clang-11.main.log.bz2 (19.6 KB) - added by ryandesign (Ryan Carsten Schmidt) 3 years ago.

Download all attachments as: .zip

Change History (10)

Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Attachment: main.log.bz2 added

comment:1 Changed 3 years ago by kencu (Ken)

The same line did get past the buildbot I note, when the buildbot built it (non-universal).

<https://build.macports.org/builders/ports-10.13_x86_64-builder/builds/112699/steps/install-port/logs/stdio>

[ 33%] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o
cd /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/build/tools/flang/lib/Evaluate && /opt/local/bin/clang++-mp-9.0 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/build/tools/flang/lib/Evaluate -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/llvm-project-12.0.0.src/flang/lib/Evaluate -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/llvm-project-12.0.0.src/flang/include -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/build/tools/flang/include -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/build/include -I/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/llvm-project-12.0.0.src/llvm/include -isystem /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/llvm-project-12.0.0.src/llvm/../mlir/include -isystem /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/build/tools/mlir/include -pipe -Os -DNDEBUG -I/opt/local/include -stdlib=libc++ -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 -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG -arch x86_64 -mmacosx-version-min=10.13  -fno-exceptions -std=c++17 -o CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o -c /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_lang_llvm-12/clang-12/work/llvm-project-12.0.0.src/flang/lib/Evaluate/constant.cpp

The only differences I can see between your failing build line and the buildbot's succeeding one is:

  1. you use ccache (so do I, doubt it could be that).
  2. your universal build line has -arch i386 and -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE added

So it must be one of those I guess.

Would you have a moment to try with clang-11 or clang-10 and see if they work when building universal?

comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Yes, clang-10 and clang-11 build fine with the universal variant.

$ port -v installed name:clang-1
The following ports are currently installed:
  clang-10 @10.0.1_5+analyzer+libstdcxx+universal (active) requested_variants='+analyzer+libstdcxx+universal' platform='darwin 17' archs='i386 x86_64' date='2021-05-08T03:37:26-0500'
  clang-11 @11.1.0_3+analyzer+libstdcxx+universal (active) requested_variants='+analyzer+libstdcxx+universal' platform='darwin 17' archs='i386 x86_64' date='2021-06-16T06:13:18-0500'
  clang-12 @12.0.0_0+libstdcxx (active) requested_variants='-universal' platform='darwin 17' archs='x86_64' date='2021-06-16T06:31:22-0500'

comment:3 Changed 3 years ago by kencu (Ken)

Will clang-12 build universal if you use clang-11 or clang-10 to build it, instead of the current default of clang-9.0?

comment:4 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Even without universal, clang-12 won't build with clang-10:

llvm/include/llvm/Demangle/ItaniumDemangle.h:955:10: error: expression is not an integral constant expression
    case TemplateParamKind::Type:
         ^~~~~~~~~~~~~~~~~~~~~~~

Nor will it build with clang-11:

llvm/include/llvm/Demangle/ItaniumDemangle.h:116:8: error: ISO C++ forbids forward references to 'enum' types
  enum Kind : unsigned char {
       ^
llvm/include/llvm/Demangle/ItaniumDemangle.h:116:24: error: expected '(' for function-style cast or type construction
  enum Kind : unsigned char {
              ~~~~~~~~ ^
llvm/include/llvm/Demangle/ItaniumDemangle.h:116:13: error: field has incomplete type 'enum Kind'
  enum Kind : unsigned char {
            ^

Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

comment:5 Changed 3 years ago by kencu (Ken)

ugly then.

I don't have the c++ skills to fix. I can mark it as not having a universal variant of course, until such time as somebody like Marcus, Ionic, Landon, Josh, etc might get interested.

Upstream is never testing i386 builds on macOS, and has zero interest, so that's also a tough sell...

You know, even the x86_64 build can compile i386 code...it's only the clang libraries that need to be fat....otherwise we could just fake the universal, if you follow what I mean...

comment:6 Changed 3 years ago by kencu (Ken)

Owner: changed from kencu to macports-tickets@…

comment:7 Changed 2 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added
Note: See TracTickets for help on using tickets.