summaryrefslogtreecommitdiffstats
path: root/recipes-core/cacao/files/cacao-0.9.8-initial-fix-gc-undefined-behaviour.patch
blob: ccc35cb7cbd0e1fd508c264f3947e788f3830c21 (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
Upstream-Status: Backport

This fixes undefined behaviour in boehm GC as suggested at
https://github.com/ivmai/bdwgc/commit/16780405c899f01119bc45167122b4242f6b34fb.

The undefined behaviour at very least causes a segmentation fault during
classpath-native configure step.
    
Signed-off-by: Erkka Kääriä <erkka.kaaria@intel.com>

--- cacao-0.98/src/mm/boehm-gc/mark_rts.c
+++ cacao-0.98/src/mm/boehm-gc/mark_rts.c
@@ -371,18 +371,7 @@ ptr_t p;
 
 ptr_t GC_approx_sp()
 {
-    VOLATILE word dummy;
-
-    dummy = 42;	/* Force stack to grow if necessary.	Otherwise the	*/
-    		/* later accesses might cause the kernel to think we're	*/
-    		/* doing something wrong.				*/
-#   ifdef _MSC_VER
-#     pragma warning(disable:4172)
-#   endif
-    return((ptr_t)(&dummy));
-#   ifdef _MSC_VER
-#     pragma warning(default:4172)
-#   endif
+    return __builtin_frame_address(0);
 }
 
 /*
-- 
2.1.4