August 20, 2014 [Issue 13339] New: Address of parameter wrong in out contract | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13339 Issue ID: 13339 Summary: Address of parameter wrong in out contract Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: tim.dlang@t-online.de The following code results in a segmentation fault at runtime when compiled with DMD 2.066 on Arch Linux x86_64: import std.stdio; class A { int x; } class B { void test(size_t i, A a) out { writeln("after: ", &a); auto x = a.x; // Segmentation fault writeln(a.x); } body { void delegate() dg = {size_t s = i;}; writeln("before: ", &a); } } void main() { B b = new B; b.test(1234, new A); } The output shows, that the address of a is different in body and out constract: before: 7FFFC53B81A0 after: 7FA64F4BBFE8 When compiled with LDC 0.14 there is no segmentation fault, but the addresses are still different and the value of a.x is wrong. With GDC 4.9.1 the code does not compile with the following error message: ebnftests.d: In member function '__ensure': ebnftests.d:12: internal compiler error: in expand_expr_real_1, at expr.c:9454 Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.archlinux.org/> for instructions. -- |
Copyright © 1999-2021 by the D Language Foundation