Bad codegen for comparison with postfix increment

Paul Backus snarwin at gmail.com
Wed May 8 14:26:25 UTC 2024


When the following program is compiled with GDC 14.1, the 
assertion fails:

     void main() {
         int d = 42;
         bool o = d > d++;
         assert(o == false);
     }

(Godbolt: https://d.godbolt.org/z/e63xbb9Td)

The assertion passes when the program is compiled with DMD 
2.108.0.

The same bug was recently reported for LDC: 
https://github.com/ldc-developers/ldc/issues/4651


More information about the D.gnu mailing list