wilzbach / tools-test

1 stars 0 forks source link

Allocation of 'creal' array with 'new' fails when linking without /noi switch #70

Closed wilzbach closed 7 years ago

wilzbach commented 12 years ago

Note: the issue was created automatically migrated from https://issues.dlang.org

Original bug ID: BZ#7042 From: Taco <full.demon@gmail.com> Reported version: D2 CC: andrej.mitrovich@gmail.com

wilzbach commented 12 years ago

Comment author: Taco <full.demon@gmail.com>

Consider the following code:

main.d: import std.stdio;

int main() {
alias creal T;

writeln("alloc");
T[] x = new T[4];
writeln("done");
return 0;

}

This runs fine when compiled with: dmd main.d main

However, it never displays "done" (it hangs) when compiled with: dmd -c main.d link main.obj main

This is the case ONLY if T is 'double', 'idouble', 'creal'. I tried all other types, but they work fine. Even a struct with one member of type double.

I use the binary package for windows of D2.056, at a Win7 32bit system. If you need more info, please ask.

wilzbach commented 12 years ago

Comment author: Taco <full.demon@gmail.com>

Might be duplicate of http://d.puremagic.com/issues/show_bug.cgi?id=3683 Except the linker links fine, the final executable does not.

wilzbach commented 11 years ago

Comment author: Andrej Mitrovic <andrej.mitrovich@gmail.com>

The issue is with how the linker is invoked, not with DMD itself. Reduced test-case:

void main() { creal[] x = new creal[4]; }

$ dmd -c test.d

OK:

$ link test.obj /noi $ test.exe

Hangs:

$ link test.obj $ test.exe

/noi is short for /noignorecase

Perhaps we must always use /noi, in which case this is an invalid bug report. Walter?

wilzbach commented 7 years ago

Comment author: Vladimir Panteleev <dlang-bugzilla@thecybershadow.net>

(In reply to Andrej Mitrovic from comment BZ#2)

Perhaps we must always use /noi, in which case this is an invalid bug report.

It's certainly weird that the Microsoft linker defaults to case-insensitivity even though C is case-sensitive, but it's no surprise if weird bugs arise from said case-insensitivity.

In any case, I don't see why wrong link settings need to be DMD's burden. Though it's not impossible that a workaround in DMD in theory might exist, the primary cause of this problem is clearly user error.