Thread overview
[Issue 307] New: Inline assembler function call
Aug 23, 2006
d-bugmail
Sep 19, 2006
d-bugmail
Sep 20, 2006
d-bugmail
Nov 25, 2006
d-bugmail
Dec 17, 2006
d-bugmail
Dec 17, 2006
d-bugmail
August 23, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=307

           Summary: Inline assembler function call
           Product: GDC
           Version: 0.19
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: glue layer
        AssignedTo: braddr@puremagic.com
        ReportedBy: m.faustino@gmail.com


Using inline assembler to make a function call makes the compiler generate a segmentation fault:

//-----------------------------------------------
void main() {
  asm {
    call f;
  }
}

void f() {}
//-----------------------------------------------

With gdc 0.19, dmd 0.162 (gcc version 4.0.3).


-- 

September 19, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=307


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Comment #1 from bugzilla@digitalmars.com  2006-09-19 15:22 -------
Not reproducible with DMC 0.167.


-- 

September 20, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=307


thomas-dloop@kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




------- Comment #2 from thomas-dloop@kuehne.cn  2006-09-20 11:53 -------
This is a GDC issue(-> Product).
Source and destination overlap in memcpy(0x52699C0, 0x52699C8, 24)
   at 0x4A21C9E: memcpy (mc_replace_strmem.c:116)
   by 0xB9054: Array::remove(unsigned) (array.c:146)
   by 0x1289E7: CompoundStatement::semantic(Scope*) (statement.c:330)
   by 0xF1E2C: FuncDeclaration::semantic3(Scope*) (func.c:753)
   by 0x112A25: Module::semantic3() (module.c:697)
   by 0x146C76: d_parse_file(int) (d-lang.cc:982)
   by 0x654D88: toplev_main (toplev.c:1838)
   by 0x182387: main (main.c:35)

Invalid read of size 1
   at 0x4A21D32: memcpy (mc_replace_strmem.c:405)
   by 0xB9054: Array::remove(unsigned) (array.c:146)
   by 0x1289E7: CompoundStatement::semantic(Scope*) (statement.c:330)
   by 0xF1E2C: FuncDeclaration::semantic3(Scope*) (func.c:753)
   by 0x112A25: Module::semantic3() (module.c:697)
   by 0x146C76: d_parse_file(int) (d-lang.cc:982)
   by 0x654D88: toplev_main (toplev.c:1838)
   by 0x182387: main (main.c:35)
 Address 0x52699D8 is 0 bytes after a block of size 40 alloc'd
   at 0x4A20F51: realloc (vg_replace_malloc.c:306)
   by 0x1048B3: Mem::realloc(void*, unsigned long) (mem.c:90)
   by 0xB8BEF: Array::reserve(unsigned) (array.c:71)
   by 0xB8D21: Array::push(void*) (array.c:94)
   by 0x11ACE7: Parser::parseStatement(int) (parse.c:2471)
   by 0x11C251: Parser::parseContracts(FuncDeclaration*) (parse.c:2091)
   by 0x11A165: Parser::parseDeclarations() (parse.c:2009)
   by 0x11929C: Parser::parseDeclDefs(int) (parse.c:186)
   by 0x122321: Parser::parseModule() (parse.c:125)
   by 0x113EC5: Module::parse(bool) (module.c:554)
   by 0x1467A1: d_parse_file(int) (d-lang.cc:921)
   by 0x654D88: toplev_main (toplev.c:1838)

Invalid read of size 1
   at 0x4A21D3B: memcpy (mc_replace_strmem.c:405)
   by 0xB9054: Array::remove(unsigned) (array.c:146)
   by 0x1289E7: CompoundStatement::semantic(Scope*) (statement.c:330)
   by 0xF1E2C: FuncDeclaration::semantic3(Scope*) (func.c:753)
   by 0x112A25: Module::semantic3() (module.c:697)
   by 0x146C76: d_parse_file(int) (d-lang.cc:982)
   by 0x654D88: toplev_main (toplev.c:1838)
   by 0x182387: main (main.c:35)
 Address 0x52699D9 is 1 bytes after a block of size 40 alloc'd
   at 0x4A20F51: realloc (vg_replace_malloc.c:306)
   by 0x1048B3: Mem::realloc(void*, unsigned long) (mem.c:90)
   by 0xB8BEF: Array::reserve(unsigned) (array.c:71)
   by 0xB8D21: Array::push(void*) (array.c:94)
   by 0x11ACE7: Parser::parseStatement(int) (parse.c:2471)
   by 0x11C251: Parser::parseContracts(FuncDeclaration*) (parse.c:2091)
   by 0x11A165: Parser::parseDeclarations() (parse.c:2009)
   by 0x11929C: Parser::parseDeclDefs(int) (parse.c:186)
   by 0x122321: Parser::parseModule() (parse.c:125)
   by 0x113EC5: Module::parse(bool) (module.c:554)
   by 0x1467A1: d_parse_file(int) (d-lang.cc:921)
   by 0x654D88: toplev_main (toplev.c:1838)

Invalid read of size 1
   at 0x4A21D42: memcpy (mc_replace_strmem.c:405)
   by 0xB9054: Array::remove(unsigned) (array.c:146)
   by 0x1289E7: CompoundStatement::semantic(Scope*) (statement.c:330)
   by 0xF1E2C: FuncDeclaration::semantic3(Scope*) (func.c:753)
   by 0x112A25: Module::semantic3() (module.c:697)
   by 0x146C76: d_parse_file(int) (d-lang.cc:982)
   by 0x654D88: toplev_main (toplev.c:1838)
   by 0x182387: main (main.c:35)
 Address 0x52699DA is 2 bytes after a block of size 40 alloc'd
   at 0x4A20F51: realloc (vg_replace_malloc.c:306)
   by 0x1048B3: Mem::realloc(void*, unsigned long) (mem.c:90)
   by 0xB8BEF: Array::reserve(unsigned) (array.c:71)
   by 0xB8D21: Array::push(void*) (array.c:94)
   by 0x11ACE7: Parser::parseStatement(int) (parse.c:2471)
   by 0x11C251: Parser::parseContracts(FuncDeclaration*) (parse.c:2091)
   by 0x11A165: Parser::parseDeclarations() (parse.c:2009)
   by 0x11929C: Parser::parseDeclDefs(int) (parse.c:186)
   by 0x122321: Parser::parseModule() (parse.c:125)
   by 0x113EC5: Module::parse(bool) (module.c:554)
   by 0x1467A1: d_parse_file(int) (d-lang.cc:921)
   by 0x654D88: toplev_main (toplev.c:1838)

Invalid read of size 1
   at 0x4A21D4B: memcpy (mc_replace_strmem.c:405)
   by 0xB9054: Array::remove(unsigned) (array.c:146)
   by 0x1289E7: CompoundStatement::semantic(Scope*) (statement.c:330)
   by 0xF1E2C: FuncDeclaration::semantic3(Scope*) (func.c:753)
   by 0x112A25: Module::semantic3() (module.c:697)
   by 0x146C76: d_parse_file(int) (d-lang.cc:982)
   by 0x654D88: toplev_main (toplev.c:1838)
   by 0x182387: main (main.c:35)
 Address 0x52699DB is 3 bytes after a block of size 40 alloc'd
   at 0x4A20F51: realloc (vg_replace_malloc.c:306)
   by 0x1048B3: Mem::realloc(void*, unsigned long) (mem.c:90)
   by 0xB8BEF: Array::reserve(unsigned) (array.c:71)
   by 0xB8D21: Array::push(void*) (array.c:94)
   by 0x11ACE7: Parser::parseStatement(int) (parse.c:2471)
   by 0x11C251: Parser::parseContracts(FuncDeclaration*) (parse.c:2091)
   by 0x11A165: Parser::parseDeclarations() (parse.c:2009)
   by 0x11929C: Parser::parseDeclDefs(int) (parse.c:186)
   by 0x122321: Parser::parseModule() (parse.c:125)
   by 0x113EC5: Module::parse(bool) (module.c:554)
   by 0x1467A1: d_parse_file(int) (d-lang.cc:921)
   by 0x654D88: toplev_main (toplev.c:1838)

Invalid read of size 8
   at 0x17E707: AsmProcessor::slotExp(Expression*) (d-asm-i386.h:2008)
   by 0x181208: AsmProcessor::parse() (d-asm-i386.h:2101)
   by 0x17C731: AsmStatement::semantic(Scope*) (d-asm-i386.h:1204)
   by 0x128A3F: CompoundStatement::semantic(Scope*) (statement.c:344)
   by 0xF1E2C: FuncDeclaration::semantic3(Scope*) (func.c:753)
   by 0x112A25: Module::semantic3() (module.c:697)
   by 0x146C76: d_parse_file(int) (d-lang.cc:982)
   by 0x654D88: toplev_main (toplev.c:1838)
   by 0x182387: main (main.c:35)
 Address 0x5000000BE is not stack'd, malloc'd or (recently) free'd
./a.d:0: interner Compiler-Fehler: Speicherzugriffsfehler
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.


-- 

November 25, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=307


braddr@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|braddr@puremagic.com        |dvdfrdmn@users.sf.net
             Status|REOPENED                    |NEW




------- Comment #3 from braddr@puremagic.com  2006-11-25 15:08 -------
Mass reassignment of gdc bugs from me to David.


-- 

December 17, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=307


dvdfrdmn@users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 

December 17, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=307


dvdfrdmn@users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from dvdfrdmn@users.sf.net  2006-12-16 21:16 -------
Fixed in GDC 0.20


--