From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58164 invoked by alias); 4 Dec 2017 12:41:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 58153 invoked by uid 89); 4 Dec 2017 12:41:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-19.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=began, *l, *L, Grow X-HELO: smtp.CeBiTec.Uni-Bielefeld.DE Received: from smtp.CeBiTec.Uni-Bielefeld.DE (HELO smtp.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 04 Dec 2017 12:41:39 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 8462C208; Mon, 4 Dec 2017 13:41:34 +0100 (CET) Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wEAp7nfFKO0V; Mon, 4 Dec 2017 13:41:32 +0100 (CET) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 69C1B207; Mon, 4 Dec 2017 13:41:32 +0100 (CET) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.15.2+Sun/8.15.2/Submit) id vB4CfWQY013967; Mon, 4 Dec 2017 13:41:32 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: Avoid -Werror=format-overflow error in dbxout.c (dbxout_block) on Solaris/SPARC Date: Mon, 04 Dec 2017 12:41:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (usg-unix-v) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00139.txt.bz2 --=-=-= Content-Type: text/plain Content-length: 1781 Within test last week, 64-bit Solaris/SPARC bootstrap began to fail: /vol/gcc/src/hg/trunk/local/gcc/dbxout.c: In function 'bool dbxout_block(tree, int, tree, int)': /vol/gcc/src/hg/trunk/local/gcc/dbxout.c:3767:1: error: '%lu' directive writing between 1 and 20 bytes into a region of size 14 [-Werror=format-overflow=] dbxout_block (tree block, int depth, tree args, int parent_blocknum) ^~~~~~~~~~~~ /vol/gcc/src/hg/trunk/local/gcc/dbxout.c:3767:1: note: directive argument in the range [0, 18446744073709551614] In file included from ./tm.h:26, from /vol/gcc/src/hg/trunk/local/gcc/target.h:52, from /vol/gcc/src/hg/trunk/local/gcc/dbxout.c:72: /vol/gcc/src/hg/trunk/local/gcc/config/sparc/sol2.h:353:11: note: 'std::sprintf' output between 8 and 27 bytes into a destination of size 20 sprintf ((LABEL), "*.L%s%lu", (PREFIX), (unsigned long)(NUM)) ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vol/gcc/src/hg/trunk/local/gcc/dbxout.c:3855:5: note: in expansion of macro 'ASM_GENERATE_INTERNAL_LABEL' ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", parent_blocknum); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ The line numbers are extremely confusing, to say the least, though: the one in the error and the first note refer to the begin of the function definition and only the third note refers to the line of the actual error. Fixed as follows, which allowed sparcv9-sun-solaris2.11 bootstrap to finish and passed regtest on sparc-sun-solaris2.11. Ok for mainline? Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-12-04 Rainer Orth * dbxout.c (dbxout_block): Grow buf to 30 bytes. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=sol2-dbxout-format-overflow.patch Content-length: 410 diff --git a/gcc/dbxout.c b/gcc/dbxout.c --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -3844,7 +3844,7 @@ dbxout_block (tree block, int depth, tre /* If we emitted any vars and didn't output any LBRAC/RBRAC, either at this level or any lower level, we need to emit an empty LBRAC/RBRAC pair now. */ - char buf[20]; + char buf[30]; const char *scope_start; ret = true; --=-=-=--