[committed,Fortran] Use proper type for hidden is-present argument
diff mbox series

Message ID 77f68427-3da0-0007-6de1-65df148c2ab6@codesourcery.com
State New
Headers show
Series
  • [committed,Fortran] Use proper type for hidden is-present argument
Related show

Commit Message

Tobias Burnus Nov. 13, 2019, 8:11 a.m. UTC
I found this argument mismatch when looking into the issue of PR92305.

For noncharacter per-VALUE optional arguments, the absent/present status 
is propagated using a hidden argument of type 'boolean_type_node' (which 
is a one-byte type). If the (actual) argument in the caller is also an 
optional variable, gfc_conv_expr_present()  is called to obtain the 
pass-on condition.

For another per-VALUE argument, that's fine. However, for other optional 
arguments, the condition "arg == NULL" is folded to a logical_type_node 
(= default-kind logical, i.e. usually 4 sometimes 8 byte variable).

Hence, I added a fold-convert to ensure the right type is used.

Committed to the trunk as obvious, Rev. 278114.

Cheers,

Tobias

Patch
diff mbox series

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(revision 278113)
+++ gcc/fortran/trans-expr.c	(revision 278114)
@@ -5750,7 +5750,9 @@ 
 					fold_convert (TREE_TYPE (parmse.expr),
 						      integer_zero_node));
 
-			    vec_safe_push (optionalargs, tmp);
+			    vec_safe_push (optionalargs,
+					   fold_convert (boolean_type_node,
+							 tmp));
 			  }
 		      }
 		    }
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(revision 278113)
+++ gcc/fortran/ChangeLog	(revision 278114)
@@ -1,3 +1,8 @@ 
+2019-11-13  Tobias Burnus  <tobias@codesourcery.com>
+
+	* trans-expr.c (gfc_conv_procedure_call): Fold hidden
+	is-present argument to the right type.
+
 2019-11-12  Harald Anlauf  <anlauf@gmx.de>
 
 	PR fortran/81651
@@ -55,9 +60,9 @@ 
 
 2019-11-11  Janne Blomqvist  <jb@gcc.gnu.org>
 
-        PR fortran/91828
-        * simplify.c (gfc_simplify_fraction): Remove fallback path for
-        MPFR < 3.1.0.
+	PR fortran/91828
+	* simplify.c (gfc_simplify_fraction): Remove fallback path for
+	MPFR < 3.1.0.
 
 2019-11-11  Tobias Burnus  <tobias@codesourcery.com>
 	    Kwok Cheung Yeung  <kcy@codesourcery.com>