This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: fix C++ argument promotion for BOOLEAN_TYPE


This is a repost of the C++ portion of a patch to fix argument promotion
for BOOLEAN_TYPE and CHAR_TYPE.  The C portion is installed.  In C++,
these types are not being promoted in function calls.  As a result,
the function call ABI for big endian machines that define PROMOTE_PROTOTYPES
is broken.  I have checked this by examining the assembler output of
a small test program compiled with both C and C++ on the PA.  The problem
was originally noticed on the PA in the Fortran compiler.

The patch has been tested with full bootstraps and checks under
hppa1.1-hp-hpux10.20 and i686-pc-linux-gnu.

OK for branch and main?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

2001-06-04  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* call.c (convert_default_arg): Use INTEGRAL_TYPE_P.
	(build_over_call): Likewise.
	* decl.c (grokparms): Likewise.
	* pt.c (tsubst_decl): Likewise.
	* typeck.c (convert_arguments): Likewise.

--- cp/call.c.orig	Wed May 30 15:28:34 2001
+++ cp/call.c	Fri Jun  1 18:50:52 2001
@@ -4044,8 +4044,7 @@
       arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
 					"default argument", fn, parmnum);
       if (PROMOTE_PROTOTYPES
-	  && (TREE_CODE (type) == INTEGER_TYPE
-	      || TREE_CODE (type) == ENUMERAL_TYPE)
+	  && INTEGRAL_TYPE_P (type)
 	  && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
 	arg = default_conversion (arg);
     }
@@ -4156,8 +4155,7 @@
 	}
 
       if (PROMOTE_PROTOTYPES
-	  && (TREE_CODE (type) == INTEGER_TYPE
-	      || TREE_CODE (type) == ENUMERAL_TYPE)
+	  && INTEGRAL_TYPE_P (type)
 	  && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
 	val = default_conversion (val);
       converted_args = tree_cons (NULL_TREE, val, converted_args);
--- cp/decl.c.orig	Wed May 30 15:28:45 2001
+++ cp/decl.c	Fri Jun  1 18:51:36 2001
@@ -11952,8 +11952,7 @@
 
 	  DECL_ARG_TYPE (decl) = TREE_TYPE (decl);
 	  if (PROMOTE_PROTOTYPES
-	      && (TREE_CODE (type) == INTEGER_TYPE
-		  || TREE_CODE (type) == ENUMERAL_TYPE)
+	      && INTEGRAL_TYPE_P (type)
 	      && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
 	    DECL_ARG_TYPE (decl) = integer_type_node;
 	  if (!any_error && init)
--- cp/pt.c.orig	Wed May 30 15:28:53 2001
+++ cp/pt.c	Fri Jun  1 18:52:20 2001
@@ -5895,8 +5895,7 @@
 
 	DECL_CONTEXT (r) = NULL_TREE;
 	if (PROMOTE_PROTOTYPES
-	    && (TREE_CODE (type) == INTEGER_TYPE
-		|| TREE_CODE (type) == ENUMERAL_TYPE)
+	    && INTEGRAL_TYPE_P (type)
 	    && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
 	  DECL_ARG_TYPE (r) = integer_type_node;
 	if (TREE_CHAIN (t))
--- cp/typeck.c.orig	Wed May 30 15:28:58 2001
+++ cp/typeck.c	Fri Jun  1 18:53:19 2001
@@ -3234,8 +3234,7 @@
 		(NULL_TREE, type, val, flags,
 		 "argument passing", fndecl, i);
 	      if (PROMOTE_PROTOTYPES
-		  && (TREE_CODE (type) == INTEGER_TYPE
-		      || TREE_CODE (type) == ENUMERAL_TYPE)
+		  && INTEGRAL_TYPE_P (type)
 		  && (TYPE_PRECISION (type)
 		      < TYPE_PRECISION (integer_type_node)))
 		parmval = default_conversion (parmval);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]