llvm-project/flang/test/Semantics/resolve26.f90

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
401 B
Fortran
Raw Normal View History

! RUN: %S/test_errors.sh %s %t %f18
module m1
interface
module subroutine s()
end subroutine
end interface
end
module m2
interface
module subroutine s()
end subroutine
end interface
end
submodule(m1) s1
end
[flang] Improve module file reading and writing Fix problems with writing a mod file while another compilation is reading or writing. Write to a temp and then rename it: - compute the new contents of the .mod file - if it already exists, check if it is already correct - if not, write new contents to a temp file - rename the temp to the final destination `mkstemps()` seems to be the best way to create the temp file. It returns a file descriptor, so change the rest of the mod file writing to use POSIX open/read/write/close. This seems to set errno more reliably too. There is some extra work around creating the temp to make it have the same directory and suffix as the final file (so that if one gets left behind by a crash, "rm *.mod" still cleans it up). `mkstemps()` creates file with 0600 permissions so try to change it to what it would have been if we just wrote the file. Change module file reading to only read the file once; we used to read it to verify the checksum and then again to parse it. Instead, change `Parsing` so that we can get the file contents after `Prescan()` and use that to verify the checksum. Also, it has a mechanism for searching directories for files, so make use of that instead of duplicating that functionality in `ModFileReader`. This requires some changes to how errors are returned so they can be reported in the right place. Original-commit: flang-compiler/f18@d0d54971a5547820f8ed0271eb9818557bc8bc82 Reviewed-on: https://github.com/flang-compiler/f18/pull/758 Tree-same-pre-rewrite: false
2019-09-24 08:10:58 +08:00
!ERROR: Error reading module file for submodule 's1' of module 'm2'
submodule(m2:s1) s2
end
[flang] Improve module file reading and writing Fix problems with writing a mod file while another compilation is reading or writing. Write to a temp and then rename it: - compute the new contents of the .mod file - if it already exists, check if it is already correct - if not, write new contents to a temp file - rename the temp to the final destination `mkstemps()` seems to be the best way to create the temp file. It returns a file descriptor, so change the rest of the mod file writing to use POSIX open/read/write/close. This seems to set errno more reliably too. There is some extra work around creating the temp to make it have the same directory and suffix as the final file (so that if one gets left behind by a crash, "rm *.mod" still cleans it up). `mkstemps()` creates file with 0600 permissions so try to change it to what it would have been if we just wrote the file. Change module file reading to only read the file once; we used to read it to verify the checksum and then again to parse it. Instead, change `Parsing` so that we can get the file contents after `Prescan()` and use that to verify the checksum. Also, it has a mechanism for searching directories for files, so make use of that instead of duplicating that functionality in `ModFileReader`. This requires some changes to how errors are returned so they can be reported in the right place. Original-commit: flang-compiler/f18@d0d54971a5547820f8ed0271eb9818557bc8bc82 Reviewed-on: https://github.com/flang-compiler/f18/pull/758 Tree-same-pre-rewrite: false
2019-09-24 08:10:58 +08:00
!ERROR: Error reading module file for module 'm3'
submodule(m3:s1) s3
end