Another strict aliasing warning

View: New views
5 Messages — Rating Filter:   Alert me  

Another strict aliasing warning

by Bojan Smojver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This time on HP-UX. The attached patch avoids it. Please review.

--
Bojan

[apr-dso_hpux.patch]

Index: dso/unix/dso.c
===================================================================
--- dso/unix/dso.c (revision 668877)
+++ dso/unix/dso.c (working copy)
@@ -178,9 +178,9 @@
     int status;
 
     errno = 0;
-    status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_PROCEDURE, &symaddr);
+    status = shl_findsym((void *)&handle->handle, symname, TYPE_PROCEDURE, &symaddr);
     if (status == -1 && errno == 0) /* try TYPE_DATA instead */
-        status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_DATA, &symaddr);
+        status = shl_findsym((void *)&handle->handle, symname, TYPE_DATA, &symaddr);
     if (status == -1)
         return APR_ESYMNOTFOUND;
     *ressym = symaddr;


Re: Another strict aliasing warning

by Nick Kew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 18 Jun 2008 11:57:18 +1000
Bojan Smojver <bojan@...> wrote:

> This time on HP-UX. The attached patch avoids it. Please review.
>

Hmmm.  handle->handle appears already void* in arch/unix/apr_arch_dso.h.

Just wondering if shl_t should be apr_os_dso_handle_t, and if so
whether the latter is incorrectly defined on this platform?

Any other platforms use DSO_USE_SHL?

--
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Re: Another strict aliasing warning

by Branko Čibej :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nick Kew wrote:

> On Wed, 18 Jun 2008 11:57:18 +1000
> Bojan Smojver <bojan@...> wrote:
>
>  
>> This time on HP-UX. The attached patch avoids it. Please review.
>>
>>    
>
> Hmmm.  handle->handle appears already void* in arch/unix/apr_arch_dso.h.
>  

Yes but the code takes its address, so it gets a void**. Casts like
these are evil.

-- Brane

Re: Another strict aliasing warning

by Bojan Smojver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-06-18 at 12:10 +0100, Nick Kew wrote:

> Hmmm.  handle->handle appears already void* in arch/unix/apr_arch_dso.h.

However, &handle->handle, which is actually used here, is (void **),
hence the warning.

> Just wondering if shl_t should be apr_os_dso_handle_t, and if so
> whether the latter is incorrectly defined on this platform?

I don't think that's the case.

--
Bojan


Re: Another strict aliasing warning

by Bojan Smojver :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I didn't mention this before, but with this change, the DSO test passes
on HP-UX.

--
Bojan

LightInTheBox - Buy quality products at wholesale price