From: Vlad S. <vl...@cr...> - 2005-06-11 19:50:26
|
I went through google about this and found out that many projects like Linux, PostgreSQL and others use -fno-strict-aliasing. And nobody could determine if this affects optimnization, so we can use that flag as well and in the meantime slowly change the code. Zoran Vasiljevic wrote: > Hi > > When you compile w/o debugging (i.e. with optimisation) > the GCC spits whole-lotta stuff like that: > > tclthread.c:401: warning: dereferencing type-punned pointer will break > strict-aliasing rules > tclthread.c:401: warning: dereferencing type-punned pointer will break > strict-aliasing rules > > The warning sems to trigger when a pointer is casted like this: > > enum { > EAbsWaitIdx, EBroadcastIdx, ECreateIdx, EDestroyIdx, ESetIdx, > ESignalIdx, ETimedWaitIdx, EWaitIdx > } opt; > > if (!GetArgs(interp, objc, objv, opts, 'e', ECreateIdx, > (int *) &opt, (void **) &condPtr)) { > return TCL_ERROR; > > The "opt" and "condPtr" in GetArgs() are casted and it barks > at them. I cannot possibly imagine changing all code to > something like: > > enum { > EAbsWaitIdx, EBroadcastIdx, ECreateIdx, EDestroyIdx, ESetIdx, > ESignalIdx, ETimedWaitIdx, EWaitIdx > } opt; > int myOpt = (int)opt; > > if (!GetArgs(interp, objc, objv, opts, 'e', ECreateIdx, > &myOpt, (void **) &condPtr)) { > return TCL_ERROR; > > This would mean lots of work and may introduce errors. > > I've read that you can use (starting with gcc 3.3) -fno-strict-aliasing > which would remove those warnings. But also, somebody said that the > effect of the "-O2" is gone in such cases (haven't be able to verify) > > What to do? > Any ideas? > > Zoran > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you > shotput > a projector? How fast can you ride your desk chair down the office luge > track? > If you want to score the big prize, get to know the little guy. Play to > win an NEC 61" plasma display: http://www.necitguy.com/?r=20 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |