Ivan (email in CC) is working on porting the shell scripts (used for testing Flang) to Python. He has already ported one of the scripts and would like to test it on Windows. What is the best way to do this? And could you provide build instructions for building Flang on Windows?
If you prefer to not set up a Windows bot, you can also upload the patch to Phabricator (without reviewers added), the pre-merge bot will test the Windows flang build as well. Generally, when the python works on Linux, there are not that many differences on Windows. The main thing are the paths, which should not be a problem if using Python’s functions to manipulate paths.
For building on Windows yourself, you need the following things. I am using Chocolatey, so here are the packages you would need:
I’m getting the below warnings and errors upon using the above command. Any idea on this?
[2520/4214] Building CXX object tools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\expression.cpp.obj
C:\llvm\flang\lib\Semantics\expression.cpp(1390): warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied
C:\llvm\flang\lib\Semantics\expression.cpp(1390): note: while calling the constructor 'Fortran::semantics::Symbol::Symbol(const Fortran::semantics::Symbol &) noexcept(false)'
C:\llvm\flang\include\flang\Semantics\symbol.h(763): note: compiler has generated 'Fortran::semantics::Symbol::Symbol' here
[2563/4214] Building CXX object tools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\resolve-names.cpp.obj
C:\llvm\flang\lib\Semantics\resolve-names.cpp(3312): warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied
C:\llvm\flang\lib\Semantics\resolve-names.cpp(3312): note: while calling the constructor 'Fortran::semantics::Symbol::Symbol(const Fortran::semantics::Symbol &) noexcept(false)'
C:\llvm\flang\include\flang\Semantics\symbol.h(763): note: compiler has generated 'Fortran::semantics::Symbol::Symbol' here
C:\llvm\flang\lib\Semantics\resolve-names.cpp(2907) : warning C4715: '`Fortran::semantics::ModuleVisitor::DoAddUse'::`2'::<lambda_1>::operator()': not all control paths return a value
[3068/4214] Building CXX object tools\flang\lib\Semantics\CMakeFiles\obj.FortranSemantics.dir\semantics.cpp.obj
C:\llvm\flang\lib\Semantics\semantics.cpp(528): warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied
C:\llvm\flang\lib\Semantics\semantics.cpp(528): note: while calling the constructor 'Fortran::semantics::Symbol::Symbol(const Fortran::semantics::Symbol &) noexcept(false)'
C:\llvm\flang\include\flang\Semantics\symbol.h(763): note: compiler has generated 'Fortran::semantics::Symbol::Symbol' here
[3274/4214] Building CXX object tools\flang\lib\Optimizer\Dialect\CMakeFiles\obj.FIRDialect.dir\FIROps.cpp.obj
C:\llvm\build\tools\flang\include\flang/Optimizer/Dialect/CanonicalizationPatterns.inc(386): warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied
[3935/4214] Building CXX object tools\flang\lib\Evaluate\CMakeFiles\obj.FortranEvaluate.dir\fold-character.cpp.obj
C:\llvm\flang\lib\Evaluate\fold-implementation.h(1645): warning C4189: 'ctx': local variable is initialized but not referenced
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\type_traits(1556): note: see reference to function template instantiation 'Fortran::evaluate::Expr<Fortran::evaluate::Type<Fortran::common::TypeCategory::Character,1>> Fortran::evaluate::FoldOperation::<lambda_1>::operator ()<_First>(_T95 &) const' being compiled
with
[
_First=Fortran::evaluate::Expr<Fortran::evaluate::Type<Fortran::common::TypeCategory::Character,1>>,
_T95=Fortran::evaluate::Expr<Fortran::evaluate::Type<Fortran::common::TypeCategory::Character,1>>
]
....
[4213/4214] Running the Flang regression tests
llvm-lit.py: C:\llvm\llvm\utils\lit\lit\llvm\config.py:46: note: using lit tools: C:\Program Files\Git\usr\bin
llvm-lit.py: C:\llvm\llvm\utils\lit\lit\discovery.py:247: warning: test suite 'flang-OldUnit' contained no tests
-- Testing: 1864 tests, 4 workers --
Testing:
FAIL: Flang :: Driver/embed.f90 (31 of 1864)
******************** TEST 'Flang :: Driver/embed.f90' FAILED ********************
Script:
--
: 'RUN: at line 6'; c:\llvm\build\bin\flang-new.exe -fc1 -emit-llvm -o - -fembed-offload-object=C:\llvm\flang\test\Driver/Inputs/hello.f90 C:\llvm\flang\test\Driver\embed.f90 2>&1 | c:\llvm\build\bin\filecheck.exe C:\llvm\flang\test\Driver\embed.f90
: 'RUN: at line 8'; c:\llvm\build\bin\flang-new.exe -fc1 -emit-llvm-bc -o C:\llvm\build\tools\flang\test\Driver\Output\embed.f90.tmp.bc C:\llvm\flang\test\Driver\embed.f90 2>&1
: 'RUN: at line 9'; c:\llvm\build\bin\flang-new.exe -fc1 -emit-llvm -o - -fembed-offload-object=C:\llvm\flang\test\Driver/Inputs/hello.f90 C:\llvm\build\tools\flang\test\Driver\Output\embed.f90.tmp.bc 2>&1 | c:\llvm\build\bin\filecheck.exe C:\llvm\flang\test\Driver\embed.f90
--
Exit Code: 1
git status:
commit fb7c237ca0dbc6f85c532f73e60616d0e7db82df (HEAD -> main, origin/main, origin/HEAD)
Author: Joshua Cao <cao.joshua@yahoo.com>
Date: Mon May 15 20:28:40 2023 -0700
[SimpleLoopUnswitch] Skip trivial select conds for selects