-
-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bugzilla 24884 - backend generates wrong 32-bit code after inlini…
…ng math with double[4]
- Loading branch information
Dennis Korpel
committed
Nov 26, 2024
1 parent
4c645bb
commit 45adf2e
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
REQUIRED_ARGS: -inline | ||
*/ | ||
|
||
// https://issues.dlang.org/show_bug.cgi?id=24884 | ||
|
||
void vecdiff(ref double[4] a, ref double[4] b, ref double[4] result) | ||
{ | ||
result[0] = a[0] - b[0]; | ||
result[1] = a[1] - b[1]; | ||
result[2] = a[2] - b[2]; | ||
result[3] = a[3]; | ||
} | ||
|
||
pragma(inline, false) | ||
double norm(ref double[4] a) => 0; | ||
|
||
pragma(inline, false) | ||
void outerproduct(ref double[4] a, ref double[4] b, ref double[4] c) {} | ||
|
||
pragma(inline, false) | ||
double innerproduct(ref double[4] a, ref double[4] b) => 0; | ||
|
||
pragma(inline, false) | ||
void inlinebug(ref double[4] point1, ref double[4] point2, ref double[4] point3, ref double[4] abcd) | ||
{ | ||
double[4] v1 = 0.0; | ||
double[4] v2 = 0.0; | ||
vecdiff(point1, point2, v1); | ||
vecdiff(point2, point3, v2); | ||
|
||
outerproduct(v1, v2, abcd); | ||
if (norm(abcd) > 0.0) | ||
{ | ||
abcd[0] = innerproduct(abcd, point1); | ||
} | ||
} | ||
|
||
void main() | ||
{ | ||
double[4] a = 0.0; | ||
inlinebug(a, a, a, a); | ||
} |