[ros-dev] [ros-diffs] [fireball] 34232: Yuri Sidorov<jura at cp-lab.com> - Prevent boolean flags from beingoptimized away by compiler (due to PSEH usage) by making themvolatile. See issue #3408 for more details.

Alex Ionescu ionucu at videotron.ca
Tue Jul 1 23:45:15 CEST 2008


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 at videotron.ca>
> To: <ros-dev at reactos.org>
> Sent: Tuesday, July 01, 2008 9:28 PM
> Subject: Re: [ros-dev] [ros-diffs] [fireball] 34232: Yuri
> Sidorov<jura at 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 at 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 at 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=34232&r1=34231&r2=34232&view=diff
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> ====================================================================
>>> --- 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 at reactos.org
>> http://www.reactos.org/mailman/listinfo/ros-dev
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev

Best regards,
Alex Ionescu



More information about the Ros-dev mailing list