Simple for loops consistently result in exception error

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Sander Bouwhuis
Newbie
Newbie
Posts: 4
Joined: Tue Aug 12, 2014 3:59 am

Simple for loops consistently result in exception error

Post by Sander Bouwhuis »

I'm trying to get my application(s) working on Linux via Wine. For some strange reason ALL my code seems to constantly crash. I consistently get crashes when I use loops.

Examples:

Code: Select all

// Fill the array with random numbers
concurrency::parallel_for(int64(0), int64(i64Len-sizeof(uint32)), int64(sizeof(uint32)), [i64Len,&pu8Input](int64 i64Pos)
{
  rand_s((uint32 *)&pu8Input[i64Pos]);
});
rand_s((uint32 *)&pu8Input[i64Len-sizeof(uint32)]);

Code: Select all

// Hash the blocks
concurrency::parallel_for(int64(0), i64Len-64, int64(64), [i64Len, &pu8Input, liRand](int64 i64Pos)
{
  CCrypto_Sha sha;

  sha.SetSalt_FromBuffer((uint8 *)&liRand, sizeof(liRand), SALT_TYPE::salt_type_add_before_and_after_data);
  sha.GetSha3_512_FromBuffer(&pu8Input[i64Pos], 64, &pu8Input[i64Pos]);
});
shaLastBlock.SetSalt_FromBuffer((uint8 *)&liRand, sizeof(liRand), SALT_TYPE::salt_type_add_before_and_after_data);
shaLastBlock.GetSha3_512_FromBuffer(&pu8Input[i64Len-64], 64, &pu8Input[i64Len-64]);
Crash, crash, crash... why? In Windows this works perfectly.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Simple for loops consistently result in exception error

Post by Bob Wya »

@Sander

I am presuming you are saying that your application will work under Wine - if you used serialised for-loops?
My immediate thought would be a timing / synchronisation -related bug in Wine...

If you can provide source code - for both working and non-working test-cases - based on your code.
That would be an excellent starting point for pinning down the issue with Wine.

If your application shows different behaviour under Wine vs. native Windows.
Then I would suggest filing a detailed WineHQ bug report:
with terminal output, Windows source code for working/non-working test-cases, etc.

The more heavy lifting you do - the easier and quicker the resolution to the Wine code will be.
Providing a non-working test case also gives a good measure of when the bug is resolved.

Bob
DarkPlayer
Level 2
Level 2
Posts: 23
Joined: Sun Mar 13, 2016 11:15 am

Re: Simple for loops consistently result in exception error

Post by DarkPlayer »

Hard to tell the reason if you do not provide a Wine log. From your code snippet I would guess that you are using MSVC with the concurrency functions. Wine's msvcrt implementation is incomplete, especially for concurrency::* stuff. You can try to install the corresponding visual c++ redistributable via winetricks or manually copy the required libraries and set them to native. As Bob Wya already mentioned, you should definitely open a bug report though.
Locked