From: Eric Botcazou Date: Fri, 14 Mar 2003 14:49:40 +0000 (+0100) Subject: re PR rtl-optimization/8396 ([sparc] optimizer ICE) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f650843fc32b30f61fb62b103fe9db2f69a4f9a5;p=gcc.git re PR rtl-optimization/8396 ([sparc] optimizer ICE) PR optimization/8396 * tree-inline.c (initialize_inlined_parameters): Make sure the value of read-only constant arguments is passed with the right type. From-SVN: r64358 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f02c9579b1d..3069374696f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-03-14 Eric Botcazou + + PR optimization/8396 + * tree-inline.c (initialize_inlined_parameters): Make sure the value + of read-only constant arguments is passed with the right type. + 2003-03-14 Steven Bosscher * doc/extend.texi (Function Names): Make the example compilable. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 40e66e03b00..d27bf6e1de7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2003-03-14 Eric Botcazou + + * gcc.c-torture/compile/20030314-1.c: New test. + 2003-03-13 Danny Smith * gcc.dg/dll-1.c: Remove thumb target. Change exp to _exp. diff --git a/gcc/testsuite/gcc.c-torture/compile/20030314-1.c b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c new file mode 100644 index 00000000000..02d4fed526a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20030314-1.c @@ -0,0 +1,18 @@ +/* PR optimization/8396 */ +/* Originator: */ + +/* Verify that the tree inliner doesn't mess up the types + when passing the value of read-only constant arguments. */ + +static inline bar(const short int xs, const short int xe) +{ + if (xe && (xs < xe)) + ; +} + +void f() +{ + short int xe; + + bar(0, xe); +} diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3b379299917..be72b59c213 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -666,6 +666,10 @@ initialize_inlined_parameters (id, args, fn, block) if (DECL_P (value)) value = build1 (NOP_EXPR, TREE_TYPE (value), value); + /* If this is a constant, make sure it has the right type. */ + else if (TREE_TYPE (value) != TREE_TYPE (p)) + value = fold (build1 (NOP_EXPR, TREE_TYPE (p), value)); + splay_tree_insert (id->decl_map, (splay_tree_key) p, (splay_tree_value) value);