flang-compiler / classic-flang-llvm-project Goto Github PK
View Code? Open in Web Editor NEWLLVM monorepo for integration with classic flang
License: Other
LLVM monorepo for integration with classic flang
License: Other
With release_15x and -DLLVM_ENABLE_CLASSIC_FLANG=ON
I get the following build error:
classic-flang-llvm-project | /classic-flang-llvm-project/src/classic-flang-llvm-project/flang/lib/Frontend/CompilerInvocation.cpp:348:51: error: no member named 'OPT_ffixed_line_length_EQ' in namespace 'clang::driver::options'; did you mean 'OPT_ffixed_line_length_VALUE'?
classic-flang-llvm-project | args.getLastArg(clang::driver::options::OPT_ffixed_line_length_EQ)) {
classic-flang-llvm-project | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
classic-flang-llvm-project | OPT_ffixed_line_length_VALUE
classic-flang-llvm-project | /classic-flang-llvm-project/build/tools/clang/include/clang/Driver/Options.inc:1080:1: note: 'OPT_ffixed_line_length_VALUE' declared here
classic-flang-llvm-project | OPTION(prefix_1, &"-ffixed-line-length-"[1], ffixed_line_length_VALUE, Joined, gfortran_Group, INVALID, nullptr, FC1Option | FlangOption | FlangOnlyOption, 0,
classic-flang-llvm-project | ^
classic-flang-llvm-project | /classic-flang-llvm-project/src/classic-flang-llvm-project/llvm/../clang/include/clang/Driver/Options.h:47:3: note: expanded from macro 'OPTION'
classic-flang-llvm-project | OPT_##ID,
classic-flang-llvm-project | ^
classic-flang-llvm-project | <scratch space>:90:1: note: expanded from here
classic-flang-llvm-project | OPT_ffixed_line_length_VALUE
classic-flang-llvm-project | ^
classic-flang-llvm-project | /classic-flang-llvm-project/src/classic-flang-llvm-project/flang/lib/Frontend/CompilerInvocation.cpp:382:44: error: no member named 'OPT_flogical_abbreviations' in namespace 'clang::driver::options'
classic-flang-llvm-project | args.hasFlag(clang::driver::options::OPT_flogical_abbreviations,
classic-flang-llvm-project | ~~~~~~~~~~~~~~~~~~~~~~~~^
classic-flang-llvm-project | /classic-flang-llvm-project/src/classic-flang-llvm-project/flang/lib/Frontend/CompilerInvocation.cpp:383:35: error: no member named 'OPT_fno_logical_abbreviations' in namespace 'clang::driver::options'
classic-flang-llvm-project | clang::driver::options::OPT_fno_logical_abbreviations, false));
classic-flang-llvm-project | ~~~~~~~~~~~~~~~~~~~~~~~~^
classic-flang-llvm-project | /classic-flang-llvm-project/src/classic-flang-llvm-project/flang/lib/Frontend/CompilerInvocation.cpp:387:44: error: no member named 'OPT_fxor_operator' in namespace 'clang::driver::options'
classic-flang-llvm-project | args.hasFlag(clang::driver::options::OPT_fxor_operator,
classic-flang-llvm-project | ~~~~~~~~~~~~~~~~~~~~~~~~^
classic-flang-llvm-project | /classic-flang-llvm-project/src/classic-flang-llvm-project/flang/lib/Frontend/CompilerInvocation.cpp:388:35: error: no member named 'OPT_fno_xor_operator' in namespace 'clang::driver::options'
classic-flang-llvm-project | clang::driver::options::OPT_fno_xor_operator, false));
classic-flang-llvm-project | ~~~~~~~~~~~~~~~~~~~~~~~~^
classic-flang-llvm-project | 5 errors generated.
Originally posted by @RichBarton-Arm in #106 (comment) :
Weird also how this block needs to be in the Clang driver and can't just be in ClassicFlang.cpp
The block in question is https://github.com/flang-compiler/classic-flang-llvm-project/blob/release_13x/clang/lib/Driver/ToolChains/Clang.cpp#L4754-L4806.
Windows pre-build-llvm and llvm tests workflow for x64 is already merged #149. Currently tests are disabled on Windows on ARM, since the following tests are failing on it using release_15x branch.
I managed to reproduce in official llvm-project on release/15.x as well. However they are gone in release/16.x.
I'm not sure it is worth to backport all related commits, but maybe mark them as 'Expectedly Failed' could be a good workaround until release_16x update.
@bryanpkc what do you think?
Clang :: Analysis/cxx-crashes.cpp
Clang :: CodeGen/2008-12-23-AsmIntPointerTie.c
Clang :: CodeGen/c-strings.c
Clang :: CodeGen/statements.c
Clang :: CodeGen/volatile-1.c
Clang :: CodeGenCXX/reinterpret-cast.cpp
Clang :: Driver/flang/flang.f90
Clang :: Driver/flang/flang_ucase.F90
Clang :: Driver/flang/multiple-inputs.f90
Clang :: Sema/array-init.c
Clang :: Sema/compound-literal.c
Clang :: SemaCXX/cstyle-cast.cpp
Clang :: SemaCXX/functional-cast.cpp
Clang :: SemaObjC/nonnull.m
Clang :: SemaObjCXX/pointer-to-objc-pointer-conv.mm
I suggest that the topics fortran-compiler
, fortran
be added in the About section.
Error:
[3577/3776] C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1431~1.311\bin\Hostx64\x64\cl.exe /TP -DENABLE_CLASSIC_FLANG -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\tools\flang\lib\Semantics -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\tools\flang\include -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\include -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\llvm\include -external:IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\llvm\..\mlir\include -external:IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\tools\mlir\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /MP /Zc:inline /Zc:__cplusplus /Zc:strictStrings /Oi /Zc:rvalueCast /bigobj /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /Gw /MT /O2 /Oi /Gy /DNDEBUG /Z7 /EHs-c- /GR- -std:c++17 /showIncludes /Fotools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\symbol.cpp.obj /Fdtools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\ /FS -c E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp
FAILED: tools/flang/lib/Semantics/CMakeFiles/obj.FortranSemantics.dir/symbol.cpp.obj
C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1431~1.311\bin\Hostx64\x64\cl.exe /TP -DENABLE_CLASSIC_FLANG -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\tools\flang\lib\Semantics -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\tools\flang\include -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\include -IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\llvm\include -external:IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\llvm\..\mlir\include -external:IE:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\x64-windows-static-rel\tools\mlir\include -external:W0 /nologo /DWIN32 /D_WINDOWS /utf-8 /MP /Zc:inline /Zc:__cplusplus /Zc:strictStrings /Oi /Zc:rvalueCast /bigobj /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /Gw /MT /O2 /Oi /Gy /DNDEBUG /Z7 /EHs-c- /GR- -std:c++17 /showIncludes /Fotools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\symbol.cpp.obj /Fdtools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\ /FS -c E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Evaluate/expression.h(639): warning C4099: 'Fortran::evaluate::Relational<Fortran::evaluate::SomeType>': type name first seen using 'class' now seen using 'struct'
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Evaluate/expression.h(621): note: see declaration of 'Fortran::evaluate::Relational<Fortran::evaluate::SomeType>'
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Semantics/symbol.h(675): warning C4099: 'std::array': type name first seen using 'class' now seen using 'struct'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\array(435): note: see declaration of 'std::array'
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp(261): error C2668: 'Fortran::semantics::Symbol::detailsIf': ambiguous call to overloaded function
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Semantics/symbol.h(538): note: could be 'const D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void) const'
with
[
D=Fortran::semantics::DerivedTypeDetails
]
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Semantics/symbol.h(537): note: or 'D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::DerivedTypeDetails>(void)'
with
[
D=Fortran::semantics::DerivedTypeDetails
]
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp(261): note: while trying to match the argument list '()'
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp(261): error C2119: 'derived': the type for 'const auto *' cannot be deduced from an empty initializer
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp(265): error C2668: 'Fortran::semantics::Symbol::detailsIf': ambiguous call to overloaded function
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Semantics/symbol.h(538): note: could be 'const D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::UseDetails>(void) const'
with
[
D=Fortran::semantics::UseDetails
]
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\include\flang/Semantics/symbol.h(537): note: or 'D *Fortran::semantics::Symbol::detailsIf<Fortran::semantics::UseDetails>(void)'
with
[
D=Fortran::semantics::UseDetails
]
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp(265): note: while trying to match the argument list '()'
E:\vcpkg_folders\flang\buildtrees\vcpkg-tool-flang-llvm\src\534c6fa875-ae76fc0161.clean\flang\lib\Semantics\symbol.cpp(265): error C2119: 'use': the type for 'const auto *' cannot be deduced from an empty initializer
That being said the release_13x branch builds fine but doesn't seem to have all changes from 12x.
Test case:
program foo
real(kind=8) :: val, res1, res2
read *, val
res1 = sin(val)
res2 = cos(val)
print *, res1, res2
end program foo
Command: flang -O1
Assertion:
$repo/classic-flang-llvm-project/llvm/lib/IR/Type.cpp:618: static llvm::FixedVectorType* llvm::FixedVectorType::get(llvm::Type*, unsigned int): Assertion `isValidElementType(ElementType) && "Element type of a VectorType must " "be an integer, floating point, or " "pointer type."' failed.
Clang has moved to DWARF 5 by default, should this be updated as well?
Originally posted by @guy-david in #106 (comment)
Hi all:
The following code snippet is for atomic function test. when using clang(https://github.com/llvm/llvm-project llvm12.0.1), this test passed. but it will failed when using classic-llvm-clang(https://github.com/flang-compiler/classic-flang-llvm-project tag flang_20211215_12x)
If we compile the code by classic-llvm-clang, this test will stucked and running forever.
clang test.c -o test
./test
#include <sys/types.h>
int main(void) {
long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 1))
return 1;
if (__sync_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
__sync_synchronize();;
return 0;
}
From the CI job (https://github.com/flang-compiler/classic-flang-llvm-project/actions/runs/7309478286/job/19992674439) for PR #170:
Failed Tests (2):
libomp :: affinity/kmp-affinity.c
libomp :: affinity/omp-places.c
Even though there have been recent changes to the CI workflows, this particular job as specified in .github/workflows/llvm-project-tests.yml
has not been updated. Comparing the failing run with a previous passing run (https://github.com/flang-compiler/classic-flang-llvm-project/actions/runs/6562896746/job/17825903837), it can be seen that both are using the ubuntu-latest
runner (Ubuntu 22.04.3), and running the same commands to build and test the compiler.
One noticeable difference between the two is that the passing run had only two threads available (llvm-lit reported -- Testing: 66155 tests, 2 workers --
), while the failing run had four threads on two cores. I suspect that the enablement of SMT on the runner, or the configuration of the Linux kernel on the runner, had somehow caused these tests to fail.
I propose to exclude these tests from the CI workflows for this repository.
Does flang build on MacOS currently? It looks like there has been work that has been recently merged. Does someone have the recipe for the M1 that works? I have tried following the instructions, so far without success.
I can get release_12x to compile using the apple compilers.
release_100 does not work
the subsequent build of libpgmath fails.
cant find llvm-lit and also aliasing complaints
Two regression tests are currently failing on the release_100 candidate (PR #1):
Failing Tests (2):
LLVM :: Assembler/invalid-diglobalvariable-empty-name.ll
LLVM :: Assembler/invalid-diglobalvariable-missing-name.ll
They are caused by the following commits:
Reverting these commits allow the regression tests to pass.
At -O3 -g
, Flang will generate a DIGlobalVariable
named _BLNK_
for an unnamed COMMON
block, so it is not clear to me why we need to allow an empty or missing name in a DIGlobalVariable
.
@schweitzpgi Do you have an example program that breaks without these commits?
When trying to compile a simple hello world fortran program causes below error:
warning: overriding the module target triple with x86_64-pc-windows-msvc19.29.30151 [-Woverride-module]
1 warning generated.
Microsoft (R) Incremental Linker Version 14.29.30151.0
Copyright (C) Microsoft Corporation. All rights reserved.LINK : warning LNK4044: unrecognized option '/lflang'; ignored
LINK : warning LNK4044: unrecognized option '/lflangrti'; ignored
LINK : warning LNK4044: unrecognized option '/lpgmath'; ignored
LINK : warning LNK4044: unrecognized option '/lpthread'; ignored
LINK : warning LNK4044: unrecognized option '/lrt'; ignored
test-ae5ad6.o : error LNK2019: unresolved external symbol fort_init referenced in function MAIN_
test-ae5ad6.o : error LNK2019: unresolved external symbol f90io_src_info03a referenced in function MAIN_
test-ae5ad6.o : error LNK2019: unresolved external symbol f90io_print_init referenced in function MAIN_
test-ae5ad6.o : error LNK2019: unresolved external symbol f90io_sc_ch_ldw referenced in function MAIN_
test-ae5ad6.o : error LNK2019: unresolved external symbol f90io_ldw_end referenced in function MAIN_
LINK : error LNK2001: unresolved external symbol mainCRTStartup
a.exe : fatal error LNK1120: 6 unresolved externals
flang: error: linker command failed with exit code 1120 (use -v to see invocation)
Branch : release_15x.
linker command :
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64\\link.exe" -out:a.exe "-libpath:C:\\Users\\test\\flang-compiler\\classic-flang-llvm-project\\build\\lib" -lflang -lflangrti -lpgmath -lpthread -lrt /subsystem:console -nologo "C:\\Users\\AMD\\AppData\\Local\\Temp\\test-7b4961.o"
Does classical-flang have full support on windows?
A regression has been encountered after the 2693fbaff2a67ccb64d8e6800e8d63cfc8180a4f commit when trying to compile libmbd (seehttps://github.com/libmbd/libmbd ):
[ 60%] Building Fortran object src/CMakeFiles/mbd.dir/mbd_methods.F90.o
cd src && flang -Dmbd_EXPORTS -Isrc -g -fPIC -c src/mbd_methods.F90 -o CMakeFiles/mbd.dir/mbd_methods.F90.o
Lowering Error: symbol freq$sd is an inconsistent array descriptor
Lowering Error: symbol freq$sd is an inconsistent array descriptor
F90-F-0000-Internal compiler error. Errors in Lowering 2 (src/mbd_methods.F90: 154)
F90/aarch64 Linux Flang F90 - 1.5 2017-05-01: compilation aborted
I feel puzzled about that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.