This is an archive of the discontinued LLVM Phabricator instance.

[Fortran/gfortran] support environment flags in compile tests
ClosedPublic

Authored by tblah on Jul 17 2023, 9:05 AM.

Details

Summary

Adding extra flags to compile tests is useful for testing out new
features (e.g. -flang-experimental-hlfir) or increasing test coverage
(e.g. running optimisation passes).

Diff Detail

Repository
rT test-suite

Event Timeline

tblah created this revision.Jul 17 2023, 9:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:05 AM
tblah requested review of this revision.Jul 17 2023, 9:05 AM
tarunprabhu requested changes to this revision.Jul 17 2023, 10:41 AM
tarunprabhu added inline comments.
Fortran/gfortran/CMakeLists.txt
346

Instead of creating a separate env_fflags variable, it is probably better to add it to the fflags variable. That was what that local variable was intended for. Thanks for fixing the oversight.

It'll have to be added in 4 places:

  • gfortran_add_compile_tests_from_tests
  • gfortran_add_compile_tests
  • gfortran_add_execute_tests_from_tests
  • gfortran_add_execute_tests
This revision now requires changes to proceed.Jul 17 2023, 10:41 AM
tblah updated this revision to Diff 541497.Jul 18 2023, 6:20 AM

Append to fflags

tblah added inline comments.Jul 18 2023, 6:23 AM
Fortran/gfortran/CMakeLists.txt
346

Thanks for taking a look

I think I still have to define env_fflags so that fflags is not overwritten. But I now append to fflags in the next line.

Thanks for the pointers. gfortran_add_compile_tests* both call gfortran_add_compile_test, where my change is so those are both covered.

gfortran_add_execute_tests* compile using a cmake generated rule. CMake already respects CMAKE_Fortran_FLAGS: https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_FLAGS.html

tarunprabhu accepted this revision.Jul 18 2023, 6:31 AM

Thanks for the changes. LGTM.

This revision is now accepted and ready to land.Jul 18 2023, 6:31 AM
tblah updated this revision to Diff 543503.Jul 24 2023, 6:12 AM

Bugfix. Appologies for the mistake and the delay fixing it - I've been
ill for a few days.