RE: OpenSSL breaks with gcc 4.2

2006-11-10 Thread David Schwartz
The equivalent of the offending line would be foo((double *)(void *) j); since any access through a void pointer CAN change the value. '(double *)(void *)' does not keep some sort of remnant of the 'void *'. The final cast renders the end-result a 'double *' and negates the 'void *'. You

Re: OpenSSL breaks with gcc 4.2

2006-11-10 Thread Kyle Hamilton
An object may be the type of its last cast -- but it also can't exactly lose the benefit/cost of being cast to a pointer to an undefined type. As soon as you undefine the type of a pointer, it loses the remnant of ever having had the initial type in the first place. In KR C, you couldn't cast

RE: OpenSSL breaks with gcc 4.2

2006-11-10 Thread David Schwartz
I found the rule -- at least for C99. It is ISO 9899:1999 section 6.2.5, rule 26 and footnote 39: 26) A pointer to void shall have the same representation and alignment requirements as a pointer to a character type. Similarly, pointers to qualified or unqualified versions of

RE: OpenSSL breaks with gcc 4.2

2006-11-10 Thread David Schwartz
An object may be the type of its last cast -- but it also can't exactly lose the benefit/cost of being cast to a pointer to an undefined type. As soon as you undefine the type of a pointer, it loses the remnant of ever having had the initial type in the first place. Right, but that doesn't

[openssl.org #1426] openssl on a Mac

2006-11-10 Thread Federico Carminati via RT
Good afternoon, I am installing openssl on a Mac-Intel. I have to introduce the folllowing patch to have the package compiler with the zlib configuration option --- ./work/openssl-0.9.7j/Makefile.org.ori 2006-04-24 15:32:57.0 +0200 +++ ./work/openssl-0.9.7j/Makefile.org

RE: OpenSSL breaks with gcc 4.2

2006-11-10 Thread Richard Salz
This means you cannot pass an 'X509 **' as a 'char **'. Unfortunately 'X509 *' and 'char *' are not compatible types because 'X509' and 'char' are not compatible. They are not both unions, they are not both structures. But you can pass 'X509 **' as 'void *'. So... void

RE: OpenSSL breaks with gcc 4.2

2006-11-10 Thread David Schwartz
But you can pass 'X509 **' as 'void *'. So... void x509func(void* p) { X509** pp = (X509**)p; ... } void trampoline(void* p) { x509func(p); } void caller(void) { X509* p; trampoline(p); } should (MUST?) work just fine. /r$ When I change my test programs

Re: OpenSSL breaks with gcc 4.2

2006-11-10 Thread Roumen Petrov
David Schwartz wrote: An object may be the type of its last cast -- but it also can't exactly lose the benefit/cost of being cast to a pointer to an undefined type. As soon as you undefine the type of a pointer, it loses the remnant of ever having had the initial type in the first place.

RE: OpenSSL breaks with gcc 4.2

2006-11-10 Thread David Schwartz
Are you sure that problem is in cast ? $ cat test.c main() { int j=2; double *d=(double*)j; *d=1.0; printf(%d %e\n, j, *d); printf(%d %e\n, j, *d); } gcc -O2 test.c ./a.out 2 1.00e+00 0 1.00e+00 Same result in case with line double *d=j; (but expected warning: