Debian Codegraph @

gcc/testsuite/gdc.test/compilable/test23076.d

raw
1 /* REQUIRED_ARGS: -O -inline
2 */
3
4 // https://issues.dlang.org/show_bug.cgi?id=23076
5
6 struct S
7 {
8 int depthLow = 0;
9 int depthHigh = 30000;
10
11 void fun(int* pixels)
12 {
13 float b = depthLow;
14 int depthA = cast(int)(b);
15 int depthB = cast(short)(cast(float)depthHigh * cast(float)depthLow);
16 pixels[depthA] = depthB;
17 }
18 }
19
20 /**********************/
21
22 float mul3(float a, float b, float t)
23 {
24 return t * b * a;
25 }
26
27 class A
28 {
29 ushort depthLow = 0;
30 ushort depthHigh = 30000;
31
32 void fun(short* pixels)
33 {
34 short depthA = (cast(short)(mul3(depthHigh, depthLow, 0)));
35 short depthB = (cast(short)(mul3(depthLow, depthHigh, 0)));
36 pixels[depthA] = depthB;
37 }
38 }