This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: fix argument promotion
- To: gcc-patches at gcc dot gnu dot org
- Subject: PATCH: fix argument promotion
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Mon, 4 Jun 2001 12:28:53 -0400 (EDT)
Rodney Brown found that the testsuite failures noted in fortran PR 2782
were related to the passing of boolean arguments on the PA. I looked
into this and found that only INTEGER_TYPE and ENUMERAL_TYPE were being
promoted in prototypes in C and C++. The new C99 BOOLEAN_TYPE, and also
CHAR_TYPE under C++ were not being promoted. This patch changes the
test to use INTEGRAL_TYPE_P instead of explicitly checking all the
different types that need promotion. This fixes all the fortran
testsuite failures on the PA.
Bootstrapped and checked with no regressions under hppa1.1-hp-hpux10.20
<http://gcc.gnu.org/ml/gcc-testresults/2001-06/msg00089.html> and
i686 linux.
OK for both?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-06-01 John David Anglin <dave@hiauly1.hia.nrc.ca>
* c-decl.c (get_parm_info): Use INTEGRAL_TYPE_P.
(store_parm_decls): Likewise.
* c-typeck.c (convert_arguments): Likewise.
* cp/call.c (convert_default_arg): Likewise.
(build_over_call): Likewise.
* cp/decl.c (grokparms): Likewise.
* cp/pt.c (tsubst_decl): Likewise.
* cp/typeck.c (convert_arguments): Likewise.
--- c-decl.c.orig Wed May 30 15:24:01 2001
+++ c-decl.c Fri Jun 1 18:49:16 2001
@@ -5072,8 +5072,7 @@
tree type = TREE_TYPE (decl);
DECL_ARG_TYPE (decl) = type;
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;
@@ -6358,8 +6357,7 @@
DECL_ARG_TYPE (parm) = TREE_TYPE (parm);
if (PROMOTE_PROTOTYPES
- && (TREE_CODE (TREE_TYPE (parm)) == INTEGER_TYPE
- || TREE_CODE (TREE_TYPE (parm)) == ENUMERAL_TYPE)
+ && INTEGRAL_TYPE_P (TREE_TYPE (parm))
&& TYPE_PRECISION (TREE_TYPE (parm))
< TYPE_PRECISION (integer_type_node))
DECL_ARG_TYPE (parm) = integer_type_node;
--- c-typeck.c.orig Wed May 30 15:24:06 2001
+++ c-typeck.c Fri Jun 1 19:10:30 2001
@@ -1766,9 +1766,7 @@
fundecl, name, parmnum + 1);
if (PROMOTE_PROTOTYPES
- && (TREE_CODE (type) == INTEGER_TYPE
- || TREE_CODE (type) == ENUMERAL_TYPE
- || TREE_CODE (type) == BOOLEAN_TYPE)
+ && INTEGRAL_TYPE_P (type)
&& (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
parmval = default_conversion (parmval);
}
--- 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);