aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-11-23 18:23:31 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-11-23 11:23:31 -0700
commitdb1d09b049a9388c481ff76aa00fe74734cce1c8 (patch)
tree42a7fa6c53e216da806d8aa51b9e929cf5056d2f /gcc/c
parente987fb1ebecc7494f9869071e487deef70a792f6 (diff)
downloadgcc-db1d09b049a9388c481ff76aa00fe74734cce1c8.zip
gcc-db1d09b049a9388c481ff76aa00fe74734cce1c8.tar.gz
gcc-db1d09b049a9388c481ff76aa00fe74734cce1c8.tar.bz2
PR testsuite/88098 - FAIL: gcc.dg/Wbuiltin-declaration-mismatch-4.c
gcc/c/ChangeLog: PR testsuite/88098 * c-typeck.c (convert_arguments): Call builtin_decl_explicit instead. (maybe_warn_builtin_no_proto_arg): Handle short enum to int promotion. gcc/testsuite/ChangeLog: PR testsuite/88098 * gcc.dg/Wbuiltin-declaration-mismatch-4.c: Adjust. * gcc.dg/Wbuiltin-declaration-mismatch-5.c: New test. * gcc.dg/torture/pr67222.c: Adjust. From-SVN: r266417
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c9
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 0b73df9..bcb282c 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2018-11-23 Martin Sebor <msebor@redhat.com>
+
+ PR testsuite/88098
+ * c-typeck.c (convert_arguments): Call builtin_decl_explicit instead.
+ (maybe_warn_builtin_no_proto_arg): Handle short enum to int promotion.
+
2018-11-20 Martin Sebor <msebor@redhat.com>
* c-parser.c (c_parser_has_attribute_expression): New function.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index bdfcb53..81c520a 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3422,7 +3422,10 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist,
built_in_function code = DECL_FUNCTION_CODE (fundecl);
if (C_DECL_BUILTIN_PROTOTYPE (fundecl))
{
- if (tree bdecl = builtin_decl_implicit (code))
+ /* For a call to a built-in function declared without a prototype
+ use the types of the parameters of the internal built-in to
+ match those of the arguments to. */
+ if (tree bdecl = builtin_decl_explicit (code))
builtin_typelist = TYPE_ARG_TYPES (TREE_TYPE (bdecl));
}
@@ -6461,7 +6464,9 @@ maybe_warn_builtin_no_proto_arg (location_t loc, tree fundecl, int parmnum,
&& TYPE_MODE (parmtype) == TYPE_MODE (argtype))
return;
- if (parmcode == argcode
+ if ((parmcode == argcode
+ || (parmcode == INTEGER_TYPE
+ && argcode == ENUMERAL_TYPE))
&& TYPE_MAIN_VARIANT (parmtype) == TYPE_MAIN_VARIANT (promoted))
return;