[ros-kernel] Re: [ros-cvs] CVS Update: reactos

Alex Ionescu ionucu at videotron.ca
Sat Aug 7 11:33:18 CEST 2004


Hi,

That assumption was verified by me and Filip as well, I proposed the same
fix you did, however I think this would work too (Filip's idea). Although
this might require a change in the prototype as well (from
pvoid->Ulong_Ptr):

Just change from:
  PSOME_OBJECT Object;
  ObDoSomething((PVOID*)&Object);
to:
  PSOME_OBJECT Object;
  ObDoSomething((ULONG_PTR*)&Object);

Best regards,
Alex Ionescu


-----Original Message-----
From: ros-kernel-bounces at reactos.com [mailto:ros-kernel-bounces at reactos.com]
On Behalf Of d_layer
Sent: Saturday, August 07, 2004 3:36 AM
To: ReactOS Kernel List
Subject: Re: [ros-kernel] Re: [ros-cvs] CVS Update: reactos

I checked all ntoskrnl source files that were warned by -Wstrict-aliasing,
and
reached the conclusion that current gcc optimizes our source code correctly.
So, we can defer the fix until we experience real problems.

BTW, I think that real fix can be done without changes to the prototypes.
Just change from:
  PSOME_OBJECT Object;
  ObDoSomething((PVOID*)&Object);
to:
  PVOID ObjectPointer;
  PSOME_OBJECT Object;
  ObDoSomething(&ObjectPointer);
  Object = ObjectPointer;

-- 
d_layer

Filip Navara wrote:
> d_layer wrote:
> 
> >If you really want to use -fstrict-aliasing, you must fix the
> >source code to comply with the strict-aliasing rules.
> >Specifying -Wno-strict-aliasing does not help.
> >  
> >
> I always thought that it will not use the strict aliasing
> optimalizations on files that don't comply with the rules. These applies
> only to few files.
> 
> >Because warnings enabled by -Wstrict-aliasing mean "your code is
> >breaking the strict-aliasing rules, so gcc may misoptimize your code,"
> >ignoring these warnings while specifying -O2 (-fstrict-aliasing)
> >might cause you to suffer from mysterious bugs.
> >  
> >
> Hmm, that is bit problematic. The only way we can fix this is breaking
> some prototypes. IIRC it applies only to some "undocumented" prototypes
> that are described in various book, but I'm not sure. These prototypes
> use PVOID* parameters where PVOID is really meant as a pointer to
> arbitrary memory. Maybe it would make sense to change these parameters
> to ULONG_PTR*, but I'm not sure.

_______________________________________________
Ros-kernel mailing list
Ros-kernel at reactos.com
http://reactos.com/mailman/listinfo/ros-kernel



More information about the Ros-kernel mailing list