llvm-project/flang/test
Jean Perier 7dd7ccd224 [flang] Fail at link time if derived type descriptors were not generated
Currently, code generation was creating weak symbols for derived type
descriptor global it could not find in the current compilation unit.
The rational is that:
 - the derived type descriptors of external module derived types are
   generated in the compilation unit that compiled the module so that
   the type descriptor address is uniquely associated with the type.
 - some types do not have derived type descriptors: the builtin derived
   types used to create derived type descriptors. The runtime knows
   about them and does not need them to accomplish the feat of
   describing themselves. Hence, all unresolved derived type descriptors
   in codegen cannot be assumed to be resolved at link time.

However, this caused immense debugging pain when, for some reasons, derived
type descriptor that should be generated were not. This caused random
runtime failures instead of a much cleaner link time failure.

Improve this situation by allowing codegen to detect the builtin derived
types that have no derived type descriptors and requiring the other
unresolved derived type descriptor to be resolved at link time.

Also make derived type descriptor constant data since this was a TODO
and makes the situation even cleaner. This requiring telling lowering
which compiler created symbols can be placed in read only memory. I
considered using PARAMETER, but I have mixed feeling using it since that
would cause the initializer expressions of derived type descriptor to
be invalid from a Fortran point of view since pointer targets cannot be
parameters. I do not want to start misusing Fortran attributes, even if
I think it is quite unlikely semantics would currently complain. I also
do not want to rely on the fact that all object symbols with the
CompilerCreated flags are currently constant data. This could easily
change in the future and cause runtime bugs if lowering rely on this
while the assumption is not loud and clear in semantics.
Instead, add a ReadOnly symbol flag to tell lowering that a compiler
generated symbol can be placed in read only memory.

Differential Revision: https://reviews.llvm.org/D119555
2022-02-14 11:37:13 +01:00
..
Driver [flang][driver] Add support for `-emit-mlir` 2022-02-09 08:35:48 +00:00
Evaluate Folding in the front end was replacing calls to LEN and dropping 2022-02-09 16:50:28 -08:00
Examples [flang][flang-omp-report] Remove the loop workarounds for nowait clause 2021-11-04 14:23:50 +00:00
Fir [flang] Fail at link time if derived type descriptors were not generated 2022-02-14 11:37:13 +01:00
Frontend [flang] Make the frontend driver error out when requesting multiple actions 2021-12-17 10:05:28 +00:00
Lower [flang] Lower simple RETURN statement 2022-02-10 18:36:04 +01:00
NonGtestUnit [flang] Run non-gtest unit tests with lit. 2020-07-24 14:49:39 +01:00
Parser [flang] Catch mismatched parentheses in prescanner 2021-10-06 14:00:15 -07:00
Preprocessing [flang] Fix handling of space between # and name in preprocessor stringification 2022-01-12 16:02:17 -08:00
Runtime Reland "[flang] GET_COMMAND_ARGUMENT runtime implementation" 2021-09-28 12:34:07 +00:00
Semantics [flang] Fail at link time if derived type descriptors were not generated 2022-02-14 11:37:13 +01:00
Unit [flang] unit test support for out-of-tree and in-tree using google tests framework 2020-06-15 22:09:56 +05:30
CMakeLists.txt [flang] Initial lowering for empty program 2022-01-28 22:39:58 +01:00
lit.cfg.py [Flang] Replace notifyMatchFailure with TODO hard failures 2021-12-02 10:25:02 +00:00
lit.site.cfg.py.in [flang] Refine output file generation 2021-08-21 15:18:48 +00:00