www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10673] New: memory corruption in interpret.c

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

           Summary: memory corruption in interpret.c
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code dawg.eu


--- Comment #0 from Martin Nowak <code dawg.eu> 2013-07-19 04:33:08 PDT ---
During a compilation I kept triggering the following assertion.

assert(e != EXP_CONTINUE_INTERPRET && e != EXP_BREAK_INTERPRET);

https://github.com/D-Programming-Language/dmd/blob/de687981f72b0256b1dc1233306b4cfe94db626c/src/interpret.c#L976

While trying to reduce the test case it turned out that this must be a memory
corruption, i.e. with ASLR it only asserts sometimes. When I removed unrelated
modules from the compilation the error would go away.

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



--- Comment #1 from Martin Nowak <code dawg.eu> 2013-07-19 04:42:42 PDT ---
valgrind ../dmd/src/dmd -I../druntime/import  -w -d -property -m32 -fPIC -g
-debug -shared -unittest -ofgenerated/linux/debug/32/unittest/libphobos2-ut.so
crc32.d std/algorithm.d std/array.d std/ascii.d std/container.d std/conv.d
std/cstream.d std/csv.d std/datetime.d std/demangle.d std/encoding.d
std/exception.d std/file.d std/format.d std/functional.d std/getopt.d std/md5.d
std/metastrings.d std/mmfile.d std/regex.d
../druntime/lib/libdruntime-linux32so.a -defaultlib= -debuglib=                 
==4040== Memcheck, a memory error detector
==4040== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==4040== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==4040== Command: ../dmd/src/dmd -I../druntime/import -w -d -property -m32
-fPIC -g -debug -shared -unittest
-ofgenerated/linux/debug/32/unittest/libphobos2-ut.so crc32.d std/algorithm.d
std/array.d std/ascii.d std/container.d std/conv.d std/cstream.d std/csv.d
std/datetime.d std/demangle.d std/encoding.d std/exception.d std/file.d
std/format.d std/functional.d std/getopt.d std/md5.d std/metastrings.d
std/mmfile.d std/regex.d ../druntime/lib/libdruntime-linux32so.a -defaultlib=
-debuglib=
==4040== 
The 'crc32' module has been scheduled for deprecation. Please use
'std.digest.crc' instead.
std.md5 is scheduled for deprecation. Please use std.digest.md instead
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51D30A: BreakStatement::interpret(InterState*)
(interpret.c:1391)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D9B0: SwitchStatement::interpret(InterState*)
(interpret.c:1635)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51D30A: BreakStatement::interpret(InterState*)
(interpret.c:1391)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C7CF: UnrolledLoopStatement::interpret(InterState*)
(interpret.c:1096)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D9B0: SwitchStatement::interpret(InterState*)
(interpret.c:1635)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51C81F: UnrolledLoopStatement::interpret(InterState*)
(interpret.c:1109)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D9B0: SwitchStatement::interpret(InterState*)
(interpret.c:1635)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x51C6C0: ExpStatement::interpret(InterState*)
(interpret.c:1044)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51C824: UnrolledLoopStatement::interpret(InterState*)
(interpret.c:1109)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D9B0: SwitchStatement::interpret(InterState*)
(interpret.c:1635)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x51C6C0: ExpStatement::interpret(InterState*)
(interpret.c:1044)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51D8CF: SwitchStatement::interpret(InterState*)
(interpret.c:1639)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x51C6C0: ExpStatement::interpret(InterState*)
(interpret.c:1044)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51D8D4: SwitchStatement::interpret(InterState*)
(interpret.c:1639)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51D69E: ForStatement::interpret(InterState*)
(interpret.c:1533)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x51C6C0: ExpStatement::interpret(InterState*)
(interpret.c:1044)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51D78F: ForStatement::interpret(InterState*)
(interpret.c:1541)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x51C6C0: ExpStatement::interpret(InterState*)
(interpret.c:1044)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x526BE3: CommaExp::interpret(InterState*, CtfeGoal)
(interpret.c:4787)
==4040== 
==4040== Conditional jump or move depends on uninitialised value(s)
==4040==    at 0x51D794: ForStatement::interpret(InterState*)
(interpret.c:1541)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x51C6C0: ExpStatement::interpret(InterState*)
(interpret.c:1044)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x51C740: CompoundStatement::interpret(InterState*)
(interpret.c:1071)
==4040==    by 0x5238F5: FuncDeclaration::interpret(InterState*,
Array<Expression>*, Expression*) (interpret.c:954)
==4040==    by 0x52553D: CallExp::interpret(InterState*, CtfeGoal)
(interpret.c:4713)
==4040==    by 0x526BE3: CommaExp::interpret(InterState*, CtfeGoal)
(interpret.c:4787)
==4040== 
dmd: interpret.c:976: Expression* FuncDeclaration::interpret(InterState*,
Expressions*, Expression*): Assertion `e != EXP_CONTINUE_INTERPRET && e !=
EXP_BREAK_INTERPRET' failed.
==4040== 
==4040== HEAP SUMMARY:
==4040==     in use at exit: 3,864,184,382 bytes in 8,707,602 blocks
==4040==   total heap usage: 11,232,324 allocs, 2,524,722 frees, 7,045,249,464
bytes allocated
==4040== 
==4040== LEAK SUMMARY:
==4040==    definitely lost: 319,193,003 bytes in 3,779,713 blocks
==4040==    indirectly lost: 42,443,969 bytes in 596,896 blocks
==4040==      possibly lost: 3,472,644,660 bytes in 4,150,273 blocks
==4040==    still reachable: 29,902,750 bytes in 180,720 blocks
==4040==         suppressed: 0 bytes in 0 blocks
==4040== Rerun with --leak-check=full to see details of leaked memory
==4040== 
==4040== For counts of detected and suppressed errors, rerun with: -v
==4040== Use --track-origins=yes to see where uninitialised values come from
==4040== ERROR SUMMARY: 10 errors from 8 contexts (suppressed: 2 from 2)

-- 
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=10673


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Severity|normal                      |regression


--- Comment #2 from Martin Nowak <code dawg.eu> 2013-07-19 04:50:17 PDT ---
This is a regression introduced with the fix to bug 10475.

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

-- 
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=10673



--- Comment #3 from github-bugzilla puremagic.com 2013-07-19 07:00:29 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ea416a3496467ba4ccf875c70e76873a322d92ba
fix Issue 10673 - memory corruption in interpret.c

- the gotoTarget field of LabelStatement was never initialized

https://github.com/D-Programming-Language/dmd/commit/e9fdb8c4527c2c3f7e080fad9d21dd4f4710488f
Merge pull request #2363 from dawgfoto/fix10673

fix Issue 10673 - memory corruption in interpret.c

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


yebblies <yebblies gmail.com> changed:

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


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