On Tuesday 06 November 2007, [EMAIL PROTECTED] wrote: > +/* Note there are a whole bunch of ugly double casts of the form > + (Word*)(void*)&p. These placate gcc at -O2. The obvious form > + (Word*)&p causes gcc to complain that 'dereferencing a type-punned > + pointer ill break strict-aliasing rules'. It stops complaining > + when the intermediate void* type is inserted. Is this a reasonable > + "fix"? I don't know. */
it is not... the only reasonable fix would be to fix that code or use -fno-strict-aliasing. the suppression of (Word*)(void*) is being fixed with newer gcc versions, so the issue is not really gone. and it *is* a real bug, gcc will exploit optimisation opportunities not in favour of the code in case it detects undefined behaviour. strict aliasing (basically) means that you're not allowed to access the same piece of memory via pointers that have a different type (except for the non-symmetrical char* exception). in this case I guess it is because Word* is not compatible with the pointer TC_(nextIterBag) expects. if you access the same memory once via Word* and once via some other pointer you're doomed to have random failure or gcc optimising the code in strange ways. a real workaround would be to copy the content into a new location (e.g. a local variable) and access that one via its type. Greetings, Dirk ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers