HaxeFoundation / HaxeFoundation/hxcpp
HXCPP_GC_MOVING in combination with HXCPP_ALIGN_ALLOC
- Dominant language
- C++
- Stars
- 330
- Forks
- 227
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 18
Description
When I run the following program built with HXCPP_GC_MOVING and HXCPP_ALIGN_ALLOC flags enabled, I get a segmentation fault. Commenting out one of them fixes the problem. Moreover , removing [these lines](https://github.com/HaxeFoundation/hxcpp/blob/54af892be2ca4c63988c99c9c524431af6c6f036/src/hx/gc/Immix.cpp#L3817C25-L3819C31) solves the problem, too.
### System info
- haxe 4.3.6
- hxcpp 4.3.68
- clang 19.1.4
- macOS Sequoia 15.1.1
### Main.hx
```Haxe
class Point {
public function new(x: Int, y: Int) {
this.x = x;
this.y = y;
}
public var x: Int;
public var y: Int;
}
final ITERATIONS = 10000000;
class Main {
private static final array: Array = [];
public static function addPoint(): Void {
array.push(new Point(array.length, array.length));
}
public static function main(): Void {
for (i in 0...ITERATIONS) {
addPoint();
}
final halfSize = Std.int(array.length / 2);
array.resize(halfSize);
for (i in 0...halfSize) {
addPoint();
}
var idx = Std.int(Math.random() * array.length);
trace('$idx == ${array[idx].x}');
}
}
```
### build.hxml
```hxml
-D HXCPP_GC_MOVING
-D HXCPP_ALIGN_ALLOC
-D HXCPP_API_LEVEL=430
-main Main
--cpp build
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.