Re: gcc 3.3 warnings about strict-aliasing rules

From: Date: Mon, 25 Aug 2003 12:49:23 +0000
Subject: Re: gcc 3.3 warnings about strict-aliasing rules
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-4166@lists.php.net to get a copy of this message
> If PHP5 cvs is compiled with gcc 3.3 and -Wall, there are > warnings about: "dereferencing type-punned pointer will break > strict-aliasing rules". E.g. they occur if the last parameter of > zend_hash_find is a zval ** and used as > zend_hash_find(..., (void **) &data). Casting to void* instead of void** cures the problem. As the cast is used to 'remove' the type from a variable, and not to change it, I would consider it a justified change. I don't think there will be consequences for the validity of the optimization. > Does anybody who knows gcc or the C standard better than I > know another solution? Code will have to be changed regardless, as it's not the function invocation but the cast itself that triggers the warning. Ard

« previous php.internals (#4166) next »