Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
May 19, 2022 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 Paul Backus <snarwin+bugzilla@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |snarwin+bugzilla@gmail.com Severity|enhancement |normal --- Comment #1 from Paul Backus <snarwin+bugzilla@gmail.com> --- Reduced: --- int fun() { return 123456; } int divide(int dividend) { return dividend == 0 ? assert(0) : dividend / dividend; } void main() { fun(); int c = divide(1); assert(c == 1); } --- As of DMD 2.100.0, with -checkaction=context, this produces the following output: --- core.exception.AssertError@bug.d(14): 123456 != 1 --- -- |
December 17, 2022 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 27, 2023 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 --- Comment #2 from kdevel <kdevel@vogtner.de> --- (In reply to kdevel from comment #0) > $ dmd div.d > $ ./div 1 2 > 1 / 2 = 2 dmd 2.100.2: bad $ ./div 1 2 1 / 2 = 2 dmd 2.101.1 and newer: good $ ./div 1 2 1 / 2 = 0 (In reply to Paul Backus from comment #1) > Reduced: > > As of DMD 2.100.0, with -checkaction=context, this produces the following output: Works since dmd 2.101.1. -- |
December 27, 2023 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 Siarhei Siamashka <siarhei.siamashka@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |siarhei.siamashka@hotmail.c | |om --- Comment #3 from Siarhei Siamashka <siarhei.siamashka@hotmail.com> --- (In reply to kdevel from comment #2) > Works since dmd 2.101.1. Does the DMD test suite have a test for it? To ensure that this problem does not re-appear again in the future. -- |
December 30, 2023 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 --- Comment #4 from kdevel <kdevel@vogtner.de> --- (In reply to Siarhei Siamashka from comment #3) > (In reply to kdevel from comment #2) > > Works since dmd 2.101.1. > > Does the DMD test suite have a test for it? To ensure that this problem does not re-appear again in the future. Simple question, not easy to answer. For now more than two hours I am trying to bisect dmd between v2.100.2 and v2.101.1 to no avail. I have stopped when git asked me to compile a commit of 2016 [e8ab5ca21f3010bb40509ca7aaf575440886795b] Merge pull request #1639 from WalterBright/rm-PostBlitType $ make -f posix.mak ../dmd/src/dmd -conf= -c -o- -Isrc -Iimport -Hfimport/core/sync/barrier.di src/core/sync/barrier.d make: ../dmd/src/dmd: Command not found make: *** [import/core/sync/barrier.di] Error 127 which fails. I could not git bisect skip this often enough in a reasonable amount of time. dmd 2.105.3 could not compile the old compiler: [...] (DC) COMMON The following operation failed: Name: common Sources: -> /tmp/k/dmd/src/dmd/common/bitfields.d -> /tmp/k/dmd/src/dmd/common/file.d -> /tmp/k/dmd/src/dmd/common/int128.d -> /tmp/k/dmd/src/dmd/common/outbuffer.d -> /tmp/k/dmd/src/dmd/common/string.d Targets: -> /tmp/k/dmd/generated/linux/release/64/common.o Command: [...]dmd2/linux/bin64/dmd -c -of/tmp/k/dmd/generated/linux/release/64/common.o -version=MARS -w -de -fPIC -m64 -J/tmp/k/dmd/generated/linux/release/64 -I/tmp/k/dmd/src -dip25 -g -color=on src/dmd/common/bitfields.d src/dmd/common/file.d src/dmd/common/int128.d src/dmd/common/outbuffer.d src/dmd/common/string.d ----------------------------------------------------------- Deprecation: `-dip25` no longer has any effect make[1]: *** [dmd] Error 1 Therefor I used dmd 2.098.1 as HOST_DMD -- |
December 30, 2023 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 Basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b2.temp@gmx.com --- Comment #5 from Basile-z <b2.temp@gmx.com> --- > Simple question, not easy to answer. Use Vladimir `digger --bisect` it will be easier: https://github.com/CyberShadow/Digger -- |
December 30, 2023 [Issue 23126] wrong result of integer division in presence of assert within conditional operator expression | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23126 --- Comment #6 from kdevel <kdevel@vogtner.de> --- (In reply to kdevel from comment #4) > (In reply to Siarhei Siamashka from comment #3) > > (In reply to kdevel from comment #2) > > > Works since dmd 2.101.1. > > > > Does the DMD test suite have a test for it? To ensure that this problem does not re-appear again in the future. > Simple question, not easy to answer. It was fixed between v2.101.0 and v2.101.1 (named "bad" commit because of inverted roles): d836c8bcec16205644e3aacf15f1a1cf7d655dd5 is the first bad commit commit d836c8bcec16205644e3aacf15f1a1cf7d655dd5 Author: mhh <maxhaton@gmail.com> Date: Thu Dec 15 06:15:28 2022 +0000 Fix Issue 23549, 22587 - Lower certain noreturn expressions to a comma expression rather than a cast. This avoids a backend segfault. GDC already does this lowering so it may have to be made optional via a frontend parameter. :040000 040000 29998096bd165299cd08f15f32ab2dd047461bd8 70e6048af4184c4d4edb72add21fcbb0dac57957 M compiler -- |
Copyright © 1999-2021 by the D Language Foundation