www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20667] New: fatal error LNK1179 on windows-x86_64-dmd with MSVC


          Issue ID: 20667
           Summary: fatal error LNK1179 on windows-x86_64-dmd with MSVC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: zan77137 nifty.com

This code causes a link error(LNK1179):

import std.algorithm;

module foo.main;
import std.path;
void foo(string file) { file.relativePath; }

import foo.main;
void main() {  }

Compile with follows:
dmd -m64 -lib -offoo.lib -cov foo\bar.d foo\main.d
dmd -m64 -cov hoge.d foo.lib
foo.lib(main.obj) : fatal error LNK1179:
ファイルが無効か、または壊れています: COMDAT
'__bzeroBytes' を複製します。(Maybe, in English: invalid or corrupt
file: duplicate
COMDAT '__bzeroBytes')
Error: linker exited with status 1179

Conditions: On Windows, x86_64(-m64), coverage(-cov) is enabled, and the
installed MSVC(vs_buildtools 2019) environment.
It does not reproduce on other OS, MinGW(MSVC is not installed), x86, or
without -cov.
And if removing unnecessary import statements or unnecessary files, the
situation will not be reproduced.

Below is a similar link error but the situation seemed different.

Mar 11 2020