[PATCH] D96344: [flang][driver] Add options for -fdefault* and -flarge-sizes

Tim Keith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 15 08:23:56 PST 2021


tskeith added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:4231
+def flarge_sizes : Flag<["-"],"flarge-sizes">, Group<f_Group>, 
+  HelpText<"Set the default KIND for INTEGER to 8.">;
 }
----------------
That's not what -flarge-sizes does. Here is the description from flang/docs/Extensions.md:

> The default `INTEGER` type is required by the standard to occupy
> the same amount of storage as the default `REAL` type.  Default
> `REAL` is of course 32-bit IEEE-754 floating-point today.  This legacy
> rule imposes an artificially small constraint in some cases
> where Fortran mandates that something have the default `INTEGER`
> type: specifically, the results of references to the intrinsic functions
> `SIZE`, `STORAGE_SIZE`,`LBOUND`, `UBOUND`, `SHAPE`, and the location reductions
> `FINDLOC`, `MAXLOC`, and `MINLOC` in the absence of an explicit
> `KIND=` actual argument.  We return `INTEGER(KIND=8)` by default in
> these cases when the `-flarge-sizes` option is enabled.
> `SIZEOF` and `C_SIZEOF` always return `INTEGER(KIND=8)`.


================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:269
+    }
+    res.defaultKinds().set_defaultRealKind(4);
+  }
----------------
If `-fdefault-double-8` requires `-fdefault-real-8` then why is the default real kind set to 4?

I don't understand the purpose of this option. The kind of DOUBLE PRECISION is already 8 so there is no need to change it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96344/new/

https://reviews.llvm.org/D96344



More information about the cfe-commits mailing list