This is an archive of the discontinued LLVM Phabricator instance.

[flang] Force the use of intrinsic builtins in type_info
ClosedPublic

Authored by luporl on Jul 4 2023, 9:08 AM.

Details

Summary

This ensures that the __Fortran_builtins module is always used
as an intrinsic module by __Fortran_type_info, which avoids issues
when, for instance, the intrinsic modules dir is present in the
include paths.

Fixes https://github.com/llvm/llvm-project/issues/63592

Diff Detail

Event Timeline

luporl created this revision.Jul 4 2023, 9:08 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 4 2023, 9:08 AM
Herald added a subscriber: sunshaoce. · View Herald Transcript
luporl requested review of this revision.Jul 4 2023, 9:08 AM
luporl edited the summary of this revision. (Show Details)Jul 4 2023, 9:09 AM

Make sure that everything builds with this change even with completely clean build and install directories. The use of "intrinsic" in USE statements in intrinsic modules is problematic when building intrinsic modules, since they depend on intrinsic modules that haven't been built and installed yet.

Everything built fine, even after removing build and install directories.

I guess it's because __fortran_builtins.mod is set as a dependency of __fortran_type_info in flang/tools/f18/CMakeLists.txt.

Everything built fine, even after removing build and install directories.

I guess it's because __fortran_builtins.mod is set as a dependency of __fortran_type_info in flang/tools/f18/CMakeLists.txt.

How does semantics find the module fortran_builtins.mod as an intrinsic module while building fortran_type_info, when there are no intrinsic modules installed anywhere yet?

luporl added a comment.Jul 5 2023, 1:56 PM

Everything built fine, even after removing build and install directories.

I guess it's because __fortran_builtins.mod is set as a dependency of __fortran_type_info in flang/tools/f18/CMakeLists.txt.

How does semantics find the module fortran_builtins.mod as an intrinsic module while building fortran_type_info, when there are no intrinsic modules installed anywhere yet?

I haven't debugged semantics to confirm it, but it seems __fortran_builtins.mod is found because of the -module-dir flag. This is the command line used to build __fortran_type_info:

/home/leandro.lupori/git/flang-luporl/buildr/bin/flang-new -cpp -fsyntax-only -module-dir /home/leandro.lupori/git/flang-luporl/buildr/include/flang /home/leandro.lupori/git/flang-luporl/llvm-project/flang/module/__fortran_type_info.f90

klausler accepted this revision.Jul 5 2023, 2:00 PM
This revision is now accepted and ready to land.Jul 5 2023, 2:00 PM
This revision was automatically updated to reflect the committed changes.