"Internal error: backend\cod1.c 1895" when trying to build DMD/Druntime/Phobos from source

Vladimir Panteleev vladimir at thecybershadow.net
Sun Jan 30 19:22:13 PST 2011


On Mon, 31 Jan 2011 04:00:55 +0200, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Vladimir Panteleev wrote:
>> On Sun, 30 Jan 2011 22:42:22 +0200, Walter Bright  
>> <newshound2 at digitalmars.com> wrote:
>>
>>> Simon wrote:
>>>> On 30/01/2011 18:54, Simon wrote:
>>>>> On 30/01/2011 18:29, Walter Bright wrote:
>>>>>> Vladimir Panteleev wrote:
>>>>>>> DMC, and latest git. (The problem was there a few months ago, so  
>>>>>>> it's
>>>>>>> not a recent regression.)
>>>>>>
>>>>>> I compile it every day, and do not see those errors.
>>>>>
>>>>> Sound like use off uninitialised var, as it's environment dependent.
>>>>>
>>>>> There's at least 2 instances of that still outstanding in the  
>>>>> backend:
>>>>>
>>>>> http://d.puremagic.com/issues/show_bug.cgi?id=52460
>>>>>
>>>>  And for the frond end:
>>>>  http://d.puremagic.com/issues/show_bug.cgi?id=5244
>>>>
>>>
>>> Thanks for pointing those out. Fixed now.
>>  Thanks, but it didn't solve my problem.
>
> I didn't think it would. Those issues were completely unrelated. Sorry  
> about that.
>
>
>> I'd like to emphasize that the problem is with my dmd.exe. If I use the  
>> official dmd.exe, Phobos builds fine - so, it looks like I get a  
>> slightly broken dmd.exe when I compile it from source.
>>  Does anyone know which git commit is DMD 2.051? I think the best way  
>> to find the problem is to compare the released binary with the one I  
>> built.
>
> Why not just get the latest dmd if you're interested in compiling from  
> source? Also, if you download dmd 2.051, you'll get the 2.051 source.

Oh, of course. Total mind lapse, I forgot the source is included with the  
compiler.

Compiling the source from the .zip still yields a broken dmd.exe. My  
version and the one from the .zip seem to differ in many small ways. The  
first difference is that in main(), the .zip version calls a function to  
get the address of errno, while my .exe accesses a variable directly.

Some disassembly for clarity:

=== dmd.exe from dmd.2.051.zip ===

_TEXT:00402C27 loc_402C27:                             ; CODE XREF:  
sub_402360+8ADj
_TEXT:00402C27                 call    sub_4F1314
_TEXT:00402C2C                 lea     ecx, [ebp+var_88]
_TEXT:00402C32                 push    0Ah
_TEXT:00402C34                 mov     dword ptr [eax], 0
_TEXT:00402C3A                 push    ecx
_TEXT:00402C3B                 mov     edx, [ebp+var_88]
_TEXT:00402C41                 add     edx, 7
_TEXT:00402C44                 push    edx
_TEXT:00402C45                 call    sub_4F1340
_TEXT:00402C4A                 add     esp, 0Ch
_TEXT:00402C4D                 mov     ecx, [ebp+var_88]
_TEXT:00402C53                 cmp     byte ptr [ecx], 0
_TEXT:00402C56                 mov     esi, eax
_TEXT:00402C58                 jnz     loc_402FA5
_TEXT:00402C5E                 call    sub_4F1314
_TEXT:00402C63                 cmp     dword ptr [eax], 0
_TEXT:00402C66                 jnz     loc_402FA5
_TEXT:00402C6C                 cmp     esi, 7FFFFFFFh
_TEXT:00402C72                 jg      loc_402FA5
_TEXT:00402C78                 push    esi
_TEXT:00402C79                 call    sub_464451
_TEXT:00402C7E                 add     esp, 4
_TEXT:00402C81                 jmp     loc_4030E3

=== dmd.exe compiled by me ===

_TEXT:00402C27 loc_402C27:                             ; CODE XREF:  
sub_402360+8ADj
_TEXT:00402C27                 push    0Ah
_TEXT:00402C29                 lea     ecx, [ebp+var_88]
_TEXT:00402C2F                 mov     ds:dword_5376D3, 0
_TEXT:00402C39                 push    ecx
_TEXT:00402C3A                 mov     edx, [ebp+var_88]
_TEXT:00402C40                 add     edx, 7
_TEXT:00402C43                 push    edx
_TEXT:00402C44                 call    sub_4F0138
_TEXT:00402C49                 add     esp, 0Ch
_TEXT:00402C4C                 mov     ecx, [ebp+var_88]
_TEXT:00402C52                 cmp     byte ptr [ecx], 0
_TEXT:00402C55                 mov     esi, eax
_TEXT:00402C57                 jnz     loc_402FA1
_TEXT:00402C5D                 cmp     ds:dword_5376D3, 0
_TEXT:00402C64                 jnz     loc_402FA1
_TEXT:00402C6A                 cmp     esi, 7FFFFFFFh
_TEXT:00402C70                 jg      loc_402FA1
_TEXT:00402C76                 push    esi
_TEXT:00402C77                 call    sub_463E87
_TEXT:00402C7C                 add     esp, 4
_TEXT:00402C7F                 jmp     loc_4030DF

Do we use a different version of the compiler or libc to compile DMD? I  
believe I use the latest version at http://ftp.digitalmars.com/dmc.zip .

-- 
Best regards,
  Vladimir                            mailto:vladimir at thecybershadow.net


More information about the Digitalmars-d mailing list