Bug 21072 – Segfault reassigning a variable to result of external C function

Status
NEW
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-07-25T02:26:23Z
Last change time
2024-12-13T19:10:20Z
Keywords
wrong-code
Assigned to
No Owner
Creator
xdrie
Moved to GitHub: dmd#19751 →

Attachments

IDFilenameSummaryContent-TypeSize
1800dlang_cmpbug_mat_repro.zipsource and binaries to reproduceapplication/zip792394

Comments

Comment #0 by xdrie — 2020-07-25T02:26:23Z
Created attachment 1800 source and binaries to reproduce full source with binaries is attached. one of them depends on an external C library (i am working on the bindings), and a prebuilt version is attached, and below are links to the source with build instructions (very few dependencies, just OpenGL and X11, just a simple makefile). source of packages: - bindings: https://github.com/xdrie/re-raylib-d - original library (tagged version): https://github.com/xdrie/raylib/releases/tag/v3.0.0_patch_1 this is the code in `app.d` that causes a segmentation fault on the last line of main. ``` import raylib; void main() { auto transform_mat = raymath.MatrixIdentity(); auto top_left = Vector3(1, 1, 0); top_left = raymath.Vector3Transform(top_left, transform_mat); } ``` on the last line, if we assign to a variable, like: `auto f = raymath.Vector3Transform(top_left, transform_mat);` then it no longer segfaults. dmd generates a segfaulting binary; both ldc and gdc generate binaries that work as expected. this is why i think this is very likely a dmd bug.
Comment #1 by bugzilla — 2020-08-09T01:45:54Z
Can you see if a smaller test case can be made?
Comment #2 by robert.schadek — 2024-12-13T19:10:20Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19751 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB