[pacman-dev] [patch] add.c: warning: dereferencing type-punned pointer will break strict-aliasing rules

Dan McGee dpmcgee at gmail.com
Thu Jan 18 00:13:46 EST 2007


CC lib/libalpm/add.c
cc1: warnings being treated as errors
lib/libalpm/add.c: In function '_alpm_add_prepare':
lib/libalpm/add.c:257: warning: dereferencing type-punned pointer will
break strict-aliasing rules
make: *** [lib/libalpm/add.o] Error 1

I think it might only happen if -std=c99 is not on the command line,
but it seems like an easy fix to me. Let me know if this doesn't seem
right.

Signed-off-by: Dan McGee <dpmcgee at gmail.com>

diff -aurp pacman-lib.orig/lib/libalpm/add.c
pacman-lib.newmake/lib/libalpm/add.c
--- pacman-lib.orig/lib/libalpm/add.c   2007-01-03 03:05:13.000000000 -0500
+++ pacman-lib.newmake/lib/libalpm/add.c        2007-01-17
22:51:41.000000000 -0500
@@ -253,9 +253,9 @@ int _alpm_add_prepare(pmtrans_t *trans,
                        /* Attempt to resolve conflicts */
                        QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG,
miss->target, miss->depend.name, NULL, &skip_this);
                        if(skip_this) {
-                               pmpkg_t *pkg = NULL;
-                               lp = _alpm_list_remove(lp, (void
*)miss->depend.name, name_cmp, (void **)&pkg);
-                               FREEPKG(pkg);
+                               pmpkg_t **pkg = NULL;
+                               lp = _alpm_list_remove(lp, (void
*)miss->depend.name, name_cmp, (void **)pkg);
+                               FREEPKG(*pkg);
                        }
                }
                if(lp != NULL) {




More information about the pacman-dev mailing list