digitalmars.D.bugs - [Issue 12779] New: [REG2.066a] -inline makes wrong code under some
- via Digitalmars-d-bugs (56/56) May 21 2014 https://issues.dlang.org/show_bug.cgi?id=12779
https://issues.dlang.org/show_bug.cgi?id=12779 Issue ID: 12779 Summary: [REG2.066a] -inline makes wrong code under some conditions Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Keywords: wrong-code Severity: regression Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: jiki red.email.ne.jp This issue is triggered by: https://github.com/D-Programming-Language/dmd/pull/2561 I have struggled to reduce it though it is rather complicated. SOURCE FILES: *lib.d --------- module lib; void test( string data) { auto ret = new Foo(); ret.data = data; assert(ret.data.length < 1_000_000); // OK! ret.check(); // NG } class Foo { // Removing this or changing order of these members // affects the runtime behavior ... version (defined) { int[int] unusedAA; } string data; void check() { assert(data.length < 1_000_000); // NG! } } *main.d --------- import lib; void main() { string data = "text"; test( data); } COMMANDS(compile and run): dmd.exe -lib -version=defined lib.d dmd.exe -g -inline inlinebug.d lib.lib inlinebug.exe OUTPUT: core.exception.AssertError lib.d(20): Assertion failure ---------------- 0x00402487 in _d_assert 0x004020DB in void lib.Foo.check() 0x0040206C in _Dmain --
May 21 2014