mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-22 22:44:56 +08:00
re PR c/5656 (ICE in emit_move_insn, at expr.c:2748, regression from gcc 3.0)
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
This commit is contained in:
parent
c1ea784307
commit
f735a15348
@ -1,3 +1,19 @@
|
||||
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
|
||||
|
@ -70,6 +70,9 @@ static void c_post_options PARAMS ((void));
|
||||
#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!! ### */
|
||||
|
||||
|
@ -270,6 +270,7 @@ extern void c_finish_case PARAMS ((void));
|
||||
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. */
|
||||
|
@ -4259,6 +4259,30 @@ convert_for_assignment (type, rhs, errtype, fundecl, funname, parmnum)
|
||||
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'".
|
||||
|
@ -63,6 +63,7 @@ tree lhd_tree_inlining_copy_res_decl_for_inlining PARAMS ((tree, tree,
|
||||
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)
|
||||
@ -107,6 +108,8 @@ void lhd_tree_inlining_end_inlining PARAMS ((tree));
|
||||
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, \
|
||||
@ -118,7 +121,8 @@ void lhd_tree_inlining_end_inlining PARAMS ((tree));
|
||||
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. */
|
||||
|
@ -277,6 +277,18 @@ lhd_tree_inlining_end_inlining (fn)
|
||||
{
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
|
@ -48,6 +48,9 @@ struct lang_hooks_for_tree_inlining
|
||||
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. */
|
||||
|
@ -64,6 +64,9 @@ static void objc_post_options PARAMS ((void));
|
||||
#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;
|
||||
|
@ -1,3 +1,7 @@
|
||||
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.
|
||||
|
16
gcc/testsuite/gcc.c-torture/compile/20020318-1.c
Normal file
16
gcc/testsuite/gcc.c-torture/compile/20020318-1.c
Normal file
@ -0,0 +1,16 @@
|
||||
/* 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 ());
|
||||
}
|
@ -483,7 +483,8 @@ initialize_inlined_parameters (id, args, fn)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user