From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Mar 23 17:10:13 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 898DD106566B for ; Fri, 23 Mar 2012 17:10:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 62E778FC14 for ; Fri, 23 Mar 2012 17:10:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q2NHADWo017809 for ; Fri, 23 Mar 2012 17:10:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q2NHADHo017808; Fri, 23 Mar 2012 17:10:13 GMT (envelope-from gnats) Resent-Date: Fri, 23 Mar 2012 17:10:13 GMT Resent-Message-Id: <201203231710.q2NHADHo017808@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tom Russo Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8F260106566B for ; Fri, 23 Mar 2012 17:07:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 708708FC0C for ; Fri, 23 Mar 2012 17:07:06 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NH76Th024627 for ; Fri, 23 Mar 2012 17:07:06 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q2NH76kB024618; Fri, 23 Mar 2012 17:07:06 GMT (envelope-from nobody) Message-Id: <201203231707.q2NH76kB024618@red.freebsd.org> Date: Fri, 23 Mar 2012 17:07:06 GMT From: Tom Russo To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/166341: devel/valgrind crash on binaries built with gcc46 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:10:13 -0000 >Number: 166341 >Category: ports >Synopsis: devel/valgrind crash on binaries built with gcc46 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 23 17:10:13 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Tom Russo >Release: 9.0-STABLE >Organization: Sandia National Laboratories >Environment: FreeBSD sadl14834a 9.0-STABLE FreeBSD 9.0-STABLE #0: Wed Mar 21 18:26:27 MDT 2012 root@sadl14834:/usr/obj/usr/src/sys/GOLDSTEIN amd64 >Description: While this is apparently fixed upstream, the valgrind port in FreeBSD will fail when run with binaries built by gcc 4.6. The failure is: Warning: DWARF2 CFI reader: unhandled DW_OP_ opcode 0x2a While this says it's just a warning, the result is a failure with many subsequent errors such as: valgrind: m_debuginfo/readdwarf.c:2338 (copy_convert_CfiExpr_tree): Assertion 'srcix >= 0 && srcix < VG_(sizeXA)(srcxa)' failed. ==45514== at 0x3802B517: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd) ==45514== by 0x4050FDFDF: ??? ==45514== by 0x3802CB26: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd) ==45514== by 0x3802B516: ??? (in /usr/local/lib/valgrind/memcheck-amd64-freebsd) ==45514== by 0x4050FDFDE: ??? Since this is fixed upstream, it is possible to backport the fix, as for example: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632666 I am attaching a patch produced according to the scheme suggested in the link above. My patch file is a kitchen-sink patch, including all diffs needed to address the issue, not a collection of individual patch-file-name-X files as is customary in the ports system. But it works. This will probably become unnecessary when the valgrind port is updated to a newer release, but it has been failing in this way for at least a couple of months (I first noticed it when gcc 4.5 was removed from ports and replaced by gcc 4.6). >How-To-Repeat: Build gcc 4.6.x, compile a program with it. Install devel/valgrind, run valgrind over the program you built. It will die. >Fix: Add the file attached to ports/devel/valgrind/files as "patch-valgrind-extra" and rebuild valgrind. It will no longer fail. Patch attached with submission follows: Index: coregrind/m_debuginfo/readdwarf.c =================================================================== --- coregrind/m_debuginfo/readdwarf.c (revision 11855) +++ coregrind/m_debuginfo/readdwarf.c (revision 11856) @@ -2899,6 +2899,22 @@ op = Cop_And; opname = "and"; goto binop; case DW_OP_mul: op = Cop_Mul; opname = "mul"; goto binop; + case DW_OP_shl: + op = Cop_Shl; opname = "shl"; goto binop; + case DW_OP_shr: + op = Cop_Shr; opname = "shr"; goto binop; + case DW_OP_eq: + op = Cop_Eq; opname = "eq"; goto binop; + case DW_OP_ge: + op = Cop_Ge; opname = "ge"; goto binop; + case DW_OP_gt: + op = Cop_Gt; opname = "gt"; goto binop; + case DW_OP_le: + op = Cop_Le; opname = "le"; goto binop; + case DW_OP_lt: + op = Cop_Lt; opname = "lt"; goto binop; + case DW_OP_ne: + op = Cop_Ne; opname = "ne"; goto binop; binop: POP( ix ); POP( ix2 ); Index: coregrind/m_debuginfo/debuginfo.c =================================================================== --- coregrind/m_debuginfo/debuginfo.c (revision 11855) +++ coregrind/m_debuginfo/debuginfo.c (revision 11856) @@ -1880,6 +1880,14 @@ case Cop_Sub: return wL - wR; case Cop_And: return wL & wR; case Cop_Mul: return wL * wR; + case Cop_Shl: return wL << wR; + case Cop_Shr: return wL >> wR; + case Cop_Eq: return wL == wR ? 1 : 0; + case Cop_Ge: return wL >= wR ? 1 : 0; + case Cop_Gt: return wL > wR ? 1 : 0; + case Cop_Le: return wL <= wR ? 1 : 0; + case Cop_Lt: return wL < wR ? 1 : 0; + case Cop_Ne: return wL != wR ? 1 : 0; default: goto unhandled; } /*NOTREACHED*/ Index: coregrind/m_debuginfo/storage.c =================================================================== --- coregrind/m_debuginfo/storage.c (revision 11855) +++ coregrind/m_debuginfo/storage.c (revision 11856) @@ -603,6 +603,14 @@ case Cop_Sub: VG_(printf)("-"); break; case Cop_And: VG_(printf)("&"); break; case Cop_Mul: VG_(printf)("*"); break; + case Cop_Shl: VG_(printf)("<<"); break; + case Cop_Shr: VG_(printf)(">>"); break; + case Cop_Eq: VG_(printf)("=="); break; + case Cop_Ge: VG_(printf)(">="); break; + case Cop_Gt: VG_(printf)(">"); break; + case Cop_Le: VG_(printf)("<="); break; + case Cop_Lt: VG_(printf)("<"); break; + case Cop_Ne: VG_(printf)("!="); break; default: vg_assert(0); } } Index: coregrind/m_debuginfo/priv_storage.h =================================================================== --- coregrind/m_debuginfo/priv_storage.h (revision 11855) +++ coregrind/m_debuginfo/priv_storage.h (revision 11856) @@ -249,7 +249,15 @@ Cop_Add=0x321, Cop_Sub, Cop_And, - Cop_Mul + Cop_Mul, + Cop_Shl, + Cop_Shr, + Cop_Eq, + Cop_Ge, + Cop_Gt, + Cop_Le, + Cop_Lt, + Cop_Ne } CfiOp; Index: coregrind/m_debuginfo/debuginfo.c =================================================================== --- coregrind/m_debuginfo/debuginfo.c (revision 11903) +++ coregrind/m_debuginfo/debuginfo.c (revision 11904) @@ -1883,10 +1883,10 @@ case Cop_Shl: return wL << wR; case Cop_Shr: return wL >> wR; case Cop_Eq: return wL == wR ? 1 : 0; - case Cop_Ge: return wL >= wR ? 1 : 0; - case Cop_Gt: return wL > wR ? 1 : 0; - case Cop_Le: return wL <= wR ? 1 : 0; - case Cop_Lt: return wL < wR ? 1 : 0; + case Cop_Ge: return (Word) wL >= (Word) wR ? 1 : 0; + case Cop_Gt: return (Word) wL > (Word) wR ? 1 : 0; + case Cop_Le: return (Word) wL <= (Word) wR ? 1 : 0; + case Cop_Lt: return (Word) wL < (Word) wR ? 1 : 0; case Cop_Ne: return wL != wR ? 1 : 0; default: goto unhandled; } >Release-Note: >Audit-Trail: >Unformatted: