aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorSlava Zakharin <szakharin@nvidia.com>2024-12-17 09:06:05 -0800
committerGitHub <noreply@github.com>2024-12-17 09:06:05 -0800
commit9d33874936d83b8ddf5d028d313d810214f00f20 (patch)
treedd5740665f0a8df78b577040e3ccfbfca4b5b4a7 /flang/lib/Frontend/CompilerInvocation.cpp
parent525c818f08e097cd123839b8d96a543e2c9da26e (diff)
downloadllvm-9d33874936d83b8ddf5d028d313d810214f00f20.zip
llvm-9d33874936d83b8ddf5d028d313d810214f00f20.tar.gz
llvm-9d33874936d83b8ddf5d028d313d810214f00f20.tar.bz2
[flang] Support -f[no-]realloc-lhs. (#120165)
-frealloc-lhs is the default. If -fno-realloc-lhs is specified, then an allocatable on the left side of an intrinsic assignment is not implicitly (re)allocated to conform with the right hand side. Fortran runtime will issue an error if there is a mismatch in shape/type/allocation-status.
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--flang/lib/Frontend/CompilerInvocation.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 648b88e..6ef4ee8 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1378,6 +1378,11 @@ bool CompilerInvocation::createFromArgs(
invoc.getDiagnosticOpts().Remarks.push_back(a->getValue());
}
+ // -frealloc-lhs is the default.
+ if (!args.hasFlag(clang::driver::options::OPT_frealloc_lhs,
+ clang::driver::options::OPT_fno_realloc_lhs, true))
+ invoc.loweringOpts.setReallocateLHS(false);
+
success &= parseFrontendArgs(invoc.getFrontendOpts(), args, diags);
parseTargetArgs(invoc.getTargetOpts(), args);
parsePreprocessorArgs(invoc.getPreprocessorOpts(), args);