www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10398] New: Dmd bugs detected by memcheck when compile druntime+phobos

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

           Summary: Dmd bugs detected by memcheck when compile
                    druntime+phobos
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic, ice
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: maxim maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim maxim-fomin.ru> 2013-06-18 02:22:01 PDT
---
Memcheck reports following traces:

1) Issue in Lexer::scan() or Lexer::nextToken()

==8678== Invalid write of size 8
==8678==    at 0x4E0E20: Lexer::scan(Token*) (lexer.c:464)
==8678==    by 0x4E0BA4: Lexer::nextToken() (lexer.c:333)
==8678==    by 0x525082: Parser::parseStatement(int, unsigned char**)
(parse.c:3972)
==8678==    by 0x523907: Parser::parseContracts(FuncDeclaration*)
(parse.c:3378)
==8678==    by 0x523217: Parser::parseDeclarations(unsigned long, unsigned
char*) (parse.c:3238)
==8678==    by 0x51B2E0: Parser::parseDeclDefs(int, Dsymbol**) (parse.c:237)
==8678==    by 0x51CFB4: Parser::parseBlock(Dsymbol**) (parse.c:872)
==8678==    by 0x51C7E5: Parser::parseDeclDefs(int, Dsymbol**) (parse.c:663)
==8678==    by 0x51AF50: Parser::parseModule() (parse.c:132)
==8678==    by 0x4ED93E: Module::parse() (module.c:498)
==8678==    by 0x4EB000: tryMain(unsigned long, char**) (mars.c:1396)
==8678==    by 0x4EBE5F: main (mars.c:1715)
==8678==  Address 0x7feffeab8 is on thread 1's stack

This repeats several times with difference in read/write status and source line
is sometimes 464, 465, 468, 469, 472, 474, etc. Sometimes trace is

==9132==    at 0x4E619F: isidchar(unsigned char) (lexer.c:52)
==9132==    by 0x4E0BA4: Lexer::nextToken() (lexer.c:333)
==9132==    by 0x525082: Parser::parseStatement(int, unsigned char**)
(parse.c:3972)
....

2) Issue in reghasvalue():

==9140== Conditional jump or move depends on uninitialised value(s)
==9140==    at 0x42A546: reghasvalue (cgen.c:442)
==9140==    by 0x5E772A: simplify_code (cod3.c:5120)
==9140==    by 0x429E4F: gen (cgen.c:180)
==9140==    by 0x5D8677: cdind (cod2.c:2787)
==9140==    by 0x41DD37: codelem (cgcod.c:2481)
==9140==    by 0x5C6CCB: logexp (cod1.c:516)
==9140==    by 0x5C6A48: logexp (cod1.c:472)
==9140==    by 0x5DE01B: outblkexitcode (cod3.c:765)
==9140==    by 0x41B9FA: blcodgen(block*) (cgcod.c:1298)
==9140==    by 0x4195BE: codgen (cgcod.c:243)
==9140==    by 0x519F6A: writefunc2(Symbol*) (out.c:1224)
==9140==    by 0x519882: writefunc(Symbol*) (out.c:897)

3) Issue in peephole():

==9265== Conditional jump or move depends on uninitialised value(s)
==9265==    at 0x5C5566: peephole(code*, unsigned int) (cgsched.c:2927)
==9265==    by 0x5C19E0: cgsched_pentium(code**, unsigned int) (cgsched.c:91)
==9265==    by 0x5C1ACC: cgsched_block (cgsched.c:112)
==9265==    by 0x419A00: codgen (cgcod.c:330)
==9265==    by 0x519F6A: writefunc2(Symbol*) (out.c:1224)
==9265==    by 0x519882: writefunc(Symbol*) (out.c:897)
==9265==    by 0x4C49BD: FuncDeclaration::toObjFile(int) (glue.c:1043)
==9265==    by 0x4C2A3A: Module::genobjfile(int) (glue.c:350)
==9265==    by 0x4EBABB: tryMain(unsigned long, char**) (mars.c:1625)
==9265==    by 0x4EBE5F: main (mars.c:1715)

4) Issue in asm_is_fpreg() which looks like related to #1:

==9274== Invalid read of size 1
==9274==    at 0x4CDB46: asm_is_fpreg(char*) (iasm.c:2241)
==9274==    by 0x4D1CB2: asm_primary_exp() (iasm.c:4402)
==9274==    by 0x4D196A: asm_una_exp() (iasm.c:4270)
==9274==    by 0x4D1738: asm_br_exp() (iasm.c:4146)
==9274==    by 0x4D142D: asm_mul_exp() (iasm.c:4069)
==9274==    by 0x4D133A: asm_add_exp() (iasm.c:4030)
==9274==    by 0x4D11FB: asm_shift_exp() (iasm.c:4002)
==9274==    by 0x4D109B: asm_rel_exp() (iasm.c:3952)
==9274==    by 0x4D0F37: asm_equal_exp() (iasm.c:3909)
==9274==    by 0x4D0E7A: asm_and_exp() (iasm.c:3886)
==9274==    by 0x4D0DBD: asm_xor_exp() (iasm.c:3863)
==9274==    by 0x4D0D00: asm_inc_or_exp() (iasm.c:3840)
==9274==  Address 0x5e450ca is 0 bytes after a block of size 42 alloc'd
==9274==    at 0x4C2A0B4: calloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9274==    by 0x4EC45E: Mem::calloc(unsigned long, unsigned long) (rmem.c:60)
==9274==    by 0x54F38F: StringEntry::alloc(char const*, unsigned long)
(stringtable.c:98)
==9274==    by 0x54F587: StringTable::update(char const*, unsigned long)
(stringtable.c:156)
==9274==    by 0x4E13CE: Lexer::scan(Token*) (lexer.c:618)
==9274==    by 0x4E0C03: Lexer::peek(Token*) (lexer.c:347)
==9274==    by 0x4E0C3C: Lexer::peekNext() (lexer.c:359)
==9274==    by 0x524A34: Parser::parseStatement(int, unsigned char**)
(parse.c:3866)
==9274==    by 0x5250B9: Parser::parseStatement(int, unsigned char**)
(parse.c:3978)
==9274==    by 0x51E1B6: Parser::parseUnitTest() (parse.c:1320)
==9274==    by 0x51B41D: Parser::parseDeclDefs(int, Dsymbol**) (parse.c:275)
==9274==    by 0x51AF50: Parser::parseModule() (parse.c:132)

5) Finally compilation is aborted with following error:
std/math.d(2265): Error: static assert  (false && 0.00000L * infL <=
cast(real)4) is false.

Marked as diagnostic as compilation aborts with error message and ice as these
may be bugs in dmd.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 18 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code dawg.eu


--- Comment #1 from Martin Nowak <code dawg.eu> 2013-07-19 06:08:51 PDT ---
What were your compiler arguments and input source files? Being able to
reproduce the error is necessary to fix any bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398



--- Comment #2 from Maxim Fomin <maxim maxim-fomin.ru> 2013-07-19 09:46:00 PDT
---
Created an attachment (id=1235)
Valgrind output

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398



--- Comment #3 from Maxim Fomin <maxim maxim-fomin.ru> 2013-07-19 09:49:20 PDT
---
(In reply to comment #1)
 What were your compiler arguments and input source files? Being able to
 reproduce the error is necessary to fix any bug.
1) go to druntime/posix.mak 2) replace approx. line 32 with 'DMD?= valgrind dmd' 3) to to phobos/posix.mak 4) replace approx line 99 with 'DMD ?= valgrind dmd' This will print memory errors during full druntime + phobos compilation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 19 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2013-08-27
18:07:59 PDT ---
Fix item 4: https://github.com/D-Programming-Language/dmd/pull/2502

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398



--- Comment #5 from Walter Bright <bugzilla digitalmars.com> 2013-08-27
18:08:22 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2486

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 27 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398



--- Comment #6 from github-bugzilla puremagic.com 2013-08-28 12:53:24 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/43b86fc68f1fb33e174048117dc5e6b910762045
fix Issue 10398 - Dmd bugs detected by memcheck when compile druntime+phobos

https://github.com/D-Programming-Language/dmd/commit/0362ae81d1cba6d2c4a135e40c40ddaf5617601f
Merge pull request #2502 from WalterBright/iasm-buf-overflow

fix Issue 10398 - Dmd bugs detected by memcheck when compile druntime+ph...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10398



--- Comment #7 from github-bugzilla puremagic.com 2013-08-28 13:05:29 PDT ---
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/f70645446811fa14001b0f2ffa1b73266cd91a73
Merge pull request #2502 from WalterBright/iasm-buf-overflow

fix Issue 10398 - Dmd bugs detected by memcheck when compile druntime+ph...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2013