Add support for the following f18 options:
-fintrinsic-modules-path
Also the following changes:
- Create a new test case
- Adding dummy module files in the test directory
Depends on : D98522
Differential D97080
[flang][driver] Add -fintrinsic-modules-path option arnamoy10 on Feb 19 2021, 12:47 PM. Authored by
Details Add support for the following f18 options: -fintrinsic-modules-path Also the following changes:
Depends on : D98522
Diff Detail
Unit Tests
Event TimelineComment Actions Hi @arnamoy10 , thanks for the patch! Both ieee_arithmetic.mod and iso_fortran_env.mod look like copies of similar files from <build-dir>/tools/flang/include/flang. Could you either re-use those or add something custom?
Comment Actions Addressing comments, by separating the search directories from fintrinsic-modules-path in a separate variables. Also added dummy modules for the test case, as using %llvmshlibdir did not work out. Also, not sure what to set as the default directory, as gfortran uses a specific installation location. Comment Actions We probably should use a location relative to the flang-new binary, i.e. <flang-new-path>/../tools/flang/include/flang/. Question: What are the semantics for this flag in gfortran? Is the path specified with -fintrinsics-module-path _prepended_ or _appended_ to the default search path? Comment Actions I believe that it is _prepended_. Take this dummy module: module ieee_arithmetic type::ieee_round_type integer(1),private::mode=0_2 end type end Compile it with e.g. flang-new: flang-new -fc1 -fsyntax-only dummy-module.f90 Next, take this Fortran file: program test use ieee_arithmetic implicit none real(kind=4) :: x1 if (.not. ieee_support_nan(x1)) STOP 20 end program test And try compiling it with gfortran: mv ieee_arithmetic.mod tools/flang/ gfortran -fintrinsic-modules-path tools/flang/ test.f90 test.f90:2:6: use ieee_arithmetic 1 Fatal Error: File ‘ieee_arithmetic.mod’ opened at (1) is not a GNU Fortran module file compilation terminated. So gfortran did look in tools/flang first, i.e. the path specified with -fintrinsic-modules-path. Comment Actions Thank you so much for this experiment @awarzynski . I will modify the code accordingly. Comment Actions
Comment Actions Thank you for updating this @arnamoy10 !
Comment Actions Modifying the algo of default search path extraction for supporting Windows platforms.
Comment Actions I tried reproducing the CI failures reported at the top (in particular intrinsic_module_path.f90), but haven't had much luck. @arnamoy10 - how about you? Could you clang-format this patch when uploading the next diff? Thank you!
Comment Actions Clang-formatting and addressing reviewers' comments: Moved the default directory append to setFortranOpts()
Comment Actions Using llvm::sys::path::remove_filename as per suggestion.
Comment Actions Addressing reviewers' comments
Comment Actions LGTM, thank you for working on this! In the summary you refer to -fdebug-module-writer. Could you please update before merging this?
|
Why not copy this from gfortran?