[PATCH] D97724: [flang][driver] Fix -fdefault* family bug
Arnamoy B via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 06:25:37 PST 2021
arnamoy10 updated this revision to Diff 327432.
arnamoy10 added a comment.
Taken out `-module` related changes, updated the commit message as well.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97724/new/
https://reviews.llvm.org/D97724
Files:
flang/tools/f18/f18.cpp
Index: flang/tools/f18/f18.cpp
===================================================================
--- flang/tools/f18/f18.cpp
+++ flang/tools/f18/f18.cpp
@@ -102,6 +102,7 @@
bool dumpSymbols{false};
bool debugNoSemantics{false};
bool debugModuleWriter{false};
+ bool defaultReal8{false};
bool measureTree{false};
bool unparseTypedExprsToF18_FC{false};
std::vector<std::string> F18_FCArgs;
@@ -563,10 +564,22 @@
}
} else if (arg.substr(0, 2) == "-U") {
predefinitions.emplace_back(arg.substr(2), std::optional<std::string>{});
- } else if (arg == "-fdefault-double-8") {
- defaultKinds.set_defaultRealKind(4);
} else if (arg == "-r8" || arg == "-fdefault-real-8") {
+ driver.defaultReal8 = true;
defaultKinds.set_defaultRealKind(8);
+ defaultKinds.set_doublePrecisionKind(16);
+ } else if (arg == "-fdefault-double-8") {
+ if (!driver.defaultReal8) {
+ // -fdefault-double-8 has to be used with -fdefault-real-8
+ // to be compatible with gfortran
+ llvm::errs() << "Use of `-fdefault-double-8` requires `-fdefault-real-8`\n";
+ return EXIT_FAILURE;
+ }
+ // For -fdefault-double-8 + -fdefault-real-8, only the size of
+ // DOUBLE PRECISION type changes, the size of default real type stays
+ // the same
+ // https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html
+ defaultKinds.set_doublePrecisionKind(8);
} else if (arg == "-i8" || arg == "-fdefault-integer-8") {
defaultKinds.set_defaultIntegerKind(8);
defaultKinds.set_subscriptIntegerKind(8);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97724.327432.patch
Type: text/x-patch
Size: 1616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210302/70b604fe/attachment.bin>
More information about the llvm-commits
mailing list