www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler crash (passing a temp into an inout func. param.)

reply Dave <Dave_member pathlink.com> writes:
Compiling this code with DMD 0.128 on both Windows and Linux:

void main() { foo(bar()); }
void foo(inout int i) {}
int bar() { return 10; }

will crash the compiler immediately after the error message:

error.d(3): bar() is not an lvalue

is printed out.
Jul 19 2005
next sibling parent Chris Sauls <ibisbasenji gmail.com> writes:
Dave wrote:
 Compiling this code with DMD 0.128 on both Windows and Linux:
 
 void main() { foo(bar()); }
 void foo(inout int i) {}
 int bar() { return 10; }
 
 will crash the compiler immediately after the error message:
 error.d(3): bar() is not an lvalue

Looks like an extension to the bug I posted not long ago. Apparently the real bug you and I have run into boils down to: inout parameters don't like expressions, including assignments, invocations, and .dup's. -- Chris Sauls
Jul 19 2005
prev sibling parent reply Thomas Kuehne <thomas-dloop kuehne.this-is-spam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dave schrieb am Tue, 19 Jul 2005 16:55:02 +0000 (UTC):
 Compiling this code with DMD 0.128 on both Windows and Linux:

 void main() { foo(bar()); }
 void foo(inout int i) {}
 int bar() { return 10; }

 will crash the compiler immediately after the error message:

 error.d(3): bar() is not an lvalue

 is printed out.

- -> dmd/src/dmd/expression.c:517 -----BEGIN PGP SIGNATURE----- iD8DBQFC3fAg3w+/yD4P9tIRAlfjAJ44gR6ru5gk9yAH6H0RS9o4bfbjrgCdEMzf efh27o2ANs9bKPY0b2hUZYg= =If4g -----END PGP SIGNATURE-----
Jul 19 2005
parent reply Chris Sauls <ibisbasenji gmail.com> writes:
Thomas Kuehne wrote:
 - -> dmd/src/dmd/expression.c:517

# # Expression *Expression::toLvalue(Expression *e) # # { # # if (!e) # # e = this; # # else if (!loc.filename) # # loc = e->loc; # # error("%s is not an lvalue", e->toChars()); #this one --># *(char*)0=0; # # return this; # # } I'm confounded. -- Chris Sauls
Jul 19 2005
next sibling parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Chris Sauls" <ibisbasenji gmail.com> wrote in message 
news:dbkrgj$1kq5$1 digitaldaemon.com...
 Thomas Kuehne wrote:
 - -> dmd/src/dmd/expression.c:517

# # Expression *Expression::toLvalue(Expression *e) # # { # # if (!e) # # e = this; # # else if (!loc.filename) # # loc = e->loc; # # error("%s is not an lvalue", e->toChars()); #this one --># *(char*)0=0; # # return this; # # } I'm confounded.

Oh. Oh, my. Well that explains all these crashes.
Jul 20 2005
prev sibling parent "Walter" <newshound digitalmars.com> writes:
"Chris Sauls" <ibisbasenji gmail.com> wrote in message
news:dbkrgj$1kq5$1 digitaldaemon.com...
 Thomas Kuehne wrote:
 - -> dmd/src/dmd/expression.c:517

# # Expression *Expression::toLvalue(Expression *e) # # { # # if (!e) # # e = this; # # else if (!loc.filename) # # loc = e->loc; # # error("%s is not an lvalue", e->toChars()); #this one --># *(char*)0=0; # # return this; # # } I'm confounded.

LOL. That's detritus left over from debugging. I insert those so it'll die at runtime under the debugger, giving me a stack trace. Sometimes, I forget to remove them.
Jul 23 2005