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

flang 15 fails to build on i386 with error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] #59845

Open
sylvestre opened this issue Jan 5, 2023 · 6 comments
Labels
build-problem cmake Build system in general and CMake in particular documentation flang Flang issues not falling into any other category

Comments

@sylvestre
Copy link
Collaborator

sylvestre commented Jan 5, 2023

On Debian unstable:

/<<PKGBUILDDIR>>/build-llvm/./bin/clang++ -DFLANG_LITTLE_ENDIAN=1 -DFLANG_VENDOR="\"Debian \"" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/flang/lib/Evaluate -I/<<PKGBUILDDIR>>/flang/lib/Evaluate -I/<<PKGBUILDDIR>>/flang/include -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/flang/include -I/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/include -I/<<PKGBUILDDIR>>/llvm/include -isystem /<<PKGBUILDDIR>>/llvm/../mlir/include -isystem /<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/mlir/include -isystem /<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins/tools/clang/include -isystem /<<PKGBUILDDIR>>/llvm/../clang/include -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fno-semantic-interposition -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 -ffile-prefix-map=/<<PKGBUILDDIR>>/build-llvm/tools/clang/stage2-bins=build-llvm/tools/clang/stage2-bins -ffile-prefix-map=/<<PKGBUILDDIR>>/= -no-canonical-prefixes -Wno-deprecated-copy -Wno-string-conversion -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG  -fno-exceptions -std=c++17 -MD -MT tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o -MF tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o.d -o tools/flang/lib/Evaluate/CMakeFiles/obj.FortranEvaluate.dir/constant.cpp.o -c /<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp
/<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp:296:30: error: non-constant-expression cannot be narrowed from type 'long long' to 'std::size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
    std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp:367:1: note: in instantiation of member function 'Fortran::evaluate::Constant<Fortran::evaluate::Type<TypeCategory::Character, 1>>::CopyFrom' requested here
INSTANTIATE_CONSTANT_TEMPLATES
^
/<<PKGBUILDDIR>>/flang/include/flang/Evaluate/constant.h:239:42: note: expanded from macro 'INSTANTIATE_CONSTANT_TEMPLATES'
  FOR_EACH_INTRINSIC_KIND(template class Constant, )
                                         ^
/<<PKGBUILDDIR>>/flang/lib/Evaluate/constant.cpp:296:30: note: insert an explicit cast to silence this issue
    std::size_t elementBytes{length_ * sizeof(decltype(values_[0]))};
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                             static_cast<size_t>(                  )
@sylvestre sylvestre added the flang Flang issues not falling into any other category label Jan 5, 2023
@kiranchandramohan
Copy link
Contributor

Flang is not supported on 32-bit machines.

@kiranchandramohan kiranchandramohan closed this as not planned Won't fix, can't repro, duplicate, stale Jan 6, 2023
@sylvestre
Copy link
Collaborator Author

@kiranchandramohan ok, is that documented somewhere? thanks

@kiranchandramohan
Copy link
Contributor

@sylvestre Flang is not yet ready for users to try out. It is still a Work in Progress. So we have not documented this. The section (https://github.com/llvm/llvm-project/tree/main/flang#supported-c-compilers) lists the supported compilers and the platforms listed there are all 64 bit.
Would you like this to be documented somewhere? If so, do you have a suggestion on where it should be?

@sylvestre
Copy link
Collaborator Author

@kiranchandramohan I proposed this: https://reviews.llvm.org/D141126

also, cmake should refuse to built flang on 32 bits CPU. OK if i propose a patch to implement this?
thanks

@kiranchandramohan
Copy link
Contributor

This might need a discussion, could you post in flang discourse or create a patch and I can add reviewers?

@EugeneZelenko EugeneZelenko reopened this Jan 6, 2023
@EugeneZelenko EugeneZelenko added documentation cmake Build system in general and CMake in particular labels Jan 6, 2023
@sylvestre
Copy link
Collaborator Author

for the cmake thing:
https://reviews.llvm.org/D141132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem cmake Build system in general and CMake in particular documentation flang Flang issues not falling into any other category
Projects
None yet
Development

No branches or pull requests

3 participants