February 15, 2023 [Issue 23710] New: [REG master] Reachable code inside an 'if (false)' block no longer gets codegen | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23710 Issue ID: 23710 Summary: [REG master] Reachable code inside an 'if (false)' block no longer gets codegen Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: ibuclaw@gdcproject.org Consider the following: --- int test(int i) { int[] foo; if (0) { for (;;) { import core.stdc.stdio; printf("start body\n"); foo = foo ~ [1,2,3]; L1: printf("foo.length = %zu\n", foo.length); i += 2; if (i > 5) return i; printf("end body\n"); } } goto L1; } extern(C) int main() { return test(1); } --- Actual run-time result: --- foo.length = 0 end body foo.length = 0 end body foo.length = 0 --- Expected run-time result: --- foo.length = 0 end body start body foo.length = 3 end body start body foo.length = 6 --- Also noting that when compiling with `-betterC`, there is no error about the use of RTTI in the array concat expression. -- |
Copyright © 1999-2021 by the D Language Foundation