File: pr59586.diff

package info (click to toggle)
gcc-4.8 4.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 587,180 kB
  • ctags: 425
  • sloc: makefile: 65,711; sh: 1,248; perl: 165; awk: 23; cpp: 14
file content (120 lines) | stat: -rw-r--r-- 4,006 bytes parent folder | download | duplicates (11)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# DP: Fix PR tree-optimization/59586, segfault with -Ofast -floop-parallelize-all

gcc/

2014-06-29  Roman Gareev  <gareevroman@gmail.com>

	* graphite-dependences.c (subtract_commutative_associative_deps): 
	Add NULL checking of the following variables: must_raw_no_source, 
	may_raw_no_source, must_war_no_source, may_war_no_source, 
	must_waw_no_source, may_waw_no_source, must_raw, may_raw, 
	must_war, may_war, must_waw, may_waw

	testsuite/gfortran.dg/graphite/pr59586.f: New testcase.

--- a/src/gcc/testsuite/gfortran.dg/graphite/pr59586.f
+++ b/src/gcc/testsuite/gfortran.dg/graphite/pr59586.f
@@ -0,0 +1,11 @@
+! { dg-additional-options "-Ofast -floop-parallelize-all" }
+
+      subroutine subsm ( n, x, xp, xx)
+      integer        n, m, x(n),xp(n), xx(n), gg(n), dd_p
+      do 55 i=1, n
+         dd_p  = dd_p + (x(i) - xx(i))*gg(i)
+ 55   continue
+      if ( dd_p .gt. 0  ) then
+         call dcopy( n, xp, 1, x, 1 )
+      endif
+      end
--- a/src/gcc/graphite-dependences.c
+++ b/src/gcc/graphite-dependences.c
@@ -424,24 +424,71 @@
 					  &x_may_waw_no_source);
 	gcc_assert (res == 0);
 
-	*must_raw = isl_union_map_subtract (*must_raw, x_must_raw);
-	*may_raw = isl_union_map_subtract (*may_raw, x_may_raw);
-	*must_raw_no_source = isl_union_map_subtract (*must_raw_no_source,
-						      x_must_raw_no_source);
-	*may_raw_no_source = isl_union_map_subtract (*may_raw_no_source,
-						     x_may_raw_no_source);
-	*must_war = isl_union_map_subtract (*must_war, x_must_war);
-	*may_war = isl_union_map_subtract (*may_war, x_may_war);
-	*must_war_no_source = isl_union_map_subtract (*must_war_no_source,
-						      x_must_war_no_source);
-	*may_war_no_source = isl_union_map_subtract (*may_war_no_source,
-						     x_may_war_no_source);
-	*must_waw = isl_union_map_subtract (*must_waw, x_must_waw);
-	*may_waw = isl_union_map_subtract (*may_waw, x_may_waw);
-	*must_waw_no_source = isl_union_map_subtract (*must_waw_no_source,
-						      x_must_waw_no_source);
-	*may_waw_no_source = isl_union_map_subtract (*may_waw_no_source,
-						     x_may_waw_no_source);
+	if (must_raw)
+	  *must_raw = isl_union_map_subtract (*must_raw, x_must_raw);
+	else
+	  isl_union_map_free (x_must_raw);
+
+	if (may_raw)
+	  *may_raw = isl_union_map_subtract (*may_raw, x_may_raw);
+	else
+	  isl_union_map_free (x_may_raw);
+
+	if (must_raw_no_source)
+	  *must_raw_no_source = isl_union_map_subtract (*must_raw_no_source,
+						        x_must_raw_no_source);
+	else
+	  isl_union_map_free (x_must_raw_no_source);
+
+	if (may_raw_no_source)
+	  *may_raw_no_source = isl_union_map_subtract (*may_raw_no_source,
+						       x_may_raw_no_source);
+	else
+	  isl_union_map_free (x_may_raw_no_source);
+
+	if (must_war)
+	  *must_war = isl_union_map_subtract (*must_war, x_must_war);
+	else
+	  isl_union_map_free (x_must_war);
+
+	if (may_war)
+	  *may_war = isl_union_map_subtract (*may_war, x_may_war);
+	else
+	  isl_union_map_free (x_may_war);
+
+	if (must_war_no_source)
+	  *must_war_no_source = isl_union_map_subtract (*must_war_no_source,
+						        x_must_war_no_source);
+	else
+	  isl_union_map_free (x_must_war_no_source);
+
+	if (may_war_no_source)
+	  *may_war_no_source = isl_union_map_subtract (*may_war_no_source,
+						       x_may_war_no_source);
+	else
+	  isl_union_map_free (x_may_war_no_source);
+
+	if (must_waw)
+	  *must_waw = isl_union_map_subtract (*must_waw, x_must_waw);
+	else
+	  isl_union_map_free (x_must_waw);
+
+	if (may_waw)
+	  *may_waw = isl_union_map_subtract (*may_waw, x_may_waw);
+	else
+	  isl_union_map_free (x_may_waw);
+
+	if (must_waw_no_source)
+	  *must_waw_no_source = isl_union_map_subtract (*must_waw_no_source,
+						        x_must_waw_no_source);
+	else
+	  isl_union_map_free (x_must_waw_no_source);
+
+	if (may_waw_no_source)
+	  *may_waw_no_source = isl_union_map_subtract (*may_waw_no_source,
+						       x_may_waw_no_source);
+	else
+	  isl_union_map_free (x_may_waw_no_source);
       }
 
   isl_union_map_free (original);