Thread overview | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 Daniel Kozak <kozzi11@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kozzi11@gmail.com --- Comment #1 from Daniel Kozak <kozzi11@gmail.com> --- Can you please post complete example with compile args and dmd version? I am unable to reproduce it -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #2 from hsteoh@quickfur.ath.cx --- dmd --version: ------ DMD64 D Compiler v2.088.0-247-gfafa982ae Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright ------ Compile command: dmd test.d Output: ------ dmd: /usr/src/d/dmd/src/dmd/backend/cgcod.d:2489: Assertion `cast(int)(*e).Ecomsub <= cast(int)(*e).Ecount' failed. Aborted ------ -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #3 from hsteoh@quickfur.ath.cx --- The code quoted above is the entire content of test.d, by the way. -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #4 from hsteoh@quickfur.ath.cx --- P.P.S. This is dmd from git master, btw. It could be a bug recently introduced, perhaps? -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #5 from hsteoh@quickfur.ath.cx --- Just updated to latest git master: dmd --version: ------ DMD64 D Compiler v2.088.1-beta.1-265-g5f168a3b7 Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright ------ Same error. -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #6 from hsteoh@quickfur.ath.cx --- Writing the return statement as: ------ return sqrt(cast(double)(x*x + y)); ------ makes the problem go away. Parenthesizing (x*x) also makes the problem go away. Somehow something goes wrong when the cast operator is applied only to the first element of the product x*x. The +y appears to be necessary, since removing that also makes the error go away. -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #7 from Daniel Kozak <kozzi11@gmail.com> --- (In reply to hsteoh from comment #4) > P.P.S. This is dmd from git master, btw. It could be a bug recently introduced, perhaps? my latest dmd stable works ok DMD64 D Compiler v2.088.0-dirty Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright So it is probably only issue with latest git code. -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #8 from Daniel Kozak <kozzi11@gmail.com> --- even all versions on run.dlang.org seems to work ok: https://run.dlang.io/is/BppP0P -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net --- Comment #9 from kinke <kinke@gmx.net> --- (In reply to hsteoh from comment #0) > Submitting this as critical because it's an ICE. That's because you have a custom build of DMD with enabled assertions (thumbs up for that). The generated code seems to be fine, https://run.dlang.io/is/gO3wJh yields the expected result with DMD nightly. -- |
October 07, 2019 [Issue 20278] ICE: calling std.math.sqrt with int cast to double | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20278 --- Comment #10 from Daniel Kozak <kozzi11@gmail.com> --- dmd-nightly is old: DMD64 D Compiler v2.088.0-beta.1-master-ede5969 Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved written by Walter Bright -- |
Copyright © 1999-2021 by the D Language Foundation