Bug 140912

Summary: [QA] app-office/koffice-1.6.1-r1 has poor programming practices (implicit declarations, strict aliasing)
Product: [Applications] koffice Reporter: Sandro Bonazzola <sandro.bonazzola>
Component: generalAssignee: KOffice Bug Wranglers <koffice-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Sandro Bonazzola 2007-01-30 20:04:59 UTC
Version:           1.6.1 (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages
Compiler:           gcc-4.1.1, glibc-2.5-r0, 2.6.19-gentoo-r3 x86_64 CFLAGS=" -march=athlon64 -O2 -pipe " CXXFLAGS=" -march=athlon64 -O2 -pipe "
OS:                Linux

Compiling using Gentoo Portage the following notice are presented:

* QA Notice: Package has poor programming practices which may compile
 *            fine but exhibit random runtime failures.
 * vtext.cc:537: warning: dereferencing type-punned pointer will break
strict-aliasing rules
kivio_wrap.cpp:481: warning: dereferencing type-punned pointer will break
strict-aliasing rules
kivio_wrap.cpp:516: warning: dereferencing type-punned pointer will break
strict-aliasing rules
[cut, a lot of others...]

just compile koffice appending -fstrict-aliasing to your CFLAGS and grep warning on stderr for a complete list. On Gentoo side I've asked to filter -fstrict-aliasing and to force -fno-strict-aliasing.

 * QA Notice: Package has poor programming practices which may compile
 *            fine but exhibit random runtime failures.
 * gdk-pixbuf-xlib.c:41: warning: implicit declaration of function
'xlib_rgb_init'
gdk-pixbuf-xlib.c:59: warning: implicit declaration of function
'xlib_rgb_init_with_depth'

The following patch will fix this issue:
--- koffice-1.6.1/karbon/render/xrgbrender/gdk-pixbuf-xlib.c.orig	2007-01-22 17:08:14.239423109 +0100
+++ koffice-1.6.1/karbon/render/xrgbrender/gdk-pixbuf-xlib.c	2007-01-22 17:12:36.628394026 +0100
@@ -22,6 +22,7 @@
 #include <X11/Xlib.h>
 /*#include <gdk-pixbuf/gdk-pixbuf-private.h>*/
 #include "gdk-pixbuf-xlib-private.h"
+#include "gdk-pixbuf-xlibrgb.h"
 
 Display *gdk_pixbuf_dpy = NULL;
 int gdk_pixbuf_screen = -1;
Comment 1 Sandro Bonazzola 2007-01-30 20:06:10 UTC
Please reopen http://bugs.gentoo.org/show_bug.cgi?id=163288 when the patch is applied on the official tree.
Comment 2 Diego Elio Pettenò 2007-01-30 20:16:16 UTC
You actually want -Wstrict-aliasing too.
Comment 3 Thomas Zander 2007-01-30 20:41:56 UTC
Code is not present anymore in the development version of KOffice.