aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99316.patch
blob: c7f92b6fcba12e150a51e05e3fcd45d29198f6e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
2010-07-20  Yao Qi  <yao@codesourcery.com>

	Merge from Sourcery G++ 4.4:
	2010-06-07  Kazu Hirata  <kazu@codesourcery.com>

	Issue #8535

	Backport from mainline:
	gcc/
	2010-06-07  Kazu Hirata  <kazu@codesourcery.com>
	PR rtl-optimization/44404
	* auto-inc-dec.c (find_inc): Use reg_overlap_mentioned_p instead
	of count_occurrences to see if it's safe to modify mem_insn.insn.

	gcc/testsuite/
	2010-06-07  Kazu Hirata  <kazu@codesourcery.com>
	PR rtl-optimization/44404
	* gcc.dg/pr44404.c: New.

 2010-08-03  Chung-Lin Tang  <cltang@codesourcery.com>
 
 	Backport from mainline:

=== modified file 'gcc/auto-inc-dec.c'
--- old/gcc/auto-inc-dec.c	2010-04-02 18:54:46 +0000
+++ new/gcc/auto-inc-dec.c	2010-08-05 11:30:21 +0000
@@ -1068,7 +1068,7 @@
       /* For the post_add to work, the result_reg of the inc must not be
 	 used in the mem insn since this will become the new index
 	 register.  */
-      if (count_occurrences (PATTERN (mem_insn.insn), inc_insn.reg_res, 1) != 0)
+      if (reg_overlap_mentioned_p (inc_insn.reg_res, PATTERN (mem_insn.insn)))
 	{
 	  if (dump_file)
 	    fprintf (dump_file, "base reg replacement failure.\n");

=== added file 'gcc/testsuite/gcc.dg/pr44404.c'
--- old/gcc/testsuite/gcc.dg/pr44404.c	1970-01-01 00:00:00 +0000
+++ new/gcc/testsuite/gcc.dg/pr44404.c	2010-08-05 11:30:21 +0000
@@ -0,0 +1,35 @@
+/* PR rtl-optimization/44404
+   foo() used to be miscompiled on ARM due to a bug in auto-inc-dec.c,
+   which resulted in "strb r1, [r1], #-36".  */
+
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-unroll-loops" } */
+
+extern char *strcpy (char *, const char *);
+extern int strcmp (const char*, const char*);
+extern void abort (void);
+
+char buf[128];
+
+void __attribute__((noinline))
+bar (int a, const char *p)
+{
+  if (strcmp (p, "0123456789abcdefghijklmnopqrstuvwxyz") != 0)
+    abort ();
+}
+
+void __attribute__((noinline))
+foo (int a)
+{
+  if (a)
+    bar (0, buf);
+  strcpy (buf, "0123456789abcdefghijklmnopqrstuvwxyz");
+  bar (0, buf);
+}
+
+int
+main (void)
+{
+  foo (0);
+  return 0;
+}