Skip to content

[flang 19]: error: 'CHECK_MSG' was not declared in this scope #114703

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

Closed
ivan-aksamentov opened this issue Nov 3, 2024 · 2 comments · Fixed by #114707
Closed

[flang 19]: error: 'CHECK_MSG' was not declared in this scope #114703

ivan-aksamentov opened this issue Nov 3, 2024 · 2 comments · Fixed by #114707
Labels
build-problem flang Flang issues not falling into any other category

Comments

@ivan-aksamentov
Copy link
Contributor

ivan-aksamentov commented Nov 3, 2024

When building LLVM 19.1.3 with flang project enabled, I am receiving errors in places where CHECK_MSG macro is used:

error: 'CHECK_MSG' was not declared in this scope

The 18.1.8 builds fine.

My cmake config:

cmake -S llvm -B "build" \
      -Wno-dev -Wno-deprecated \
      -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
      -DCMAKE_BUILD_TYPE="MinSizeRel" \
      -DCMAKE_COLOR_MAKEFILE="OFF" \
      -DCMAKE_VERBOSE_MAKEFILE="OFF" \
      -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;flang;lld;lldb" \
      -DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM" \
      -DLLVM_STATIC_LINK_CXX_STDLIB="ON" \
      \
      -DLLVM_INSTALL_TOOLCHAIN_ONLY="ON" \
      \
      -DLLVM_BUILD_TOOLS="ON" \
      -DLLVM_INCLUDE_TOOLS="ON" \
      -DLLVM_INSTALL_TOOLS="ON" \
      -DLLVM_TOOLS_INSTALL_DIR="bin" \
      \
      -DCLANG_BUILD_TOOLS="ON" \
      -DCLANG_INCLUDE_TOOLS="ON" \
      -DCLANG_INSTALL_TOOLS="ON" \
      -DCLANG_PLUGIN_SUPPORT="ON" \
      \
      -DLLVM_BUILD_RUNTIME="ON" \
      -DLLVM_ENABLE_FFI="ON" \
      -DLLVM_ENABLE_RTTI="ON" \
      -DLLVM_ENABLE_THREADS="ON" \
      -DLLVM_ENABLE_ZLIB="ON" \
      -DLLVM_ENABLE_ZSTD="ON" \
      -DLLVM_USE_PERF="ON" \
      \
      -DLLVM_BINUTILS_INCDIR="/usr/include" \
      \
      -DLLVM_ENABLE_BINDINGS="OFF" \
      -DLLVM_INCLUDE_BENCHMARKS="OFF" \
      -DLLVM_INCLUDE_DOCS="OFF" \
      -DLLVM_INCLUDE_EXAMPLES="OFF" \
      -DLLVM_INCLUDE_TESTS="OFF" \
      -DLLVM_INCLUDE_UTILS="OFF" \
      -DLLVM_INSTALL_BENCHMARKS="OFF" \
      -DLLVM_INSTALL_DOCS="OFF" \
      -DLLVM_INSTALL_EXAMPLES="OFF" \
      -DLLVM_INSTALL_TESTS="OFF" \
      -DLLVM_INSTALL_UTILS="OFF" \

My system:

OS: quay.io/pypa/manylinux2014_x86_64 (based on CentOS 7)
GCC 14.2.0
CMake 3.31.0

Full log: build.log

Relevant snippet (click to expand)
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In member function 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:3: error: there are no arguments to 'CHECK_MSG' that depend on a template parameter, so a declaration of 'CHECK_MSG' must be available [-fpermissive]
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ^~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:3: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Integer, 1>; ELEMENT = Fortran::evaluate::value::Integer<8>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Integer, 2>; ELEMENT = Fortran::evaluate::value::Integer<16>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Integer, 4>; ELEMENT = Fortran::evaluate::value::Integer<32>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Integer, 8>; ELEMENT = Fortran::evaluate::value::Integer<64>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Integer, 16>; ELEMENT = Fortran::evaluate::value::Integer<128>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, 2>; ELEMENT = Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<16>, 11>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, 3>; ELEMENT = Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<16>, 8>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, 4>; ELEMENT = Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<32>, 24>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, 8>; ELEMENT = Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<64>, 53>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, 10>; ELEMENT = Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<80, true, 16, short unsigned int, unsigned int, 128>, 64>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Real, 16>; ELEMENT = Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<128>, 113>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex, 2>; ELEMENT = Fortran::evaluate::value::Complex<Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<16>, 11> >; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex, 3>; ELEMENT = Fortran::evaluate::value::Complex<Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<16>, 8> >; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex, 4>; ELEMENT = Fortran::evaluate::value::Complex<Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<32>, 24> >; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex, 8>; ELEMENT = Fortran::evaluate::value::Complex<Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<64>, 53> >; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex, 10>; ELEMENT = Fortran::evaluate::value::Complex<Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<80, true, 16, short unsigned int, unsigned int, 128>, 64> >; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Complex, 16>; ELEMENT = Fortran::evaluate::value::Complex<Fortran::evaluate::value::Real<Fortran::evaluate::value::Integer<128>, 113> >; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Logical, 1>; ELEMENT = Fortran::evaluate::value::Logical<8>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Logical, 2>; ELEMENT = Fortran::evaluate::value::Logical<16>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Logical, 4>; ELEMENT = Fortran::evaluate::value::Logical<32>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::Type<Fortran::common::TypeCategory::Logical, 8>; ELEMENT = Fortran::evaluate::value::Logical<64>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  254 |   FOR_EACH_LENGTHLESS_INTRINSIC_KIND(template class ConstantBase, ) \
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp: In instantiation of 'std::vector<ELEMENT> Fortran::evaluate::ConstantBase<RESULT, ELEMENT>::Reshape(const Fortran::evaluate::ConstantSubscripts&) const [with RESULT = Fortran::evaluate::SomeKind<Fortran::common::TypeCategory::Derived>; ELEMENT = std::map<Fortran::common::Reference<const Fortran::semantics::Symbol>, Fortran::common::Indirection<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>, true>, Fortran::evaluate::ComponentCompare>; Fortran::evaluate::ConstantSubscripts = std::vector<long int>]':
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:399:1:   required from here
  255 |   template class ConstantBase<SomeDerived, StructureConstructorValues>; \
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workdir/.build/llvm-19.1.3/flang/lib/Evaluate/constant.cpp:163:12: error: 'CHECK_MSG' was not declared in this scope
  163 |   CHECK_MSG(optN, "Overflow in TotalElementCount");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gmake[2]: *** [tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o] Error 1
gmake[1]: *** [tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....

As suggested in

// For cheap assertions that should be applied in production.
// To disable, compile with '-DCHECK=(void)'
#ifndef CHECK
#define CHECK(x) ((x) || (DIE("CHECK(" #x ") failed"), false))
// Same as above, but with a custom error message.
#define CHECK_MSG(x, y) ((x) || (DIE("CHECK(" #x ") failed: " #y), false))
#endif
, i tried to compile with

export CFLAGS="-DCHECK='(void)' ${CFLAGS:-}"
export CXXFLAGS="-DCHECK='(void)' ${CXXFLAGS:-}"

but that did not help.

Context: #86576

CC: @ceseo

P.S. Appreciate your work on flang, folks! Can't wait to check out the latest version!

@github-actions github-actions bot added the flang Flang issues not falling into any other category label Nov 3, 2024
@ivan-aksamentov
Copy link
Contributor Author

ivan-aksamentov commented Nov 3, 2024

Attempted partial fix: #114707, but might need more work.

A patch file for those who hit this issue:
https://gist.github.com/ivan-aksamentov/93d0f05e8bb5309efd777a7d5fbc851d

@mgorny
Copy link
Member

mgorny commented Dec 22, 2024

I also see the problem, when building with GCC.

@mgorny mgorny closed this as completed in 2d3d62d Dec 25, 2024
github-actions bot pushed a commit to arm/arm-toolchain that referenced this issue Jan 10, 2025
Resolves llvm/llvm-project#114703

I think it's the best practice that each macro has it's own `ifndef`
check and this way the build issue is resolved for me.

I also find the names of these macro a bit too generic - an easy recipe
for conflicts. In my case, the error was likely caused by something else
defining `CHECK` but not `CHECK_MSG`, so likely these `CHECK` and
`CHECK_MSG` weren't actually working at all because the result of
`ifndef` is always false.

As a definitive fix, perhaps it makes sense to rename them to something
more specific, e.g. `FLANG_CHECK` and `FLANG_CHECK_MSG`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants