aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-typeck.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-typeck.c')
-rw-r--r--gcc/c-typeck.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index c55bcad89c9..42e01d2af52 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4243,7 +4243,7 @@ convert_for_assignment (tree type, tree rhs, enum impl_conv errtype,
}
/* Convert VALUE for assignment into inlined parameter PARM. ARGNUM
- is used for error and waring reporting and indicates which argument
+ is used for error and warning reporting and indicates which argument
is being processed. */
tree
@@ -4251,9 +4251,15 @@ c_convert_parm_for_inlining (tree parm, tree value, tree fn, int argnum)
{
tree ret, type;
- /* If FN was prototyped, the value has been converted already
- in convert_arguments. */
- if (!value || TYPE_ARG_TYPES (TREE_TYPE (fn)))
+ /* If FN was prototyped at the call site, the value has been converted
+ already in convert_arguments.
+ However, we might see a prototype now that was not in place when
+ the function call was seen, so check that the VALUE actually matches
+ PARM before taking an early exit. */
+ if (!value
+ || (TYPE_ARG_TYPES (TREE_TYPE (fn))
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (parm))
+ == TYPE_MAIN_VARIANT (TREE_TYPE (value)))))
return value;
type = TREE_TYPE (parm);