Bug 11939 – selective imports inside a scope(failure) block cause compiler segfault
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-01-16T13:30:00Z
Last change time
2014-05-24T20:48:59Z
Keywords
ice, pull
Assigned to
yebblies
Creator
zorael
Comments
Comment #0 by zorael — 2014-01-16T13:30:42Z
dmd (git master, cb5ace9) and ldc (merge-2.065 branch, fc8ddb) segfault when compiling the following, as does dpaste with its dmd 2.064.2 compiler (http://dpaste.dzfl.pl/e071e049):
---------------------------------------
import std.stdio;
void main() {
scope(failure)
{
import std.string : toUpper;
writeln("nanana".toUpper);
}
writeln("hello world!");
}
---------------------------------------
Changing the import line to instead import all of std.string makes it compile again. scope(success) and scope(exit) don't seem to trigger this behavior.
gdb output is as follows:
---------------------------------------
Program received signal SIGSEGV, Segmentation fault.
Dsymbol::search_correct (this=0x857d80, ident=0x1) at dsymbol.c:436
436 return (Dsymbol *)speller(ident->toChars(), &symbol_search_fp, (void *)this, idchars);
(gdb) bt
#0 Dsymbol::search_correct (this=0x857d80, ident=0x1) at dsymbol.c:436
#1 0x00000000004928ea in Import::semantic (this=0x857d80, sc=0x45b5c00) at import.c:263
#2 0x00000000004e5233 in ImportStatement::semantic (this=0x857ea0, sc=0x45b3e50) at statement.c:5406
#3 0x00000000004eb53a in CompoundStatement::semantic (this=0x45bb4c0, sc=0x45b3e50) at statement.c:635
#4 0x00000000004e865a in ScopeStatement::semantic (this=0x858260, sc=0x45b3e50) at statement.c:1071
#5 0x00000000004eb53a in CompoundStatement::semantic (this=0x45ba8b0, sc=0x3d44cb0) at statement.c:635
#6 0x00000000004edd84 in Catch::semantic (this=this@entry=0x45ba910, sc=0x3d44cb0, sc@entry=0x3d44bb0) at statement.c:4768
#7 0x00000000004edf29 in TryCatchStatement::semantic (this=0x45ba950, sc=0x3d44bb0) at statement.c:4594
#8 0x00000000004eba75 in CompoundStatement::semantic (this=0x8583d0, sc=0x3d44bb0) at statement.c:692
#9 0x0000000000474ea9 in FuncDeclaration::semantic3 (this=<optimized out>, sc=0x3d448c0) at func.c:1330
#10 0x00000000004a7120 in Module::semantic3 (this=this@entry=0x8573a0) at module.c:811
#11 0x00000000004a48dc in tryMain (argc=9, argv=0x863140) at mars.c:1546
#12 0x00007ffff6ff8de5 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#13 0x0000000000402e45 in _start ()
(gdb) explore value ident
'ident' is a pointer to a value of type 'Identifier'
Continue exploring it as a pointer to a single value [y/n]: y
'ident' a pointer pointing to an invalid memory location.