re PR ipa/65540 (internal error on s-fatllf.ads at -O2)
authorJan Hubicka <hubicka@ucw.cz>
Tue, 7 Apr 2015 21:02:12 +0000 (23:02 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 7 Apr 2015 21:02:12 +0000 (21:02 +0000)
  PR ipa/65540
* calls.c (initialize_argument_information): When producing tail
call also turn SSA_NAMES passed by references to original PARM_DECLs
* gcc.c-torture/compile/pr65540.c: New.

From-SVN: r221910

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr65540.c [new file with mode: 0644]

index 315eafc27215e42d855d894b58cced67df442816..7de54510bd4fb31a71666e248264497f54a4ce94 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/65540
+       * calls.c (initialize_argument_information): When producing tail
+       call also turn SSA_NAMES passed by references to original PARM_DECLs
+
 2015-04-07  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR target/65648
index ec44624d7c9af242937064a39bae0124f0836e48..970415d65923699f486f4a59f455776b5d1b5bc1 100644 (file)
@@ -1321,6 +1321,15 @@ initialize_argument_information (int num_actuals ATTRIBUTE_UNUSED,
                  && TREE_CODE (base) != SSA_NAME
                  && (!DECL_P (base) || MEM_P (DECL_RTL (base)))))
            {
+             /* We may have turned the parameter value into an SSA name.
+                Go back to the original parameter so we can take the
+                address.  */
+             if (TREE_CODE (args[i].tree_value) == SSA_NAME)
+               {
+                 gcc_assert (SSA_NAME_IS_DEFAULT_DEF (args[i].tree_value));
+                 args[i].tree_value = SSA_NAME_VAR (args[i].tree_value);
+                 gcc_assert (TREE_CODE (args[i].tree_value) == PARM_DECL);
+               }
              /* Argument setup code may have copied the value to register.  We
                 revert that optimization now because the tail call code must
                 use the original location.  */
index d46d726b8daf73eacf1db7f7371809bcfe7af241..74a39ec2a23195b032a558b830e0f5c0d2508a58 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-07  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR ipa/65540
+       * gcc.c-torture/compile/pr65540.c: New.
+
 2015-04-07  Alan Lawrence  <alan.lawrence@arm.com>
 
        * gcc.target/aarch64/c-output-template-3.c: Add -O, remove
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr65540.c b/gcc/testsuite/gcc.c-torture/compile/pr65540.c
new file mode 100644 (file)
index 0000000..7b0fb56
--- /dev/null
@@ -0,0 +1,21 @@
+long double func1 (long double x)
+{
+  if (x > 0.0)
+    return x;
+  else if (x < 0.0)
+    return -x;
+  else
+    return x;
+}
+
+long double func2 (long double x)
+{
+  if (x > 0.0)
+    return x;
+  else if (x < 0.0)
+    return -x;
+  else
+    return x;
+}
+
+