LDC 0.11.0 has been released!

bearophile bearophileHUGS at lycos.com
Wed Jul 31 13:53:12 PDT 2013

I think I have found another small bug:

int foo(in bool b) {
     if (b == true)
         return 1;
void main() {}

If I compile it with:
ldmd2 -O -release -noboundscheck -noruntime test.d

It gives:
Error: No implicit runtime calls allowed with -noruntime option 

But if I compile that program with those switches, it should turn 
the assert(0) into a HALT instruction, that I think has nothing 
to do with runtime calls.

This is the asm of foo(), it contains a call to __d_assert that I 
think should not be present:

	subl	$12, %esp
	testb	$1, %al
	je	LBB0_2
	movl	$1, %eax
	addl	$12, %esp
	movl	$6, 8(%esp)
	movl	$_.str, 4(%esp)
	movl	$6, (%esp)
	calll	__d_assert

This is how dmd compiles the same function with the same 
compilation switches, the assert(0) has become a hlt:

         push    EAX
         cmp [ESP],1
         jne LE
         pop ECX
         mov EAX,1
LE:     hlt


More information about the digitalmars-d-ldc mailing list