Re: [PHP-DEV] Re: gcc 3.3 warnings about strict-aliasing rules

2003-08-27 Thread Ard Biesheuvel
> These unions would only be in the calling code, where they can be type > specific, but I don't like this solution, too. > > But what's the best way then? Changing the casts from void** to void*? > Compile with -fno-strict-aliasing? The warning is emitted because, when compiling zend_hash_find(),

Re: [PHP-DEV] Re: gcc 3.3 warnings about strict-aliasing rules

2003-08-26 Thread Stefan Roehrich
On 2003-08-26 11:57:36, Ard Biesheuvel wrote: > but for other (extension-specific) types as well. Maintaining a union with > all these types would be ludicrous. These unions would only be in the calling code, where they can be type specific, but I don't like this solution, too. But what's the bes

Re: [PHP-DEV] Re: gcc 3.3 warnings about strict-aliasing rules

2003-08-26 Thread Ard Biesheuvel
Stefan Roehrich wrote: > On 2003-08-25 14:54:48, Ard Biesheuvel wrote: >> Casting to void* instead of void** cures the problem. As the cast > > Yes, but why? Because a pointer to a pointer isn't untyped (because you know where it points to: to an untyped pointer) > I don't know if with some op

Re: [PHP-DEV] Re: gcc 3.3 warnings about strict-aliasing rules

2003-08-26 Thread Stefan Roehrich
On 2003-08-25 14:54:48, Ard Biesheuvel wrote: > Casting to void* instead of void** cures the problem. As the cast Yes, but why? > I would consider it a justified change. I don't think there will be > consequences for the validity of the optimization. I don't know if with some optimizations void*

[PHP-DEV] Re: gcc 3.3 warnings about strict-aliasing rules

2003-08-25 Thread Ard Biesheuvel
> 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

[PHP-DEV] Re: gcc 3.3 warnings about strict-aliasing rules

2003-08-25 Thread Ard Biesheuvel
> 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