Patchwork Flag-controlled type conversions/promotions

login
register
mail settings
Submitter Steve Kargl
Date Dec. 25, 2011, 11:16 p.m.
Message ID <20111225231657.GA74330@troutmask.apl.washington.edu>
Download mbox | patch
Permalink /patch/133201/
State New
Headers show

Comments

Steve Kargl - Dec. 25, 2011, 11:16 p.m.
On Wed, Nov 09, 2011 at 06:09:58PM -0500, Andreas Kloeckner wrote:
> 
> please find attached the patch and the Changelog entry for our work on
> the fortran bug #48426.
> 
> The attached patch implements the options
> 
> -finteger-4-integer-8
> -freal-4-real-8
> -freal-4-real-10
> -freal-4-real-16
> -freal-8-real-4
> -freal-8-real-10
> -freal-8-real-16
> 
> to implement a variety of automatic type promotions.  (This is
> particularly helpful if one wants to quickly check whether a
> certain code has a bug limiting its precision away from full
> machine accuracy.)
> 
> A similar promotion feature is available in Fujitsu compilers, see here:
> 
> http://www.lahey.com/docs/fujitsu%20compiler%20option%20list.pdf
> 
> (e.g. -CcR8R16)
> 
> The implementation work on this was done by Zydrunas Gimbutas, not by me.
> Zydrunas has authorized me to submit this for inclusion in gcc. Both he
> and I have gone through the FSF's copyright assignment process and have
> current papers for that on file.
> 
> We tested the change by running Kahan's Fortran paranoia tests using all
> supported conversions, we ran the LINPACK tests (at all supported
> conversions) as well as a number of manually-written conversion tests.
> 

All, 

I have taken Zydrunas and Andreas patche applied it to my tree,
updated for it GNU Coding Style, and written the gfortran manual
entries.  The ChangeLog is
 
2011-12-25  Zydrunas Gimbutas  <gimbutas@cims.nyu.edu>
	    Andreas Kloeckner  <kloeckner@cims.nyu.edu>
	    Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/48426
	* gfortran.h: Make global variables flag_*_kind to store
	* lang.opt: Add options -freal-4-real-8, -freal-4-real-10,
	-freal-4-real-16, -freal-8-real-4, -freal-8-real-10, -freal-8-real-16
	and -finteger-4-integer-8.
	user-desired type conversion information.
	* decl.c (gfc_match_old_kind_spec,kind_expr): Type conversions
	in declaration parsing.
	* trans-types.c (gfc_init_kinds): User-specified type conversion
	checked for current backend.
	* primary.c (match_integer_constant,match_real_constant): Implement
	type conversion in constant parsing.
	* options.c (gfc_init_options,gfc_handle_option): Translate input
	options to flags in internal options data structure.
	* invoke.texi: Document new options.  Re-order options in Options
	summary section.

I regression tested the patch on i686-*-freebsd.  No problems occurred.
Can one of the other gfortran reviewers/committers cast a quick glance
over the patch.  I would like to commit this within next day or two.

OK for trunk?

Patch

Index: decl.c
===================================================================
--- decl.c	(revision 182680)
+++ decl.c	(working copy)
@@ -2101,6 +2101,33 @@  gfc_match_old_kind_spec (gfc_typespec *t
 	  return MATCH_ERROR;
 	}
       ts->kind /= 2;
+
+    }
+
+  if (ts->type == BT_INTEGER && ts->kind == 4 && gfc_option.flag_integer4_kind == 8)
+    ts->kind = 8;
+
+  if (ts->type == BT_REAL || ts->type == BT_COMPLEX)
+    {
+      if (ts->kind == 4)
+	{
+	  if (gfc_option.flag_real4_kind == 8)
+	    ts->kind =  8;
+	  if (gfc_option.flag_real4_kind == 10)
+	    ts->kind = 10;
+	  if (gfc_option.flag_real4_kind == 16)
+	    ts->kind = 16;
+	}
+
+      if (ts->kind == 8)
+	{
+	  if (gfc_option.flag_real8_kind == 4)
+	    ts->kind = 4;
+	  if (gfc_option.flag_real8_kind == 10)
+	    ts->kind = 10;
+	  if (gfc_option.flag_real8_kind == 16)
+	    ts->kind = 16;
+	}
     }
 
   if (gfc_validate_kind (ts->type, ts->kind, true) < 0)
@@ -2246,7 +2273,33 @@  kind_expr:
 
   if(m == MATCH_ERROR)
      gfc_current_locus = where;
-  
+
+  if (ts->type == BT_INTEGER && ts->kind == 4 && gfc_option.flag_integer4_kind == 8)
+    ts->kind =  8;
+
+  if (ts->type == BT_REAL || ts->type == BT_COMPLEX)
+    {
+      if (ts->kind == 4)
+	{
+	  if (gfc_option.flag_real4_kind == 8)
+	    ts->kind =  8;
+	  if (gfc_option.flag_real4_kind == 10)
+	    ts->kind = 10;
+	  if (gfc_option.flag_real4_kind == 16)
+	    ts->kind = 16;
+	}
+
+      if (ts->kind == 8)
+	{
+	  if (gfc_option.flag_real8_kind == 4)
+	    ts->kind = 4;
+	  if (gfc_option.flag_real8_kind == 10)
+	    ts->kind = 10;
+	  if (gfc_option.flag_real8_kind == 16)
+	    ts->kind = 16;
+	}
+    }
+
   /* Return what we know from the test(s).  */
   return m;
 
Index: trans-types.c
===================================================================
--- trans-types.c	(revision 182680)
+++ trans-types.c	(working copy)
@@ -362,7 +362,7 @@  gfc_init_kinds (void)
   unsigned int mode;
   int i_index, r_index, kind;
   bool saw_i4 = false, saw_i8 = false;
-  bool saw_r4 = false, saw_r8 = false, saw_r16 = false;
+  bool saw_r4 = false, saw_r8 = false, saw_r10 = false, saw_r16 = false;
 
   for (i_index = 0, mode = MIN_MODE_INT; mode <= MAX_MODE_INT; mode++)
     {
@@ -456,6 +456,8 @@  gfc_init_kinds (void)
 	saw_r4 = true;
       if (kind == 8)
 	saw_r8 = true;
+      if (kind == 10)
+	saw_r10 = true;
       if (kind == 16)
 	saw_r16 = true;
 
@@ -482,23 +484,31 @@  gfc_init_kinds (void)
       r_index += 1;
     }
 
-  /* Choose the default integer kind.  We choose 4 unless the user
-     directs us otherwise.  */
+  /* Choose the default integer kind.  We choose 4 unless the user directs us
+     otherwise.  Even if the user specified that the default integer kind is 8,
+     the numeric storage size is not 64 bits.  In this case, a warning will be
+     issued when NUMERIC_STORAGE_SIZE is used.  Set NUMERIC_STORAGE_SIZE to 32.  */
+
+  gfc_numeric_storage_size = 4 * 8;
+
   if (gfc_option.flag_default_integer)
     {
       if (!saw_i8)
-	fatal_error ("integer kind=8 not available for -fdefault-integer-8 option");
+	fatal_error ("INTEGER(KIND=8) is not available for -fdefault-integer-8 option");
+
       gfc_default_integer_kind = 8;
 
-      /* Even if the user specified that the default integer kind be 8,
-         the numeric storage size isn't 64.  In this case, a warning will
-	 be issued when NUMERIC_STORAGE_SIZE is used.  */
-      gfc_numeric_storage_size = 4 * 8;
+    }
+  else if (gfc_option.flag_integer4_kind == 8)
+    {
+      if (!saw_i8)
+	fatal_error ("INTEGER(KIND=8) is not available for -finteger-4-integer-8 option");
+
+      gfc_default_integer_kind = 8;
     }
   else if (saw_i4)
     {
       gfc_default_integer_kind = 4;
-      gfc_numeric_storage_size = 4 * 8;
     }
   else
     {
@@ -510,9 +520,31 @@  gfc_init_kinds (void)
   if (gfc_option.flag_default_real)
     {
       if (!saw_r8)
-	fatal_error ("real kind=8 not available for -fdefault-real-8 option");
+	fatal_error ("REAL(KIND=8) is not available for -fdefault-real-8 option");
+
       gfc_default_real_kind = 8;
     }
+  else if (gfc_option.flag_real4_kind == 8)
+  {
+    if (!saw_r8)
+      fatal_error ("REAL(KIND=8) is not available for -freal-4-real-8 option");
+
+    gfc_default_real_kind = 8;
+  }
+  else if (gfc_option.flag_real4_kind == 10)
+  {
+    if (!saw_r10)
+      fatal_error ("REAL(KIND=10) is not available for -freal-4-real-10 option");
+
+    gfc_default_real_kind = 10;
+  }
+  else if (gfc_option.flag_real4_kind == 16)
+  {
+    if (!saw_r16)
+      fatal_error ("REAL(KIND=16) is not available for -freal-4-real-16 option");
+
+    gfc_default_real_kind = 16;
+  }
   else if (saw_r4)
     gfc_default_real_kind = 4;
   else
@@ -529,6 +561,27 @@  gfc_init_kinds (void)
     gfc_default_double_kind = 8;
   else if (gfc_option.flag_default_real && saw_r16)
     gfc_default_double_kind = 16;
+  else if (gfc_option.flag_real8_kind == 4)
+    {
+      if (!saw_r4)
+	fatal_error ("REAL(KIND=4) is not available for -freal-8-real-4 option");
+
+	gfc_default_double_kind = 4;
+    }
+  else if (gfc_option.flag_real8_kind == 10 )
+    {
+      if (!saw_r10)
+	fatal_error ("REAL(KIND=10) is not available for -freal-8-real-10 option");
+
+	gfc_default_double_kind = 10;
+    }
+  else if (gfc_option.flag_real8_kind == 16 )
+    {
+      if (!saw_r16)
+	fatal_error ("REAL(KIND=10) is not available for -freal-8-real-16 option");
+
+	gfc_default_double_kind = 16;
+    }
   else if (saw_r4 && saw_r8)
     gfc_default_double_kind = 8;
   else
Index: primary.c
===================================================================
--- primary.c	(revision 182680)
+++ primary.c	(working copy)
@@ -1,5 +1,6 @@ 
 /* Primary expression subroutines
-   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011
    Free Software Foundation, Inc.
    Contributed by Andy Vaught
 
@@ -224,6 +225,9 @@  match_integer_constant (gfc_expr **resul
   if (kind == -1)
     return MATCH_ERROR;
 
+  if (kind == 4 && gfc_option.flag_integer4_kind == 8)
+    kind = 8;
+
   if (gfc_validate_kind (BT_INTEGER, kind, true) < 0)
     {
       gfc_error ("Integer kind %d at %C not available", kind);
@@ -636,6 +640,26 @@  done:
 	  goto cleanup;
 	}
       kind = gfc_default_double_kind;
+
+      if (kind == 4)
+	{
+	  if (gfc_option.flag_real4_kind == 8)
+	    kind = 8;
+	  if (gfc_option.flag_real4_kind == 10)
+	    kind = 10;
+	  if (gfc_option.flag_real4_kind == 16)
+	    kind = 16;
+	}
+
+      if (kind == 8)
+	{
+	  if (gfc_option.flag_real8_kind == 4)
+	    kind = 4;
+	  if (gfc_option.flag_real8_kind == 10)
+	    kind = 10;
+	  if (gfc_option.flag_real8_kind == 16)
+	    kind = 16;
+	}
       break;
 
     case 'q':
@@ -666,6 +690,26 @@  done:
       if (kind == -2)
 	kind = gfc_default_real_kind;
 
+      if (kind == 4)
+	{
+	  if (gfc_option.flag_real4_kind == 8)
+	    kind = 8;
+	  if (gfc_option.flag_real4_kind == 10)
+	    kind = 10;
+	  if (gfc_option.flag_real4_kind == 16)
+	    kind = 16;
+	}
+
+      if (kind == 8)
+	{
+	  if (gfc_option.flag_real8_kind == 4)
+	    kind = 4;
+	  if (gfc_option.flag_real8_kind == 10)
+	    kind = 10;
+	  if (gfc_option.flag_real8_kind == 16)
+	    kind = 16;
+	}
+
       if (gfc_validate_kind (BT_REAL, kind, true) < 0)
 	{
 	  gfc_error ("Invalid real kind %d at %C", kind);
Index: options.c
===================================================================
--- options.c	(revision 182680)
+++ options.c	(working copy)
@@ -116,6 +116,9 @@  gfc_init_options (unsigned int decoded_o
   gfc_option.flag_default_double = 0;
   gfc_option.flag_default_integer = 0;
   gfc_option.flag_default_real = 0;
+  gfc_option.flag_integer4_kind = 0;
+  gfc_option.flag_real4_kind = 0;
+  gfc_option.flag_real8_kind = 0;
   gfc_option.flag_dollar_ok = 0;
   gfc_option.flag_underscoring = 1;
   gfc_option.flag_whole_file = 1;
@@ -849,6 +852,34 @@  gfc_handle_option (size_t scode, const c
       gfc_option.flag_default_double = value;
       break;
 
+    case OPT_finteger_4_integer_8:
+      gfc_option.flag_integer4_kind = 8;
+      break;
+
+    case OPT_freal_4_real_8:
+      gfc_option.flag_real4_kind = 8;
+      break;
+
+    case OPT_freal_4_real_10:
+      gfc_option.flag_real4_kind = 10;
+      break;
+
+    case OPT_freal_4_real_16:
+      gfc_option.flag_real4_kind = 16;
+      break;
+
+    case OPT_freal_8_real_4:
+      gfc_option.flag_real8_kind = 4;
+      break;
+
+    case OPT_freal_8_real_10:
+      gfc_option.flag_real8_kind = 10;
+      break;
+
+    case OPT_freal_8_real_16:
+      gfc_option.flag_real8_kind = 16;
+      break;
+
     case OPT_finit_local_zero:
       gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
       gfc_option.flag_init_integer_value = 0;
Index: gfortran.h
===================================================================
--- gfortran.h	(revision 182680)
+++ gfortran.h	(working copy)
@@ -2215,6 +2215,9 @@  typedef struct
   int flag_default_double;
   int flag_default_integer;
   int flag_default_real;
+  int flag_integer4_kind;
+  int flag_real4_kind;
+  int flag_real8_kind;
   int flag_dollar_ok;
   int flag_underscoring;
   int flag_second_underscore;
Index: lang.opt
===================================================================
--- lang.opt	(revision 182680)
+++ lang.opt	(working copy)
@@ -1,5 +1,5 @@ 
 ; Options for the Fortran 95 front end.
-; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ; Free Software Foundation, Inc.
 ;
 ; This file is part of GCC.
@@ -394,6 +394,10 @@  ffixed-form
 Fortran RejectNegative
 Assume that the source file is fixed form
 
+finteger-4-integer-8
+Fortran RejectNegative
+Interpret any INTEGER(4) as an INTEGER(8)
+
 fintrinsic-modules-path
 Fortran RejectNegative Joined Separate
 Specify where to find the compiled intrinsic modules
@@ -494,6 +498,30 @@  frange-check
 Fortran
 Enable range checking during compilation
 
+freal-4-real-8
+Fortran RejectNegative
+Interpret any REAl(4) as a REAL(8)
+
+freal-4-real-10
+Fortran RejectNegative
+Interpret any REAL(4) as a REAL(10)
+
+freal-4-real-16
+Fortran RejectNegative
+Interpret any REAL(4) as a REAl(16)
+
+freal-8-real-4
+Fortran RejectNegative
+Interpret any REAL(8) as a REAL(4)
+
+freal-8-real-10
+Fortran RejectNegative
+Interpret any REAL(8) as a REAL(10)
+
+freal-8-real-16
+Fortran RejectNegative
+Interpret any REAL(8) as a REAl(16)
+
 frealloc-lhs
 Fortran
 Reallocate the LHS in assignments
Index: invoke.texi
===================================================================
--- invoke.texi	(revision 182680)
+++ invoke.texi	(working copy)
@@ -66,7 +66,8 @@  GNU Fortran.
 @c man begin DESCRIPTION
 
 The @command{gfortran} command supports all the options supported by the
-@command{gcc} command.  Only options specific to GNU Fortran are documented here.
+@command{gcc} command.  Only options specific to GNU Fortran are documented
+here.
 
 @xref{Invoking GCC,,GCC Command Options,gcc,Using the GNU Compiler
 Collection (GCC)}, for information
@@ -115,37 +116,46 @@  by type.  Explanations are in the follow
 @table @emph
 @item Fortran Language Options
 @xref{Fortran Dialect Options,,Options controlling Fortran dialect}.
-@gccoptlist{-fall-intrinsics  -ffree-form  -fno-fixed-form @gol
--fdollar-ok  -fimplicit-none  -fmax-identifier-length @gol
--std=@var{std} -fd-lines-as-code  -fd-lines-as-comments @gol
--ffixed-line-length-@var{n}  -ffixed-line-length-none @gol
--ffree-line-length-@var{n}  -ffree-line-length-none @gol
--fdefault-double-8  -fdefault-integer-8  -fdefault-real-8 @gol
--fcray-pointer  -fopenmp  -fno-range-check -fbackslash -fmodule-private}
+@gccoptlist{-fall-intrinsics -fbackslash -fcray-pointer -fd-lines-as-code @gol
+-fd-lines-as-comments -fdefault-double-8 -fdefault-integer-8 @gol
+-fdefault-real-8 -fdollar-ok -ffixed-line-length-@var{n} @gol
+-ffixed-line-length-none -ffree-form -ffree-line-length-@var{n} @gol
+-ffree-line-length-none -fimplicit-none -finteger-4-integer-8 @gol
+-fmax-identifier-length -fmodule-private -fno-fixed-form -fno-range-check @gol
+-fopenmp -freal-4-real-10 -freal-4-real-16 -freal-4-real-8 @gol
+-freal-8-real-10 -freal-8-real-16 -freal-8-real-4 -std=@var{std}
+}
 
 @item Preprocessing Options
 @xref{Preprocessing Options,,Enable and customize preprocessing}.
-@gccoptlist{-cpp -dD -dI -dM -dN -dU -fworking-directory @gol
--imultilib @var{dir} -iprefix @var{file} -isysroot @var{dir} @gol
--iquote -isystem @var{dir} -nocpp -nostdinc -undef @gol
--A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol
--C -CC -D@var{macro}@r{[}=@var{defn}@r{]} -U@var{macro} -H -P}
+@gccoptlist{-A-@var{question}@r{[}=@var{answer}@r{]}
+-A@var{question}=@var{answer} -C -CC -D@var{macro}@r{[}=@var{defn}@r{]}
+-H -P @gol
+-U@var{macro} -cpp -dD -dI -dM -dN -dU -fworking-directory
+-imultilib @var{dir} @gol
+-iprefix @var{file} -iquote -isysroot @var{dir} -isystem @var{dir} -nocpp 
+-nostdinc @gol
+-undef
+}
 
 @item Error and Warning Options
 @xref{Error and Warning Options,,Options to request or suppress errors
 and warnings}.
-@gccoptlist{-fmax-errors=@var{n}
--fsyntax-only -pedantic -pedantic-errors -Wall @gol
--Waliasing -Wampersand -Warray-bounds -Wcharacter-truncation @gol
--Wconversion -Wimplicit-interface -Wimplicit-procedure -Wline-truncation @gol
--Wintrinsics-std -Wreal-q-constant -Wsurprising -Wno-tabs -Wunderflow @gol
--Wunused-parameter -Wintrinsic-shadow -Wno-align-commons @gol
--Wfunction-elimination}
+@gccoptlist{-Waliasing -Wall -Wampersand -Warray-bounds
+-Wcharacter-truncation @gol
+-Wconversion -Wfunction-elimination -Wimplicit-interface @gol
+-Wimplicit-procedure -Wintrinsic-shadow -Wintrinsics-std @gol
+-Wline-truncation -Wno-align-commons -Wno-tabs -Wreal-q-constant @gol
+-Wsurprising -Wunderflow -Wunused-parameter -fmax-errors=@var{n}
+-fsyntax-only @gol
+-pedantic -pedantic-errors
+}
 
 @item Debugging Options
 @xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
-@gccoptlist{-fdump-fortran-original  -fdump-fortran-optimized @gol
--ffpe-trap=@var{list} -fbacktrace -fdump-parse-tree}
+@gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original @gol
+-fdump-parse-tree -ffpe-trap=@var{list}
+}
 
 @item Directory Options
 @xref{Directory Options,,Options for directory search}.
@@ -157,39 +167,29 @@  and warnings}.
 
 @item Runtime Options
 @xref{Runtime Options,,Options for influencing runtime behavior}.
-@gccoptlist{-fconvert=@var{conversion}  -fno-range-check
--frecord-marker=@var{length} @gol  -fmax-subrecord-length=@var{length}
--fsign-zero}
+@gccoptlist{-fconvert=@var{conversion} -fmax-subrecord-length=@var{length}
+-fno-range-check @gol
+-frecord-marker=@var{length} -fsign-zero
+}
 
 @item Code Generation Options
 @xref{Code Gen Options,,Options for code generation conventions}.
-@gccoptlist{-fno-automatic  -ff2c  -fno-underscoring @gol
--fno-whole-file -fsecond-underscore @gol
--fbounds-check -fcheck-array-temporaries  -fmax-array-constructor =@var{n} @gol
+@gccoptlist{-faggressive-function-elimination -fblas-matmul-limit=@var{n} @gol
+-fbounds-check -fcheck-array-temporaries @gol
 -fcheck=@var{<all|array-temps|bounds|do|mem|pointer|recursion>} @gol
--fcoarray=@var{<none|single|lib>} -fmax-stack-var-size=@var{n} @gol
--fstack-arrays @gol
--fpack-derived  -frepack-arrays  -fshort-enums  -fexternal-blas @gol
--fblas-matmul-limit=@var{n} -frecursive -finit-local-zero @gol
--finit-integer=@var{n} -finit-real=@var{<zero|inf|-inf|nan|snan>} @gol
--finit-logical=@var{<true|false>} -finit-character=@var{n} @gol
--fno-align-commons -fno-protect-parens -frealloc-lhs @gol
--faggressive-function-elimination -ffrontend-optimize}
+-fcoarray=@var{<none|single|lib>} -fexternal-blas -ff2c
+-ffrontend-optimize @gol
+-finit-character=@var{n} -finit-integer=@var{n} -finit-local-zero @gol
+-finit-logical=@var{<true|false>}
+-finit-real=@var{<zero|inf|-inf|nan|snan>} @gol
+-fmax-array-constructor=@var{n} -fmax-stack-var-size=@var{n}
+-fno-align-commons @gol
+-fno-automatic -fno-protect-parens -fno-underscoring -fno-whole-file @gol
+-fsecond-underscore -fpack-derived -frealloc-lhs -frecursive @gol
+-frepack-arrays -fshort-enums -fstack-arrays
+}
 @end table
 
-@menu
-* Fortran Dialect Options::  Controlling the variant of Fortran language
-                             compiled.
-* Preprocessing Options::  Enable and customize preprocessing.
-* Error and Warning Options::     How picky should the compiler be?
-* Debugging Options::   Symbol tables, measurements, and debugging dumps.
-* Directory Options::   Where to find module files
-* Link Options ::       Influencing the linking step
-* Runtime Options::     Influencing runtime behavior
-* Code Gen Options::    Specifying conventions for function calls, data layout
-                        and register usage.
-@end menu
-
 @node Fortran Dialect Options
 @section Options controlling Fortran dialect
 @cindex dialect options
@@ -324,6 +324,11 @@  Specify that no implicit typing is allow
 @code{IMPLICIT} statements.  This is the equivalent of adding
 @code{implicit none} to the start of every procedure.
 
+@item -finteger-4-integer-8
+@opindex @code{finteger-4-integer-8}
+Promote @code{INTEGER(KIND=4)} entities to an @code{INTEGER(KIND=8)} entities.
+If @code{KIND=8} is unavailable, then an error will be issued.
+
 @item -fcray-pointer
 @opindex @code{fcray-pointer}
 Enable the Cray pointer extension, which provides C-like pointer
@@ -354,6 +359,42 @@  Similarly, @code{DATA i/Z'FFFFFFFF'/} wi
 on most systems, but with @option{-fno-range-check} the value will
 ``wrap around'' and @code{i} will be initialized to @math{-1} instead.
 
+@item -freal-4-real-8
+@opindex @code{freal-4-real-8}
+Promote @code{REAL(KIND=4)} entities to @code{REAL(KIND=8)} entities.
+If @code{KIND=8} is unavailable, then an error will be issued.
+All other real kind types are unaffected by this option.
+
+@item -freal-4-real-10
+@opindex @code{freal-4-real-10}
+Promote @code{REAL(KIND=4)} entities to @code{REAL(KIND=10)} entities.
+If @code{KIND=10} is unavailable, then an error will be issued.
+All other real kind types are unaffected by this option.
+
+@item -freal-4-real-16
+@opindex @code{freal-4-real-16}
+Promote @code{REAL(KIND=4)} entities to @code{REAL(KIND=16)} entities.
+If @code{KIND=16} is unavailable, then an error will be issued.
+All other real kind types are unaffected by this option.
+
+@item -freal-8-real-4
+@opindex @code{freal-8-real-4}
+Demote @code{REAL(KIND=8)} entities to @code{REAL(KIND=4)} entities.
+If @code{KIND=4} is unavailable, then an error will be issued.
+All other real kind types are unaffected by this option.
+
+@item -freal-8-real-10
+@opindex @code{freal-8-real-10}
+Promote @code{REAL(KIND=8)} entities to @code{REAL(KIND=10)} entities.
+If @code{KIND=10} is unavailable, then an error will be issued.
+All other real kind types are unaffected by this option.
+
+@item -freal-8-real-16
+@opindex @code{freal-8-real-16}
+Promote @code{REAL(KIND=8)} entities to @code{REAL(KIND=16)} entities.
+If @code{KIND=16} is unavailable, then an error will be issued.
+All other real kind types are unaffected by this option.
+
 @item -std=@var{std}
 @opindex @code{std=}@var{std} option
 Specify the standard to which the program is expected to conform, which