pmaports/cross/gcc4-armhf/pr64037.patch
Daniele Debernardi 7b3702e2dd Add gcc4 and gcc4-armhf packages (!216)
Successfully tested both the gcc4 compiler on x86_64 with a simple
program (fbdebug) and the gcc4-armhf cross-compiler to build a very old
u-boot port for Galaxy Nexus (a MR will follow soon) which failed to
boot with either newer version (6 and 8).

[skip ci]: already went through
2019-02-12 21:03:12 +00:00

83 lines
2.4 KiB
Diff

https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=0817dc6f0e6b973e0e3671eb72d3758a8f042324
(changelog changes removed)
From 0817dc6f0e6b973e0e3671eb72d3758a8f042324 Mon Sep 17 00:00:00 2001
From: hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sun, 14 Dec 2014 16:07:03 +0000
Subject: [PATCH] Pass unpromoted argument to promote_function_mode
This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.
Backported from mainline:
gcc/
PR rtl-optimization/64037
* combine.c (setup_incoming_promotions): Pass the argument
before any promotions happen to promote_function_mode.
gcc/testsuite/
PR rtl-optimization/64037
* g++.dg/pr64037.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@218721 138bc75d-0d04-0410-961f-82ee72b054a4
---
gcc/combine.c | 4 ++--
gcc/testsuite/g++.dg/pr64037.C | 27 +++++++++++++++++++++++++++
4 files changed, 46 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/pr64037.C
diff --git a/gcc/combine.c b/gcc/combine.c
index 7c00452..adea2c1 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1529,8 +1529,8 @@ setup_incoming_promotions (rtx first)
uns3 = TYPE_UNSIGNED (DECL_ARG_TYPE (arg));
/* The mode and signedness of the argument as it is actually passed,
- after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions. */
- mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3,
+ see assign_parm_setup_reg in function.c. */
+ mode3 = promote_function_mode (TREE_TYPE (arg), mode1, &uns3,
TREE_TYPE (cfun->decl), 0);
/* The mode of the register in which the argument is being passed. */
diff --git a/gcc/testsuite/g++.dg/pr64037.C b/gcc/testsuite/g++.dg/pr64037.C
new file mode 100644
index 0000000..e5cd0e2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/pr64037.C
@@ -0,0 +1,27 @@
+// { dg-do run { target i?86-*-* x86_64-*-* } }
+// { dg-options "-std=c++11 -Os" }
+
+enum class X : unsigned char {
+ V = 2,
+};
+
+static void
+__attribute__((noinline,noclone))
+foo(unsigned &out, unsigned a, X b)
+{
+ out = static_cast<unsigned>(b);
+}
+
+int main()
+{
+ unsigned deadbeef = 0xDEADBEEF;
+ asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef));
+
+ unsigned out;
+ foo(out, 2, X::V);
+
+ if (out != 2)
+ __builtin_abort ();
+
+ return 0;
+}
--
1.7.1