Software Archive
Read-only legacy content
17061 Discussions

Amplifier fails with fibers

George_Kotorlis
Beginner
1,022 Views
Hello,

when using Amplifier with a fiber-based application I get the assertion "stack_region_bottom > stack_region_top" and then a runtime error that terminates the process.

On Vista x64 the "stack_region_top" value will not be modified when calling "SwitchToFiber()" since it does not affect the code execution.

Is it possible to remove this assertion?

Thanks
George
0 Kudos
6 Replies
Vladimir_T_Intel
Moderator
1,022 Views
Hello George,

Is that possible to provide us with a simple test case that would reproduce the problem?

0 Kudos
George_Kotorlis
Beginner
1,022 Views
Here is a small example:

#include 

#define MAX_FIBERS 100

LPVOID fiber[MAX_FIBERS];

void WINAPI FiberProc(LPVOID lpv)
{
for (;;)
SwitchToFiber(fiber[(long)lpv]);
}

void main()
{
fiber[0] = ConvertThreadToFiber(0);

for (long i = 1; i < MAX_FIBERS; ++i)
fiber = CreateFiber(0, FiberProc, (void*)((i + 1) % MAX_FIBERS));

for (;;)
SwitchToFiber(fiber[1]);
}

Compile it for x64 and run it. You will get immediately the assertion.
0 Kudos
Vladimir_T_Intel
Moderator
1,022 Views
Thanks for the code sample, I'll check it soon.

Is that particularly x64 problem? Did you reproduce it on x32 system? Which compiler (VS version) you were using?

0 Kudos
George_Kotorlis
Beginner
1,022 Views
Thanks for the code sample, I'll check it soon.

Is that particularly x64 problem? Did you reproduce it on x32 system? Which compiler (VS version) you were using?


Yes, the problem occurs only on x64 (I tested on Vista), not on x32 where SwitchToFiber() sets the stack_top value.
The compiler I used was VS2008 Professional.
0 Kudos
Vladimir_T_Intel
Moderator
1,022 Views

Hello George,

I've reproduced the problem exactly on x64 system. Thanks again for submitting it.

We are going to fix it. Unfortunately, the bug fix won't be ready for the very next public release. So, we have to wait further releases.


0 Kudos
Vladimir_T_Intel
Moderator
1,022 Views
Just in case this is relevant: the bug was fixed long ago in the Amplifier Update 2. Sorry for the late notification.
0 Kudos
Reply