www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - x64 Privileged instruction

reply Josphe Brigmo <JospheBrigmo gmail.com> writes:
x64 gives

Privileged instruction

but x86 gives

First-chance exception: std.file.FileException "C:\": The 
filename, directory name, or volume label syntax is incorrect. at 
std\file.d(4573)


which is much more informative...

seems like a bug to me.
Sep 12 2018
parent reply Stefan Koch <uplink.coder googlemail.com> writes:
On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo 
wrote:
 x64 gives

 Privileged instruction

 but x86 gives

 First-chance exception: std.file.FileException "C:\": The 
 filename, directory name, or volume label syntax is incorrect. 
 at std\file.d(4573)


 which is much more informative...

 seems like a bug to me.
More context needed. What code does produce this behavior.
Sep 12 2018
parent reply Josphe Brigmo <JospheBrigmo gmail.com> writes:
On Wednesday, 12 September 2018 at 13:26:03 UTC, Stefan Koch 
wrote:
 On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo 
 wrote:
 x64 gives

 Privileged instruction

 but x86 gives

 First-chance exception: std.file.FileException "C:\": The 
 filename, directory name, or volume label syntax is incorrect. 
 at std\file.d(4573)


 which is much more informative...

 seems like a bug to me.
More context needed. What code does produce this behavior.
Lots of code. I pretty much always get this error. Just throw. It is a first chance exception so that should be clear enough. The point is that x64 doesn't seem to handle first chance exceptions and gives a privileged instruction. This happens windows 10 visual D and I've had it happen for a long time.
Sep 12 2018
parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Thursday, 13 September 2018 at 05:50:53 UTC, Josphe Brigmo 
wrote:
 Privileged instruction
Lots of code. I pretty much always get this error.
Something must have gone really wrong to get this error. Most likely, the CPU instruction pointer ended up in a memory area without any code in it. Windows exception handling is tricky (see Don/Walter's recent discussion), but basic cases should be well-covered by the compiler/runtime test suite. So, I suspect one of the following happened: - Your program is exhibiting an edge case and uncovering a bug not covered by the test case. If this is the case, please reduce your program to a minimal, self-contained example, and file a bug report. - There is a bug in your program that is causing its memory to be corrupted. Using safe can help narrow it down (https://dlang.org/spec/memory-safe-d.html). - There is something specific to your machine that causes the problem to occur there, but not on the test runners. This could happen e.g. due to software which alter behavior of other programs (like through DLL injection), or using a specific Windows version. You can eliminate this possibility by running the DMD test suite.
Sep 15 2018
parent reply Josphe Brigmo <JospheBrigmo gmail.com> writes:
On Saturday, 15 September 2018 at 14:57:20 UTC, Vladimir 
Panteleev wrote:
 On Thursday, 13 September 2018 at 05:50:53 UTC, Josphe Brigmo 
 wrote:
 Privileged instruction
Lots of code. I pretty much always get this error.
Something must have gone really wrong to get this error. Most likely, the CPU instruction pointer ended up in a memory area without any code in it. Windows exception handling is tricky (see Don/Walter's recent discussion), but basic cases should be well-covered by the compiler/runtime test suite. So, I suspect one of the following happened: - Your program is exhibiting an edge case and uncovering a bug not covered by the test case. If this is the case, please reduce your program to a minimal, self-contained example, and file a bug report. - There is a bug in your program that is causing its memory to be corrupted. Using safe can help narrow it down (https://dlang.org/spec/memory-safe-d.html). - There is something specific to your machine that causes the problem to occur there, but not on the test runners. This could happen e.g. due to software which alter behavior of other programs (like through DLL injection), or using a specific Windows version. You can eliminate this possibility by running the DMD test suite.
When I run the code in x86 the error is from a throw and is a first chance exception and the error message is shown as normal. In x64, no changes to source, it is a privileged instruction error. I have always gotten these types of errors on x64 and, it may be my machine, it has happened with many dmd versions, visual D and visual studio... I doubt it is my machine and it seems to be completely dmdx64's fault. Basically I just program in x86 most of the time and compile for x64 because of things like this.
Sep 15 2018
parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Saturday, 15 September 2018 at 18:05:58 UTC, Josphe Brigmo 
wrote:
 I have always gotten these types of errors on x64 and, it may 
 be my machine, it has happened with many dmd versions, visual D 
 and visual studio...
Oh, you mean the message that appears in Visual Studio, not stderr. Exception handling in Win64 is very different than on Win32, so that's probably it. Visual Studio probably doesn't know how to extract the error message from a D exception in Win64. If you run the D program without a debugger attached, you should see the exception message on stderr (or a MessageBox, if you're building a GUI executable).
Sep 15 2018