component(developer/golang-123): Add Component
[oi-userland.git] / components / developer / gcc-10 / patches / 0007-strict-cc2-check-that-disabling-function-cloning-pre.patch
blob06274fe94f5b80dfa0746ea7cd0557577b457e66
1 From 3b1edd4b9f4502b3b91134bfa496c1a54bb13c7f Mon Sep 17 00:00:00 2001
2 From: Richard Lowe <richlowe@richlowe.net>
3 Date: Tue, 4 Mar 2014 02:58:33 +0000
4 Subject: [PATCH 07/34] strict-cc2: check that disabling function cloning
5 prevents constant propagation eliding or changing arguments
7 ---
8 .../gcc.dg/fno-clone-preserves-unused-args.c | 28 +++++++++++++++++++
9 1 file changed, 28 insertions(+)
10 create mode 100644 gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c
12 diff --git a/gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c b/gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c
13 new file mode 100644
14 index 00000000000..0955381c848
15 --- /dev/null
16 +++ b/gcc/testsuite/gcc.dg/fno-clone-preserves-unused-args.c
17 @@ -0,0 +1,28 @@
18 +/* { dg-do compile { target { ilp32 } } } */
19 +/* { dg-options "-O2 -funit-at-a-time -fipa-sra -fno-clone-functions" } */
20 +/* { dg-final { scan-assembler "pushl.*\\\$1" } } */
21 +/* { dg-final { scan-assembler "pushl.*\\\$2" } } */
22 +/* { dg-final { scan-assembler "pushl.*\\\$3" } } */
23 +/* { dg-final { scan-assembler "pushl.*\\\$4" } } */
24 +/* { dg-final { scan-assembler "pushl.*\\\$5" } } */
26 +#include <stdio.h>
28 +/*
29 + * Verify that preventing function cloning prevents constant prop/scalar
30 + * reduction removing parameters
31 + */
32 +static void
33 +t(int, int, int, int, int) __attribute__ ((noinline));
35 +int foo()
37 + t(1, 2, 3, 4, 5);
40 +/* Only use 3 params, bait constprop/sra into deleting the other two */
41 +static void
42 +t(int a, int b, int c, int d, int e)
44 + printf("%d %d\n", a, b, c);
46 --
47 2.31.1