From patchwork Wed Jan 10 20:54:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 858567 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-470745-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="WpVzX55A"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zH1bY0wBVz9s7g for ; Thu, 11 Jan 2018 07:59:36 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=fJEAcu+78IIOLyag gKXVMEwmfXIiqHyZaXF6aCq6GLbUbo9GlSrgv5D31BgTv0bM3VgtjrfxWHtuAGiY 9xp1aPy+YzJUijpgODMV2PGLlLinF5TSkLagyZkhnoSm0+oxR7ZjPbG/7Yq4H2qN ntrb3/c7zLnVNmcxZeV0ShFRJ5U= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=UcaS/x7Tw4i/Z4SGZE8KsT HY/Og=; b=WpVzX55Awvl4S/Fgvw6ob8etPa++yjBNz3xDBVAvg93fU2aibY7Ukq O7yPcYM5KpY9Bzhjo0SLv+HG8egSfpzRmtrhxTfP3cUpy5SDCBXyVnnUhngTeNgz d+Tzlg0zsR0DulsyVzVXWV2M/lBoUprbY9lcbZmJ19uSGPAHVAmf0= Received: (qmail 88240 invoked by alias); 10 Jan 2018 20:59:30 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 88222 invoked by uid 89); 10 Jan 2018 20:59:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 10 Jan 2018 20:59:28 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8268981C43 for ; Wed, 10 Jan 2018 21:59:25 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2IR4DDvnDTHj for ; Wed, 10 Jan 2018 21:59:25 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 5DAAE81368 for ; Wed, 10 Jan 2018 21:59:25 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix buglet in dwarf2out_var_location Date: Wed, 10 Jan 2018 21:54:03 +0100 Message-ID: <2661119.70s0nTDGJq@polaris> MIME-Version: 1.0 Passing a null pointer as argument to formatting functions corresponding to the %s specifier makes the libc choke on old versions of Solaris 10. The attached patchlet fixes a recently added case and thus eliminates: -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O (internal compiler error) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O (test for excess errors) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O3 (internal compiler error) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -O3 (test for excess errors) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O (internal compiler error) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O (test for excess errors) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O3 (internal compiler error) -FAIL: gcc.dg/debug/debug-7.c -gdwarf-2 -g3 -O3 (test for excess errors) -FAIL: gcc.dg/debug/dwarf2/pr43237.c (internal compiler error) -FAIL: gcc.dg/debug/dwarf2/pr43237.c (test for excess errors) -UNRESOLVED: gcc.dg/debug/dwarf2/pr43237.c scan-assembler-not LLST[^\\\\r\\\ \n]*DW_AT_upper_bound Tested on SPARC/Solaris and x86-64/Linux, applied on the mainline as obvious. 2018-01-10 Eric Botcazou * dwarf2out.c (dwarf2out_var_location): Do not pass NULL to fprintf. Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 256275) +++ dwarf2out.c (working copy) @@ -26584,11 +26584,16 @@ create_label: if (var_loc_p && flag_debug_asm) { - const char *name = NULL, *sep = " => ", *patstr = NULL; + const char *name, *sep, *patstr; if (decl && DECL_NAME (decl)) name = IDENTIFIER_POINTER (DECL_NAME (decl)); + else + name = ""; if (NOTE_VAR_LOCATION_LOC (loc_note)) - patstr = str_pattern_slim (NOTE_VAR_LOCATION_LOC (loc_note)); + { + sep = " => "; + patstr = str_pattern_slim (NOTE_VAR_LOCATION_LOC (loc_note)); + } else { sep = " ";