1
# DP: Fix PR tree-optimization/59586, segfault with -Ofast -floop-parallelize-all
5
2014-06-29 Roman Gareev <gareevroman@gmail.com>
7
* graphite-dependences.c (subtract_commutative_associative_deps):
8
Add NULL checking of the following variables: must_raw_no_source,
9
may_raw_no_source, must_war_no_source, may_war_no_source,
10
must_waw_no_source, may_waw_no_source, must_raw, may_raw,
11
must_war, may_war, must_waw, may_waw
13
testsuite/gfortran.dg/graphite/pr59586.f: New testcase.
15
--- a/src/gcc/testsuite/gfortran.dg/graphite/pr59586.f
16
+++ b/src/gcc/testsuite/gfortran.dg/graphite/pr59586.f
18
+! { dg-additional-options "-Ofast -floop-parallelize-all" }
20
+ subroutine subsm ( n, x, xp, xx)
21
+ integer n, m, x(n),xp(n), xx(n), gg(n), dd_p
23
+ dd_p = dd_p + (x(i) - xx(i))*gg(i)
25
+ if ( dd_p .gt. 0 ) then
26
+ call dcopy( n, xp, 1, x, 1 )
29
--- a/src/gcc/graphite-dependences.c
30
+++ b/src/gcc/graphite-dependences.c
32
&x_may_waw_no_source);
33
gcc_assert (res == 0);
35
- *must_raw = isl_union_map_subtract (*must_raw, x_must_raw);
36
- *may_raw = isl_union_map_subtract (*may_raw, x_may_raw);
37
- *must_raw_no_source = isl_union_map_subtract (*must_raw_no_source,
38
- x_must_raw_no_source);
39
- *may_raw_no_source = isl_union_map_subtract (*may_raw_no_source,
40
- x_may_raw_no_source);
41
- *must_war = isl_union_map_subtract (*must_war, x_must_war);
42
- *may_war = isl_union_map_subtract (*may_war, x_may_war);
43
- *must_war_no_source = isl_union_map_subtract (*must_war_no_source,
44
- x_must_war_no_source);
45
- *may_war_no_source = isl_union_map_subtract (*may_war_no_source,
46
- x_may_war_no_source);
47
- *must_waw = isl_union_map_subtract (*must_waw, x_must_waw);
48
- *may_waw = isl_union_map_subtract (*may_waw, x_may_waw);
49
- *must_waw_no_source = isl_union_map_subtract (*must_waw_no_source,
50
- x_must_waw_no_source);
51
- *may_waw_no_source = isl_union_map_subtract (*may_waw_no_source,
52
- x_may_waw_no_source);
54
+ *must_raw = isl_union_map_subtract (*must_raw, x_must_raw);
56
+ isl_union_map_free (x_must_raw);
59
+ *may_raw = isl_union_map_subtract (*may_raw, x_may_raw);
61
+ isl_union_map_free (x_may_raw);
63
+ if (must_raw_no_source)
64
+ *must_raw_no_source = isl_union_map_subtract (*must_raw_no_source,
65
+ x_must_raw_no_source);
67
+ isl_union_map_free (x_must_raw_no_source);
69
+ if (may_raw_no_source)
70
+ *may_raw_no_source = isl_union_map_subtract (*may_raw_no_source,
71
+ x_may_raw_no_source);
73
+ isl_union_map_free (x_may_raw_no_source);
76
+ *must_war = isl_union_map_subtract (*must_war, x_must_war);
78
+ isl_union_map_free (x_must_war);
81
+ *may_war = isl_union_map_subtract (*may_war, x_may_war);
83
+ isl_union_map_free (x_may_war);
85
+ if (must_war_no_source)
86
+ *must_war_no_source = isl_union_map_subtract (*must_war_no_source,
87
+ x_must_war_no_source);
89
+ isl_union_map_free (x_must_war_no_source);
91
+ if (may_war_no_source)
92
+ *may_war_no_source = isl_union_map_subtract (*may_war_no_source,
93
+ x_may_war_no_source);
95
+ isl_union_map_free (x_may_war_no_source);
98
+ *must_waw = isl_union_map_subtract (*must_waw, x_must_waw);
100
+ isl_union_map_free (x_must_waw);
103
+ *may_waw = isl_union_map_subtract (*may_waw, x_may_waw);
105
+ isl_union_map_free (x_may_waw);
107
+ if (must_waw_no_source)
108
+ *must_waw_no_source = isl_union_map_subtract (*must_waw_no_source,
109
+ x_must_waw_no_source);
111
+ isl_union_map_free (x_must_waw_no_source);
113
+ if (may_waw_no_source)
114
+ *may_waw_no_source = isl_union_map_subtract (*may_waw_no_source,
115
+ x_may_waw_no_source);
117
+ isl_union_map_free (x_may_waw_no_source);
120
isl_union_map_free (original);