awarzynski added inline comments.

================
Comment at: flang/lib/Frontend/CompilerInvocation.cpp:254
+  if (args.hasArg(clang::driver::options::OPT_fdefault_real_8))
+    res.defaultKinds().set_defaultRealKind(8);
+  if (args.hasArg(clang::driver::options::OPT_fdefault_integer_8)) {
----------------
arnamoy10 wrote:
> awarzynski wrote:
> > From `gfortran` [[ 
> > https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html | 
> > documentation ]]:
> > 
> > ```
> > This option promotes the default width of DOUBLE PRECISION and double real 
> > constants like 1.d0 to 16 bytes if possible.
> > ```
> > 
> > So I believe that you are missing:
> > ```
> > res.defaultKinds().set_doublePrecisionKind(16);
> > ```
> I thought it is not necessary because `doublePrecisionKind` is automatically 
> initialized to double the size of `defaultRealKind_` in [[ 
> https://github.com/llvm/llvm-project/blob/adfd3c7083f9808d145239153c10f72eece485d8/flang/include/flang/Common/default-kinds.h#L51-L58
>  | here ]]--> `int doublePrecisionKind_{2 * defaultRealKind_};`. 
> 
> 
Yes, but the default value for `defaultRealKind_` is 4 and here you are setting 
it to 8. So, correct me if I'm wrong, but when the driver is here, the 
following has happened:
```
int defaultIntegerKind_{4};
int defaultRealKind_{defaultIntegerKind_};
int doublePrecisionKind_{2 * defaultRealKind_};
```
So `dublePrecisionKind_` is 8 rather than 16.


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

https://reviews.llvm.org/D96344

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to