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

d_layer dome at koganet.ne.jp
Sat Aug 7 17:35:35 CEST 2004


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.



More information about the Ros-kernel mailing list