Subject: pkg/25742: freetype2 gets segmentation violation in FT_Get_Name_Index on alpha
To: None <>
From: Joachim Kuebart <>
List: pkgsrc-bugs
Date: 05/29/2004 09:53:09
>Number:         25742
>Category:       pkg
>Synopsis:       freetype2 gets segmentation violation in FT_Get_Name_Index on alpha
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 29 07:54:01 UTC 2004
>Originator:     Joachim Kuebart
>Release:        NetBSD 2.0B from around April 2, 2004.
System: NetBSD jaja 2.0B NetBSD 2.0B (ALPHA-$Revision: 1.191 $) #10: Thu Apr 22 17:37:18 CEST 2004 joki@jaja:/home/joki/NetBSD/compile/JAJA alpha
Architecture: alpha
Machine: alpha
The default compiler flags on the alpha port "-O2 -mieee" cause the c++
compiler to generate buggy code. This causes a crash of libfreetype when
used from, e.g., xpdf: After opening a file, xpdf gets a SIGSEGV and the
core dump indicates a crash in libfreetype, specifically the procedure
FT_Get_Name_Index. Reducing the optimisation level solves the problem.
Compile and install xpdf from pkgsrc with default compiler flags
"-O2 -mieee". Run xpdf and open any PDF file. You get a SIGSEGV in
FT_Get_Name_Index in libfreetype.
Compile the freetype2 package with compiler flags "-O -mieee" and relink
xpdf. The problem disappears.

The following patch will make the alpha port use at most optimisation "-O"
for freetype2. Also note that the patches/patch-aa file needs to be removed
as it is both missing from distinfo and no longer needed (this is unrelated
to this PR).

Index: Makefile
RCS file: /cvsroot/pkgsrc/graphics/freetype2/Makefile,v
retrieving revision 1.32
diff -u -r1.32 Makefile
--- Makefile	15 May 2004 11:17:14 -0000	1.32
+++ Makefile	29 May 2004 07:47:45 -0000
@@ -35,6 +35,16 @@
+# reduce optimization level on alpha to avoid compiler bugs
+.if ${OPSYS} == "NetBSD"
+.  if ${MACHINE_ARCH} == "alpha"
+CPPFLAGS:=      ${CPPFLAGS:C/-O[0-9]*/-O/g}
+CFLAGS:=        ${CFLAGS:C/-O[0-9]*/-O/g}
+.  endif
 	cd ${WRKSRC} && ${LN} -s builds/unix/
 .if ${OPSYS} == "IRIX"