* [Patch, GCC/ARM, gcc-5-branch] Fix PR68390 Incorrect code due to indirect tail call of varargs function with hard float ABI
@ 2017-04-12 17:55 Christophe Lyon
2017-04-13 7:55 ` Ramana Radhakrishnan
0 siblings, 1 reply; 3+ messages in thread
From: Christophe Lyon @ 2017-04-12 17:55 UTC (permalink / raw)
To: gcc-patches, Ramana Radhakrishnan
[-- Attachment #1: Type: text/plain, Size: 214 bytes --]
Hi,
It looks like we forgot to backport the fix for PR68390 to gcc-5-branch.
The patch applies cleanly, and fwiw we've had it in the linaro-5
branch for a while.
OK to apply to gcc-5-branch?
Thanks,
Christophe
[-- Attachment #2: backport-r230730.chlog.txt --]
[-- Type: text/plain, Size: 344 bytes --]
2017-04-12 Christophe Lyon <christophe.lyon@linaro.org>
Backport from mainline
+2015-11-23 Kugan Vivekanandarajah <kuganv@linaro.org>
gcc/
PR target/68390
* config/arm/arm.c (arm_function_ok_for_sibcall): Get function type
for indirect function call.
gcc/testsuite/
PR target/68390
* gcc.c-torture/execute/pr68390.c: New test.
[-- Attachment #3: backport-r230730.patch.txt --]
[-- Type: text/plain, Size: 1411 bytes --]
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c (revision 246880)
+++ gcc/config/arm/arm.c (working copy)
@@ -6507,8 +6507,13 @@
a VFP register but then need to transfer it to a core
register. */
rtx a, b;
+ tree decl_or_type = decl;
- a = arm_function_value (TREE_TYPE (exp), decl, false);
+ /* If it is an indirect function pointer, get the function type. */
+ if (!decl)
+ decl_or_type = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (exp)));
+
+ a = arm_function_value (TREE_TYPE (exp), decl_or_type, false);
b = arm_function_value (TREE_TYPE (DECL_RESULT (cfun->decl)),
cfun->decl, false);
if (!rtx_equal_p (a, b))
Index: gcc/testsuite/gcc.c-torture/execute/pr68390.c
===================================================================
--- gcc/testsuite/gcc.c-torture/execute/pr68390.c (nonexistent)
+++ gcc/testsuite/gcc.c-torture/execute/pr68390.c (working copy)
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+__attribute__ ((noinline))
+double direct(int x, ...)
+{
+ return x*x;
+}
+
+__attribute__ ((noinline))
+double broken(double (*indirect)(int x, ...), int v)
+{
+ return indirect(v);
+}
+
+int main ()
+{
+ double d1, d2;
+ int i = 2;
+ d1 = broken (direct, i);
+ if (d1 != i*i)
+ {
+ __builtin_abort ();
+ }
+ return 0;
+}
+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, GCC/ARM, gcc-5-branch] Fix PR68390 Incorrect code due to indirect tail call of varargs function with hard float ABI
2017-04-12 17:55 [Patch, GCC/ARM, gcc-5-branch] Fix PR68390 Incorrect code due to indirect tail call of varargs function with hard float ABI Christophe Lyon
@ 2017-04-13 7:55 ` Ramana Radhakrishnan
2017-04-21 10:43 ` Christophe Lyon
0 siblings, 1 reply; 3+ messages in thread
From: Ramana Radhakrishnan @ 2017-04-13 7:55 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, Ramana Radhakrishnan
On Wed, Apr 12, 2017 at 6:55 PM, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
> Hi,
>
> It looks like we forgot to backport the fix for PR68390 to gcc-5-branch.
> The patch applies cleanly, and fwiw we've had it in the linaro-5
> branch for a while.
>
> OK to apply to gcc-5-branch?
>
OK if there are no regressions (the fact that its been in the linaro-5
branch gives me some confidence about the backport).
Ramana
> Thanks,
>
> Christophe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch, GCC/ARM, gcc-5-branch] Fix PR68390 Incorrect code due to indirect tail call of varargs function with hard float ABI
2017-04-13 7:55 ` Ramana Radhakrishnan
@ 2017-04-21 10:43 ` Christophe Lyon
0 siblings, 0 replies; 3+ messages in thread
From: Christophe Lyon @ 2017-04-21 10:43 UTC (permalink / raw)
To: Ramana Radhakrishnan; +Cc: gcc-patches, Ramana Radhakrishnan
On 13 April 2017 at 09:55, Ramana Radhakrishnan
<ramana.gcc@googlemail.com> wrote:
> On Wed, Apr 12, 2017 at 6:55 PM, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
>> Hi,
>>
>> It looks like we forgot to backport the fix for PR68390 to gcc-5-branch.
>> The patch applies cleanly, and fwiw we've had it in the linaro-5
>> branch for a while.
>>
>> OK to apply to gcc-5-branch?
>>
>
> OK if there are no regressions (the fact that its been in the linaro-5
> branch gives me some confidence about the backport).
>
Finally committed after bootstrap + no regression test on gcc-5-branch.
Thanks,
Christophe
> Ramana
>
>> Thanks,
>>
>> Christophe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-04-21 9:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 17:55 [Patch, GCC/ARM, gcc-5-branch] Fix PR68390 Incorrect code due to indirect tail call of varargs function with hard float ABI Christophe Lyon
2017-04-13 7:55 ` Ramana Radhakrishnan
2017-04-21 10:43 ` Christophe Lyon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).