Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
October 09, 2010 [Issue 5026] New: Incomplete mixin expression + char[] to char assignment = assertion failure in expression.c | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=5026 Summary: Incomplete mixin expression + char[] to char assignment = assertion failure in expression.c Product: D Version: D1 Platform: Other OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: strtr@despam.it --- Comment #0 from strtr@despam.it 2010-10-09 11:10:11 PDT --- Assertion failure: '0' on line 1342 in file 'expression.c' void foo() { char[0] code; code[0] = ""; } struct Bar { int i = mixin(foo()); } void main() {} -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 18, 2010 [Issue 5026] ICE(expression.c) Incomplete mixin expression + char[] to char assignment | ||||
---|---|---|---|---|
| ||||
Posted in reply to strtr@despam.it | http://d.puremagic.com/issues/show_bug.cgi?id=5026 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-10-18 13:27:37 PDT --- There are two independent issues here. The superficial diagnostic bug is that mixin() shouldn't accept a void function at all. expression.c, line 5569. Actually the second error message here is optional, since there should have already been a "cannot be evaluated at compile time" error message. Expression *CompileExp::semantic(Scope *sc) { #if LOGSEMANTIC printf("CompileExp::semantic('%s')\n", toChars()); #endif UnaExp::semantic(sc); e1 = resolveProperties(sc, e1); + if (!e1->type->isString()) { + error("argument to mixin must be a string, not (%s)\n", e1->toChars()); + return new ErrorExp(); + } e1 = e1->optimize(WANTvalue | WANTinterpret); if (e1->op != TOKstring) - { error("argument to mixin must be a string, not (%s)\n", e1->toChars()); + { error("argument to mixin must be evaluated at compile time"); return new ErrorExp(); } The more important bug, which causes the ICE, is that declaration.c line 1212 is gagging the results. Then, interpret.c runs semantic3 on the function while results are gagged. The errors get suppressed, so garbage gets passed to the back end. func.c, semantic3(), line 1592. sc2->callSuper = 0; sc2->pop(); } + if (global.gag && global.errors) + semanticRun = PASSsemanticdone; // Ensure errors get reported again + else semanticRun = PASSsemantic3done; } void FuncDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 18, 2010 [Issue 5026] ICE(expression.c) Incomplete mixin expression + char[] to char assignment | ||||
---|---|---|---|---|
| ||||
Posted in reply to strtr@despam.it | http://d.puremagic.com/issues/show_bug.cgi?id=5026 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|D1 |D1 & D2 --- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-10-18 13:29:49 PDT --- And a couple of test cases. string bug5026() { char[0] code; code[0] = "0"; return "0"; } template compiles(int T) { bool compiles = true; } // ICE(glue.c) static assert(!is(typeof(compiles!(mixin(bug5026()))))); // ICE(expression.c) static assert(!is(typeof(mixin(bug5026())))); // This example is an accepts-valid bug string bug5026c() { char[0] code; code[0] = 7; return "0"; } static assert(!is(typeof(mixin(bug5026c())))); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 20, 2010 [Issue 5026] ICE(expression.c) Incomplete mixin expression + char[] to char assignment | ||||
---|---|---|---|---|
| ||||
Posted in reply to strtr@despam.it | http://d.puremagic.com/issues/show_bug.cgi?id=5026 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2010-10-19 22:52:31 PDT --- http://www.dsource.org/projects/dmd/changeset/721 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 20, 2010 [Issue 5026] ICE(expression.c) Incomplete mixin expression + char[] to char assignment | ||||
---|---|---|---|---|
| ||||
Posted in reply to strtr@despam.it | http://d.puremagic.com/issues/show_bug.cgi?id=5026 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation