------- Comment #4 from reddwarf at opensuse dot org  2010-08-15 20:21 -------
> Yes, POSIX adds additional requirements about pointer representation and
> conversion, but AFAIK all targets GCC support and have POSIXish runtime 
> satisfy
> that.  The conversion between pointer types is not the problem in your code, 
> it
> is aliasing violation, and there is nothing in POSIX that says your code is
> valid.

Uhm. Sorry, indeed the example code in posix 2008 dlsym() documentation is
wrong because of aliasing (where should this be reported? is also wrong in
http://www.kernel.org/doc/man-pages/). I was confused because that code was
wrong in posix 2004 but the fix from comment #1 was also wrong (not anymore in
posix 2008).


But using the fix from comment #1 gcc complains with "warning: ISO C forbids
conversion of object pointer to function pointer type", at least when using
-pedantic.
The *message* in the warning is correct. But it is complaining about something
that isn't a conversion from "object pointer to function pointer type" but a
conversion from "void* pointer to function pointer type", that posix 2008
explicitly allows.


-- 

reddwarf at opensuse dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45289

Reply via email to