Then gcc or PSEH should be fixed, not worked-around.
On 1-Jul-08, at 12:03 PM, Yury Sidorov wrote:
Hi,
It's corner case problem and it occurs only in these functions.
Code:
BOOLEAN f = FALSE;
f = TRUE; call_some_func(); f = FALSE;
gcc optimizer removes TRUE/FALSE assignments, since it knows that f was FALSE before this code block and remains FALSE after. gcc knows nothing about exceptions and SEH and performs such optimizations here...
Yury Sidorov.
----- Original Message ----- From: "Alex Ionescu" ionucu@videotron.ca To: ros-dev@reactos.org Sent: Tuesday, July 01, 2008 9:28 PM Subject: Re: [ros-dev] [ros-diffs] [fireball] 34232: Yuri Sidorovjura@cp-lab.com - Prevent boolean flags from beingoptimized away by compiler (due to PSEH usage) by making themvolatile. See issue #3408 for more details.
What?
Why would the compiler optimize these away? This doesn't make any sense.
If something is happening to these flags, PSEH should be fixed -- not making every flag in the source base a volatile.
On 1-Jul-08, at 3:48 AM, fireball@svn.reactos.org wrote:
Author: fireball Date: Tue Jul 1 05:48:50 2008 New Revision: 34232
URL: http://svn.reactos.org/svn/reactos?rev=34232&view=rev Log: Yuri Sidorov jura@cp-lab.com
- Prevent boolean flags from being optimized away by compiler (due
to PSEH usage) by making them volatile. See issue #3408 for more details.
Modified: trunk/reactos/ntoskrnl/mm/virtual.c
Modified: trunk/reactos/ntoskrnl/mm/virtual.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=3... = = = = = = = = = = ==================================================================== --- trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/virtual.c [iso-8859-1] Tue Jul 1 05:48:50 2008 @@ -70,7 +70,7 @@ PFN_NUMBER MdlBuffer[(sizeof(MDL) / sizeof(PFN_NUMBER)) + MI_MAPPED_COPY_PAGES + 1]; PMDL Mdl = (PMDL)MdlBuffer; ULONG TotalSize, CurrentSize, RemainingSize;
- BOOLEAN FailedInProbe = FALSE, FailedInMapping = FALSE,
FailedInMoving;
- volatile BOOLEAN FailedInProbe = FALSE, FailedInMapping =
FALSE, FailedInMoving; BOOLEAN PagesLocked; PVOID CurrentAddress = SourceAddress, CurrentTargetAddress = TargetAddress; PVOID MdlAddress; @@ -225,7 +225,7 @@ { UCHAR StackBuffer[MI_POOL_COPY_BYTES]; ULONG TotalSize, CurrentSize, RemainingSize;
- BOOLEAN FailedInProbe = FALSE, FailedInMoving, HavePoolAddress
= FALSE;
- volatile BOOLEAN FailedInProbe = FALSE, FailedInMoving,
HavePoolAddress = FALSE; PVOID CurrentAddress = SourceAddress, CurrentTargetAddress = TargetAddress; PVOID PoolAddress; KAPC_STATE ApcState;
Best regards, Alex Ionescu
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Best regards, Alex Ionescu