www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 17] New: Nasty interface contract bug

http://gdcproject.org/bugzilla/show_bug.cgi?id=17


           Summary: Nasty interface contract bug
    Classification: Unclassified
           Product: GDC
           Version: development
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: Normal
         Component: gdc
        AssignedTo: ibuclaw gdcproject.org
        ReportedBy: alex lycus.org


I could not reproduce this bug outside of MCI, but here are the instructions to
do so in MCI for what it's worth:

$ git clone git://github.com/lycus/mci.git
$ ./bootstrap.py
$ ./waf configure --check-d-compiler=gdc
$ ./waf build
$ ./waf test

This last step is going to fail. Fire up GDB:

$ gdb --args ./build/mci asm tests/assembler/pass/test0.ial -o
tests/assembler/pass/test0.mci -d tests/assembler/pass/test0.ast

(gdb) run
Starting program: /home/alexrp/Projects/mci/build/mci asm
tests/assembler/pass/test0.ial -o tests/assembler/pass/test0.mci -d
tests/assembler/pass/test0.ast
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000436917 in std.path.__T15extSeparatorPosTaZ.extSeparatorPos()
(path=...) at /opt/gdc/include/d/4.8.0/std/path.d:629
629        while (i >= 0 && !isSeparator(path[i]))

One thing is very clearly wrong here:

(gdb) print path.length
$1 = 140737488345808
(gdb) print path.ptr
$2 = 0x7fffffffe82b "test0.mci"

The length is completely wrong, but the pointer is OK. Let's go up a few
frames:

(gdb) bt

(path=...) at /opt/gdc/include/d/4.8.0/std/path.d:629

/opt/gdc/include/d/4.8.0/std/path.d:656

(this=0x7fffffffda90) at ../src/mci/core/code/modules.d:410

module_=..., path=...) at ../src/mci/vm/io/writer.d:37

(this=..., args=...) at ../src/mci/cli/tools/assembler.d:195

../src/mci/cli/main.d:159


../../../../gcc-4.8-20121014/libphobos/libdruntime/rt/dmain2.d:569

dg=...) at ../../../../gcc-4.8-20121014/libphobos/libdruntime/rt/dmain2.d:544

../../../../gcc-4.8-20121014/libphobos/libdruntime/rt/dmain2.d:579

dg=...) at ../../../../gcc-4.8-20121014/libphobos/libdruntime/rt/dmain2.d:544

../../../../gcc-4.8-20121014/libphobos/libdruntime/rt/dmain2.d:588
(gdb) frame 3

module_=..., path=...) at ../src/mci/vm/io/writer.d:37
37        public void save(Module module_, string path)
(gdb) print path.length
$3 = 30
(gdb) print path.ptr
$4 = 0x7fffffffe816 "tests/assembler/pass/test0.mci"

Looks OK. Then:

(gdb) print path.length
$5 = 140737488345680
(gdb) print path.ptr
$6 = 0x5bc828 <mci.core.code.modules.ModuleSaver.save()+258>
"H\211\301H\211\323H\211\316H\211\320A\270"
(gdb) print path.length
$5 = 140737488345680
(gdb) print path.ptr
$6 = 0x5bc828 <mci.core.code.modules.ModuleSaver.save()+258>
"H\211\301H\211\323H\211\316H\211\320A\270"

I'm pretty sure GDC is generating bad code here...

-- 
Configure issuemail: http://gdcproject.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all issue changes.
Oct 21 2012