Thread overview
[dmd-internals] What should I do to reduce this for a bugzilla entry?
Jun 01, 2010
Jason House
Jun 01, 2010
Brad Roberts
Jun 01, 2010
Jason House
Jun 01, 2010
Don Clugston
Jun 01, 2010
Jason House
Jun 01, 2010
Don Clugston
May 31, 2010
Am I correct in assuming the easiest way to find out what's causing this issue is to make a custom build of dmd with -DLOG go GFLAGS in linux.mak?

$ dmd | head -n 1
Digital Mars D Compiler v2.046

$ dmd -c *.d -offoo
dmd: interpret.c:190: Expression*
FuncDeclaration::interpret(InterState*, Expressions*, Expression*):
Assertion `istate' failed.
Aborted

$ dmd -v -c *.d -offoo
binary    dmd
version   v2.046
config    /usr/local/bin/dmd.conf
parse     board
parse     color
parse     fast_map
parse     fast_random
parse     fast_stack
parse     hash
parse     move
parse     player
parse     testing
parse     utils
parse     vertex
importall board
import    object	(/usr/local/bin/../include/druntime/import/object.di)
import    std.date	(/usr/local/bin/../include/phobos/std/date.d)
import    std.stdio	(/usr/local/bin/../include/phobos/std/stdio.d)
import    core.stdc.stdio
(/usr/local/bin/../include/druntime/import/core/stdc/stdio.d)
import    core.stdc.config
(/usr/local/bin/../include/druntime/import/core/stdc/config.d)
import    core.stdc.stddef
(/usr/local/bin/../include/druntime/import/core/stdc/stddef.d)
import    core.stdc.stdarg
(/usr/local/bin/../include/druntime/import/core/stdc/stdarg.d)
import    std.stdiobase
(/usr/local/bin/../include/phobos/std/stdiobase.d)
import    core.memory
(/usr/local/bin/../include/druntime/import/core/memory.di)
import    core.stdc.errno
(/usr/local/bin/../include/druntime/import/core/stdc/errno.d)
import    core.stdc.stdlib
(/usr/local/bin/../include/druntime/import/core/stdc/stdlib.d)
import    core.stdc.string
(/usr/local/bin/../include/druntime/import/core/stdc/string.d)
import    core.stdc.wchar_
(/usr/local/bin/../include/druntime/import/core/stdc/wchar_.d)
import    core.stdc.time
(/usr/local/bin/../include/druntime/import/core/stdc/time.d)
import    core.stdc.stdint
(/usr/local/bin/../include/druntime/import/core/stdc/stdint.d)
import    core.stdc.signal
(/usr/local/bin/../include/druntime/import/core/stdc/signal.d)
import    std.algorithm
(/usr/local/bin/../include/phobos/std/algorithm.d)
import    std.c.string	(/usr/local/bin/../include/phobos/std/c/string.d)
import    std.array	(/usr/local/bin/../include/phobos/std/array.d)
import    std.c.stdio	(/usr/local/bin/../include/phobos/std/c/stdio.d)
import    std.contracts
(/usr/local/bin/../include/phobos/std/contracts.d)
import    std.conv	(/usr/local/bin/../include/phobos/std/conv.d)
import    std.ctype	(/usr/local/bin/../include/phobos/std/ctype.d)
import    std.math	(/usr/local/bin/../include/phobos/std/math.d)
import    core.stdc.math
(/usr/local/bin/../include/druntime/import/core/stdc/math.d)
import    std.range	(/usr/local/bin/../include/phobos/std/range.d)
import    std.traits	(/usr/local/bin/../include/phobos/std/traits.d)
import    std.typetuple
(/usr/local/bin/../include/phobos/std/typetuple.d)
import    std.typecons	(/usr/local/bin/../include/phobos/std/typecons.d)
import    std.metastrings
(/usr/local/bin/../include/phobos/std/metastrings.d)
import    std.functional
(/usr/local/bin/../include/phobos/std/functional.d)
import    std.string	(/usr/local/bin/../include/phobos/std/string.d)
import    core.exception
(/usr/local/bin/../include/druntime/import/core/exception.di)
import    core.sys.posix.unistd
(/usr/local/bin/../include/druntime/import/core/sys/posix/unistd.d)
import    core.sys.posix.config
(/usr/local/bin/../include/druntime/import/core/sys/posix/config.d)
import    core.sys.posix.inttypes
(/usr/local/bin/../include/druntime/import/core/sys/posix/inttypes.d)
import    core.stdc.inttypes
(/usr/local/bin/../include/druntime/import/core/stdc/inttypes.d)
import    core.sys.posix.sys.types
(/usr/local/bin/../include/druntime/import/core/sys/posix/sys/types.d)
import    std.encoding	(/usr/local/bin/../include/phobos/std/encoding.d)
import    std.format	(/usr/local/bin/../include/phobos/std/format.d)
import    std.bitmanip	(/usr/local/bin/../include/phobos/std/bitmanip.d)
import    std.intrinsic
(/usr/local/bin/../include/phobos/std/intrinsic.d)
import    std.stdarg	(/usr/local/bin/../include/phobos/std/stdarg.d)
import    std.utf	(/usr/local/bin/../include/phobos/std/utf.d)
import    std.system	(/usr/local/bin/../include/phobos/std/system.d)
import    std.regex	(/usr/local/bin/../include/phobos/std/regex.d)
import    std.outbuffer
(/usr/local/bin/../include/phobos/std/outbuffer.d)
import    std.c.stdlib	(/usr/local/bin/../include/phobos/std/c/stdlib.d)
import    std.c.stdarg	(/usr/local/bin/../include/phobos/std/c/stdarg.d)
import    std.uni	(/usr/local/bin/../include/phobos/std/uni.d)
import    std.file	(/usr/local/bin/../include/phobos/std/file.d)
import    std.path	(/usr/local/bin/../include/phobos/std/path.d)
import    std.process	(/usr/local/bin/../include/phobos/std/process.d)
import    std.c.process
(/usr/local/bin/../include/phobos/std/c/process.d)
import    std.c.stddef	(/usr/local/bin/../include/phobos/std/c/stddef.d)
import    core.sys.posix.sys.wait
(/usr/local/bin/../include/druntime/import/core/sys/posix/sys/wait.d)
import    core.sys.posix.signal
(/usr/local/bin/../include/druntime/import/core/sys/posix/signal.d)
import    core.sys.posix.pwd
(/usr/local/bin/../include/druntime/import/core/sys/posix/pwd.d)
import    std.regexp	(/usr/local/bin/../include/phobos/std/regexp.d)
import    core.sys.posix.dirent
(/usr/local/bin/../include/druntime/import/core/sys/posix/dirent.d)
import    core.sys.posix.fcntl
(/usr/local/bin/../include/druntime/import/core/sys/posix/fcntl.d)
import    core.sys.posix.sys.stat
(/usr/local/bin/../include/druntime/import/core/sys/posix/sys/stat.d)
import    core.sys.posix.time
(/usr/local/bin/../include/druntime/import/core/sys/posix/time.d)
import    core.sys.posix.sys.time
(/usr/local/bin/../include/druntime/import/core/sys/posix/sys/time.d)
import    core.sys.posix.sys.select
(/usr/local/bin/../include/druntime/import/core/sys/posix/sys/select.d)
import    core.sys.posix.utime
(/usr/local/bin/../include/druntime/import/core/sys/posix/utime.d)
import    core.sys.posix.stdio
(/usr/local/bin/../include/druntime/import/core/sys/posix/stdio.d)
import    std.dateparse
(/usr/local/bin/../include/phobos/std/dateparse.d)
import    std.cstream	(/usr/local/bin/../include/phobos/std/cstream.d)
import    std.stream	(/usr/local/bin/../include/phobos/std/stream.d)
import    std.mmfile	(/usr/local/bin/../include/phobos/std/mmfile.d)
import    core.sys.posix.sys.mman
(/usr/local/bin/../include/druntime/import/core/sys/posix/sys/mman.d)
import    std.random	(/usr/local/bin/../include/phobos/std/random.d)
import    std.c.time	(/usr/local/bin/../include/phobos/std/c/time.d)
import    std.numeric	(/usr/local/bin/../include/phobos/std/numeric.d)
import    core.thread
(/usr/local/bin/../include/druntime/import/core/thread.di)
import    core.sys.posix.semaphore
(/usr/local/bin/../include/druntime/import/core/sys/posix/semaphore.d)
import    core.sys.posix.pthread
(/usr/local/bin/../include/druntime/import/core/sys/posix/pthread.d)
import    core.sys.posix.sched
(/usr/local/bin/../include/druntime/import/core/sys/posix/sched.d)
import    core.sys.posix.stdlib
(/usr/local/bin/../include/druntime/import/core/sys/posix/stdlib.d)
importall color
importall fast_map
importall fast_random
importall fast_stack
importall hash
importall move
importall player
importall testing
importall utils
importall vertex
semantic  board
import    crc32	(/usr/local/bin/../include/phobos/crc32.d)
dmd: interpret.c:190: Expression*
FuncDeclaration::interpret(InterState*, Expressions*, Expression*):
Assertion `istate' failed.
Aborted


May 31, 2010
On 5/31/2010 7:29 PM, Jason House wrote:
> Am I correct in assuming the easiest way to find out what's causing this issue is to make a custom build of dmd with -DLOG go GFLAGS in linux.mak?
> 
> $ dmd | head -n 1
> Digital Mars D Compiler v2.046
> 
> $ dmd -c *.d -offoo
> dmd: interpret.c:190: Expression*
> FuncDeclaration::interpret(InterState*, Expressions*, Expression*):
> Assertion `istate' failed.
> Aborted
> 
> $ dmd -v -c *.d -offoo
<snip>

The best method is to first cut the input files down to the smallest amount of code you can that still triggers the bug.  Do everything you can to reduce it to a single file with no imports.  Do that before going anywhere near the compiler internals.  For two reasons:

 1) you'll spend a lot less time fiddling around inside the compiler and debugger

 2) you'll have the test case that needs to be added to the test suite to make
sure the bug stays fixed


Another thing to do is look at bugzilla for reports that mention that same assertion.  It might well have been reported before.

Additionally, building from svn might show that it's already fixed.  I know that there's been fixes for a set of ctfe (aka the interpret part of dmd) checked in this weekend from patches that Don submitted.  It wouldn't be terribly shocking if the bug has already been fixed.

If all that fails, it's time for both a bug report and some quality time with gdb and the dmd source.

Hope that helps,
Brad
June 01, 2010
On May 31, 2010, at 10:39 PM, Brad Roberts <braddr at puremagic.com> wrote:

> Additionally, building from svn might show that it's already fixed.
> I know that
> there's been fixes for a set of ctfe (aka the interpret part of dmd)
> checked in
> this weekend from patches that Don submitted.  It wouldn't be
> terribly shocking
> if the bug has already been fixed.
>
> Hope that helps,
> Brad

That does help. Knowing "interpret" really means ctfe should help me chop down the code efficiently.
June 01, 2010
On 1 June 2010 06:00, Jason House <jason.james.house at gmail.com> wrote:
> On May 31, 2010, at 10:39 PM, Brad Roberts <braddr at puremagic.com> wrote:
>
>> Additionally, building from svn might show that it's already fixed. ?I
>> know that
>> there's been fixes for a set of ctfe (aka the interpret part of dmd)
>> checked in
>> this weekend from patches that Don submitted. ?It wouldn't be terribly
>> shocking
>> if the bug has already been fixed.
>>
>> Hope that helps,
>> Brad
>
> That does help. Knowing "interpret" really means ctfe should help me chop down the code efficiently.

Turns out that was enough info for me to reproduce it. Entered as bug 4257. (And it's an important one).
June 01, 2010
Wow. That bug and the wrong-code bug together make it sound like ctfe is completely broken :(

Thanks a lot for reproducing it submitting it to bugzilla.

Sent from my iPhone

On Jun 1, 2010, at 10:22 AM, Don Clugston <dclugston at googlemail.com> wrote:

> On 1 June 2010 06:00, Jason House <jason.james.house at gmail.com> wrote:
>> On May 31, 2010, at 10:39 PM, Brad Roberts <braddr at puremagic.com> wrote:
>>
>>> Additionally, building from svn might show that it's already
>>> fixed.  I
>>> know that
>>> there's been fixes for a set of ctfe (aka the interpret part of dmd)
>>> checked in
>>> this weekend from patches that Don submitted.  It wouldn't be
>>> terribly
>>> shocking
>>> if the bug has already been fixed.
>>>
>>> Hope that helps,
>>> Brad
>>
>> That does help. Knowing "interpret" really means ctfe should help
>> me chop
>> down the code efficiently.
>
> Turns out that was enough info for me to reproduce it. Entered as bug
> 4257. (And it's an important one).
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
June 01, 2010
On 1 June 2010 22:35, Jason House <jason.james.house at gmail.com> wrote:
> Wow. That bug and the wrong-code bug together make it sound like ctfe is completely broken :(

There's an error in the check it does for whether a value is known at compile time, when CTFE begins from inside a function.

>
> Thanks a lot for reproducing it submitting it to bugzilla.
I'm working on fixing it right now.