re PR rtl-optimization/8396 ([sparc] optimizer ICE)
authorEric Botcazou <ebotcazou@libertysurf.fr>
Fri, 14 Mar 2003 14:49:40 +0000 (15:49 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 14 Mar 2003 14:49:40 +0000 (14:49 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20030314-1.c [new file with mode: 0644]
gcc/tree-inline.c

index f02c9579b1dee5c3ea34ab092a68bbb379db6225..3069374696f0ce878a0b68de9ea80a432cdf00c0 100644 (file)
@@ -1,3 +1,9 @@
+2003-03-14  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       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  <steven@gcc.gnu.org>
 
        * doc/extend.texi (Function Names): Make the example compilable.
index 40e66e03b0082b73988160b9a4d58b8863f51da8..d27bf6e1de7352e43b620689d521b1013aac4e72 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-14  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.c-torture/compile/20030314-1.c: New test.
+
 2003-03-13  Danny Smith  <dannysmith@users.sourceforge.net>
 
        * 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 (file)
index 0000000..02d4fed
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR optimization/8396 */
+/* Originator: <papadopo@shfj.cea.fr> */
+
+/* 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);
+}
index 3b3792999172939360c5d1d2c765273e52be6fd8..be72b59c213ab54876ed1f09be19109201133dd7 100644 (file)
@@ -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);