PR c/5656
* langhooks.h (struct lang_hooks_for_tree_inlining): Add
convert_parm_for_inlining.
* c-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING):
Define.
* langhooks-def.h: Likewise.
* objc/objc-lang.c: Likewise.
* langhooks.c (lhd_tree_inlining_convert_parm_for_inlining): New
function.
* tree-inline.c (initialize_inlined_parameters):
Call convert_parm_for_inlining lang hook if needed.
* c-typeck.c (c_convert_parm_for_inlining): New function.
* c-tree.h (c_convert_parm_for_inlining): Add prototype.
* gcc.c-torture/compile/
20020318-1.c: New test.
From-SVN: r51025
+2002-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/5656
+ * langhooks.h (struct lang_hooks_for_tree_inlining): Add
+ convert_parm_for_inlining.
+ * c-lang.c (LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING):
+ Define.
+ * langhooks-def.h: Likewise.
+ * objc/objc-lang.c: Likewise.
+ * langhooks.c (lhd_tree_inlining_convert_parm_for_inlining): New
+ function.
+ * tree-inline.c (initialize_inlined_parameters):
+ Call convert_parm_for_inlining lang hook if needed.
+ * c-typeck.c (c_convert_parm_for_inlining): New function.
+ * c-tree.h (c_convert_parm_for_inlining): Add prototype.
+
2002-03-18 Mark Mitchell <mark@codesourcery.com>
* calls.c (precompute_arguments): Do not assume that temporaries
#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
anon_aggr_type_p
+#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
+#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
+ c_convert_parm_for_inlining
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
extern tree simple_asm_stmt PARAMS ((tree));
extern tree build_asm_stmt PARAMS ((tree, tree, tree,
tree, tree));
+extern tree c_convert_parm_for_inlining PARAMS ((tree, tree, tree));
/* Set to 0 at beginning of a function definition, set to 1 if
a return statement that specifies a return value is seen. */
return error_mark_node;
}
+/* Convert VALUE for assignment into inlined parameter PARM. */
+
+tree
+c_convert_parm_for_inlining (parm, value, fn)
+ tree parm, value, fn;
+{
+ tree ret, type;
+
+ /* If FN was prototyped, the value has been converted already
+ in convert_arguments. */
+ if (! value || TYPE_ARG_TYPES (TREE_TYPE (fn)))
+ return value;
+
+ type = TREE_TYPE (parm);
+ ret = convert_for_assignment (type, value,
+ (char *) 0 /* arg passing */, fn,
+ DECL_NAME (fn), 0);
+ if (PROMOTE_PROTOTYPES
+ && INTEGRAL_TYPE_P (type)
+ && (TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node)))
+ ret = default_conversion (ret);
+ return ret;
+}
+
/* Print a warning using MSGID.
It gets OPNAME as its one parameter.
If OPNAME is null, it is replaced by "passing arg ARGNUM of `FUNCTION'".
int lhd_tree_inlining_anon_aggr_type_p PARAMS ((tree));
int lhd_tree_inlining_start_inlining PARAMS ((tree));
void lhd_tree_inlining_end_inlining PARAMS ((tree));
+tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree));
#define LANG_HOOKS_NAME "GNU unknown"
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct lang_identifier)
lhd_tree_inlining_start_inlining
#define LANG_HOOKS_TREE_INLINING_END_INLINING \
lhd_tree_inlining_end_inlining
+#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
+ lhd_tree_inlining_convert_parm_for_inlining
#define LANG_HOOKS_TREE_INLINING_INITIALIZER { \
LANG_HOOKS_TREE_INLINING_WALK_SUBTREES, \
LANG_HOOKS_TREE_INLINING_COPY_RES_DECL_FOR_INLINING, \
LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P, \
LANG_HOOKS_TREE_INLINING_START_INLINING, \
- LANG_HOOKS_TREE_INLINING_END_INLINING \
+ LANG_HOOKS_TREE_INLINING_END_INLINING, \
+ LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
} \
/* Tree dump hooks. */
{
}
+/* lang_hooks.tree_inlining.convert_parm_for_inlining performs any
+ language-specific conversion before assigning VALUE to PARM. */
+
+tree
+lhd_tree_inlining_convert_parm_for_inlining (parm, value, fndecl)
+ tree parm ATTRIBUTE_UNUSED;
+ tree value;
+ tree fndecl ATTRIBUTE_UNUSED;
+{
+ return value;
+}
+
/* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree
nodes. Returns non-zero if it does not want the usual dumping of the
second argument. */
int (*anon_aggr_type_p) PARAMS ((union tree_node *));
int (*start_inlining) PARAMS ((union tree_node *));
void (*end_inlining) PARAMS ((union tree_node *));
+ union tree_node *(*convert_parm_for_inlining) PARAMS ((union tree_node *,
+ union tree_node *,
+ union tree_node *));
};
/* The following hooks are used by tree-dump.c. */
#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
anon_aggr_type_p
+#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
+#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
+ c_convert_parm_for_inlining
/* Each front end provides its own hooks, for toplev.c. */
const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+2002-03-19 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.c-torture/compile/20020318-1.c: New test.
+
2002-03-18 Jakub Jelinek <jakub@redhat.com>
* g++.dg/opt/conj1.C: New test.
--- /dev/null
+/* PR c/5656
+ This testcase ICEd on IA-32 at -O3, due to tree inliner not converting
+ parameter assignment when using K&R syntax. */
+
+void foo (c)
+ char c;
+{
+ (void) &c;
+}
+
+int bar (void);
+
+void baz (void)
+{
+ foo (bar ());
+}
tree cleanup;
/* Find the initializer. */
- value = a ? TREE_VALUE (a) : NULL_TREE;
+ value = (*lang_hooks.tree_inlining.convert_parm_for_inlining)
+ (p, a ? TREE_VALUE (a) : NULL_TREE, fn);
/* If the parameter is never assigned to, we may not need to
create a new variable here at all. Instead, we may be able