www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11939] New: selective imports inside a scope(failure) block cause compiler segfault

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11939

           Summary: selective imports inside a scope(failure) block cause
                    compiler segfault
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: zorael gmail.com


--- Comment #0 from JR <zorael gmail.com> 2014-01-16 13:30:42 PST ---
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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 16 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11939


hsteoh quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
                 CC|                            |hsteoh quickfur.ath.cx
           Severity|normal                      |critical


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 19 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11939


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
                 CC|                            |yebblies gmail.com
         AssignedTo|nobody puremagic.com        |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2014-02-04 22:50:37 EST ---
void test11939()
{
    scope(failure)
    {
        import object : Object;
    }
    throw new Exception("");
}

https://github.com/D-Programming-Language/dmd/pull/3206

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11939



--- Comment #2 from github-bugzilla puremagic.com 2014-02-04 13:23:08 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/0084fe621b86ee022d05822b8f46adbabfec23f1
Fix Issue 11939 - selective imports inside a scope(failure) block cause
compiler segfault

https://github.com/D-Programming-Language/dmd/commit/b85715496da22739e796f904c68c30379b7bed08
Merge pull request #3206 from yebblies/issue11939

Issue 11939 - selective imports inside a scope(failure) block cause compiler
segfault

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11939


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2014