From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 572 invoked by alias); 17 Jan 2018 16:48:08 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 129551 invoked by uid 89); 17 Jan 2018 16:48:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Jan 2018 16:48:03 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA1D82D6A37; Wed, 17 Jan 2018 16:47:57 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E425E60A9D; Wed, 17 Jan 2018 16:47:51 +0000 (UTC) Subject: Re: [PATCH] Fix unitialized warning on gdb/typeprint.c:whatis_exp To: Sergio Durigan Junior , GDB Patches References: <87po69zkxe.fsf@redhat.com> <20180116203239.27787-1-sergiodj@redhat.com> Cc: Eli Zaretskii From: Pedro Alves Message-ID: Date: Wed, 17 Jan 2018 16:48:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180116203239.27787-1-sergiodj@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-01/txt/msg00346.txt.bz2 On 01/16/2018 08:32 PM, Sergio Durigan Junior wrote: > This simple patch initializes "struct value *val" to NULL, which > silences a when compiling GDB with certain GCC versions. Please include a representative paste of warnings in git logs. It makes it easier to see what a patch/commit is about. > This warning is technically incorrect, because there is now way that > "val" will be used unitialized if you look at the code flow, but it's > a simple "fix" and doesn't do any harm. No, it's not incorrect. It's showing a real bug. Try, e.g.: (gdb) set print object on (gdb) whatis some_structure_type Thread 1 "gdb" received signal SIGSEGV, Segmentation fault. 0x00000000005dda90 in check_typedef (type=0x6120736573756170) at src/gdb/gdbtypes.c:2388 2388 int instance_flags = TYPE_INSTANCE_FLAGS (type); (top-gdb) bt #0 0x00000000005dda90 in check_typedef(type*) (type=0x6120736573756170) at src/gdb/gdbtypes.c:2388 #1 0x00000000005e63fb in gnuv3_rtti_type(value*, int*, LONGEST*, int*) (value=0xdf21b7, full_p=0x7fffffffd180, top_p=0x7fffffffd188, using_enc_p=0x7fffffffd184) at src/gdb/gnu-v3-abi.c:293 #2 0x000000000055f7d8 in value_rtti_type(value*, int*, long*, int*) (v=0xdf21b7, full=0x7fffffffd180, top=0x7fffffffd188, using_enc=0x7fffffffd184) at src/gdb/cp-abi.c:117 #3 0x00000000006cc61f in whatis_exp(char const*, int) (exp=, show=-1) at src/gdb/typeprint.c:515 #4 0x0000000000472462 in cmd_func(cmd_list_element*, char const*, int) (cmd=, args=, from_tty=) at src/gdb/cli/cli-decode.c:1886 #5 0x00000000006b833a in execute_command(char const*, int) (p=, from_tty=1) at src/gdb/top.c:630 #6 0x00000000005c0f8c in command_handler(char const*) (command=0xdf21b0 "whatis siginfo_t") at src/gdb/event-top.c:583 #7 0x00000000005c12d8 in command_line_handler(char*) (rl=) at /home/pedro/gdb/mygit/src/gdb/event-top.c:774 ... Thanks, Pedro Alves