Array ops give sharing violation under Windows 7 64 bit?

Walter Bright newshound2 at digitalmars.com
Sat Mar 24 11:55:06 PDT 2012


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?



More information about the Digitalmars-d mailing list