March 24, 2012
On 3/24/2012 2:55 PM, Andrej Mitrovic wrote:
> On 3/24/12, Andrej Mitrovic<andrej.mitrovich@gmail.com>  wrote:
>> It could be a Win7 x64 bug. If you'll give me 20 minutes I'll get a
>> hold of an x86 Win7 installation and see if I can reproduce the bug
>> there.
>
> I can't reproduce this on Win7 x86. I've tried numerous times but it
> never failed. It seems it's x64-related (or just a Win7 x64 bug).

Your's and Brad's idea of putting an iteration count on the executable works in my tests. It looks like the only way to workaround it for now.
March 25, 2012
On 3/24/2012 2:55 PM, Andrej Mitrovic wrote:
> I can't reproduce this on Win7 x86. I've tried numerous times but it
> never failed. It seems it's x64-related (or just a Win7 x64 bug).

I submitted a bug report to Microsoft.
March 25, 2012
On 24.03.2012 19:55, Walter Bright wrote:
> I've been upgrading to a Windows 64 bit box. Running the D test suite, I
> ran into a very strange problem. Here's the program:
>
> ---------------------------
> extern(C) int printf(const char*, ...);
>
> int main()
> {
> byte[3] a;
> byte[3] b;
> byte[3] c;
>
> a[] = b[] + c[];
>
> printf("Success\n");
> return 0;
> }
> ---------------------------
>
> I run it from a cc.bat file that has the contents:
>
> --------------------------
> ..\dmd test
> test
> ..\dmd test
> --------------------------
>
> and the result is:
> --------------------------
> C:\test>..\dmd test
>
> C:\test>test
> Success
>
> C:\test>..\dmd test
> GetLastError = 32 test.exe
> OPTLINK (R) for Win32 Release 8.00.12
> Copyright (C) Digital Mars 1989-2010 All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> OPTLINK : Error 3: Cannot Create File test.exe
> --- errorlevel 1
> ---------------------------
>
> Note the failure to write out test.exe. I instrumented Optlink to figure
> out why, and the CreateFile() returns error 32, which is "The process
> cannot access the file because it is being used by another process."
> If you run the commands by typing them in (not via a .bat file) it
> works. If the array
> operations are removed, it works. It works on Windows XP.
>
> I'm mystified. Does anyone have any ideas?
>

Bug 6660. I don't understand it, but the minimal test case is very simple, just a few asm instructions, no function calls.
As I reported there, all that is required is a use of CPUID 2 or 4. Any use of CPUID 1 or 3 doesn't trigger the bug.
It seems to me as though somehow, one processor is being kept alive after the process has ended.
I wasn't sure if this was an OS issue or a processor issue. But if you're seeing this after upgrading an individual machine, it definitely has to be a Windows 7 bug. I'm relieved to hear that someone else can reproduce it.

March 25, 2012
On Saturday, 24 March 2012 at 19:22:03 UTC, Walter Bright wrote:
> On 3/24/2012 12:18 PM, Xinok wrote:
>> If you have an antivirus, try disabling it before compiling.
>
> I have a brand new vanilla install of Windows 7 home premium.

Microsoft has antivirus bundled with windows. Go to security center and see whether Windows Defender is working.
March 26, 2012
On 3/25/2012 2:50 PM, Kagamin wrote:
> Microsoft has antivirus bundled with windows. Go to security center and see
> whether Windows Defender is working.

Well, I'll be hornswoggled. That did the trick! Defender has a feature where it will to real time scanning of new executables. Apparently, it was trying to scan the exe's built by the test suite while the test suite was trying to rewrite them.

I just disabled my dev directory from Defender scanning it.

Thanks!
March 26, 2012
Seems like you got your answer (anti-virus).

I've been struggling with this for creating a temp file, then
deleting. Disabling AV isn't a solution so I have it run delete
when the program exits :P

Also, I've been using system("pause") to do waiting ha, if the
user closes the console with the X, this command reads it as "any
key" and will execute the next command, which can complete before
the application receives TERM. So now all my system("pause")s
have a thread wait so nothing is run.

MS needs to get rid of the damn file locks!
March 26, 2012
On 3/26/12, Walter Bright <newshound2@digitalmars.com> wrote:
> On 3/25/2012 2:50 PM, Kagamin wrote:
>> Microsoft has antivirus bundled with windows. Go to security center and
>> see
>> whether Windows Defender is working.
>
> Well, I'll be hornswoggled. That did the trick!

I really don't think that's the bottom issue. I've had defender off, and I can still reproduce the issue but it seems to happen in random phases. Several hundred runs it's ok, and then it's not ok.
March 27, 2012
try

handle:
http://technet.microsoft.com/de-de/sysinternals/bb896655

or

process explorer:
http://technet.microsoft.com/de-de/sysinternals/bb896653

to find the blocking process

Am 24.03.2012 19:55, schrieb Walter Bright:
> Note the failure to write out test.exe. I instrumented Optlink to figure out
> why, and the CreateFile() returns error 32, which is "The process cannot access
> the file because it is being used by another process."
> If you run the commands by typing them in (not via a .bat file) it works. If the
> array
> operations are removed, it works. It works on Windows XP.
>
> I'm mystified. Does anyone have any ideas?

March 28, 2012
On 27.03.2012 00:42, Andrej Mitrovic wrote:
> On 3/26/12, Walter Bright<newshound2@digitalmars.com>  wrote:
>> On 3/25/2012 2:50 PM, Kagamin wrote:
>>> Microsoft has antivirus bundled with windows. Go to security center and
>>> see
>>> whether Windows Defender is working.
>>
>> Well, I'll be hornswoggled. That did the trick!
>
> I really don't think that's the bottom issue. I've had defender off,
> and I can still reproduce the issue but it seems to happen in random
> phases. Several hundred runs it's ok, and then it's not ok.

Can't reproduce. I've run it more than a thousand times with no failures.
Just looks like a bug in Windows Defender.
March 29, 2012
Is it really a bug, or is it this feature (NTFS tunneling)?

http://blogs.msdn.com/b/oldnewthing/archive/2005/07/15/439261.aspx

"Walter Bright"  wrote in message news:jkmceb$r5f$1@digitalmars.com... 

On 3/24/2012 2:55 PM, Andrej Mitrovic wrote:
> I can't reproduce this on Win7 x86. I've tried numerous times but it
> never failed. It seems it's x64-related (or just a Win7 x64 bug).

I submitted a bug report to Microsoft.