Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
August 12, 2011 [Issue 6473] New: segfault in Lexer::uniqueId | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6473 Summary: segfault in Lexer::uniqueId Product: D Version: D1 & D2 Platform: All OS/Version: All Status: NEW Keywords: ice-on-valid-code Severity: major Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: mrmocool@gmx.de --- Comment #0 from Trass3r <mrmocool@gmx.de> 2011-08-11 19:08:12 PDT --- struct Eins { ~this() {} } struct Zwei { void build(Eins devices = Eins()) { } } $ gdb --batch -ex "run program.d" -ex "bt 10" dmd DMD v2.054 DEBUG Program received signal SIGSEGV, Segmentation fault. 0x00007ffff72e4893 in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6 #0 0x00007ffff72e4893 in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6 #1 0x00007ffff730af02 in vsnprintf () from /lib/x86_64-linux-gnu/libc.so.6 #2 0x00007ffff72efc4f in snprintf () from /lib/x86_64-linux-gnu/libc.so.6 #3 0x00000000004fa225 in Lexer::uniqueId (s=0x5b4aaa "__sl", num=8590) at lexer.c:2881 #4 0x00000000004fa277 in Lexer::uniqueId (s=0x5b4aaa "__sl") at lexer.c:2888 #5 0x00000000004a0204 in StructLiteralExp::semantic (this=0x1128b80, sc=0x1128a70) at expression.c:3648 #6 0x000000000047281d in VarDeclaration::semantic (this=0x1128890, sc=0x1128a70) at declaration.c:1280 #7 0x00000000004a4390 in DeclarationExp::semantic (this=0x1128990, sc=0x1128670) at expression.c:4910 #8 0x00000000004a66f5 in BinExp::semantic (this=0x1128a20, sc=0x1128670) at expression.c:5626 #9 0x00000000004a6881 in BinExp::semanticp (this=0x1128a20, sc=0x1128670) at expression.c:5646 build as a free function doesn't trigger it. Nor does a global 'Eins devices = Eins();'. btw, lexer.c(2876): Identifier *Lexer::uniqueId(const char *s, int num) { char buffer[32]; size_t slen = strlen(s); assert(slen + sizeof(num) * 3 + 1 <= sizeof(buffer)); sprintf(buffer, "%s%d", s, num); Why that sizeof(num) there? It's always 4. Why isn't snprintf(buffer, 32.... used? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 19, 2011 [Issue 6473] Stack overflow with struct destructor as default parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=6473 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au Version|D1 & D2 |D2 Summary|segfault in Lexer::uniqueId |Stack overflow with struct | |destructor as default | |parameter --- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-09-19 02:10:40 PDT --- It's not a segfault, and it has nothing to do with Lexer::uniqueId. It's a stack overflow. It's also D2-only, because it requires a struct destructor. StructLiteralExp::semantic() sees that Eins has a destructor, so it rewrites it as Eins devices = (Eins tmp = Eins(), tmp); Then, it runs semantic on the comma expression it created. VarDeclaration::semantic on tmp calls StructLiteralExp::semantic, which again sees Eins has destructor, so it does an another rewrite. Eins devices = (Eins tmp = (Eins tmp2 = Eins(), tmp2), tmp); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 18, 2011 [Issue 6473] Stack overflow with struct destructor as default parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=6473 --- Comment #2 from Trass3r <mrmocool@gmx.de> 2011-10-18 05:01:06 PDT --- Very interesting. Any idea how to solve it? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 22, 2011 [Issue 6473] Stack overflow with struct destructor as default parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=6473 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-22 01:26:55 PST --- https://github.com/D-Programming-Language/dmd/pull/575 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 01, 2012 [Issue 6473] Stack overflow with struct destructor as default parameter | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | http://d.puremagic.com/issues/show_bug.cgi?id=6473 Trass3r <mrmocool@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #4 from Trass3r <mrmocool@gmx.de> 2012-02-01 13:03:49 CET --- https://github.com/D-Programming-Language/dmd/commit/4bda5de701e817b5ea4967fb311350e854a70dde -- 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