From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120903 invoked by alias); 28 Sep 2015 17:14:28 -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 120890 invoked by uid 89); 28 Sep 2015 17:14:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 28 Sep 2015 17:14:26 +0000 Received: from EUSAAHC004.ericsson.se (Unknown_Domain [147.117.188.84]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id EA.48.32596.40619065; Mon, 28 Sep 2015 12:27:17 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.86) with Microsoft SMTP Server id 14.3.248.2; Mon, 28 Sep 2015 13:14:24 -0400 Subject: Re: [PATCH 3/2] Add some more casts (2/2) To: Ulrich Weigand References: <20150928154518.474FC2210@oc7340732750.ibm.com> CC: Yao Qi , From: Simon Marchi Message-ID: <5609756F.9030903@ericsson.com> Date: Mon, 28 Sep 2015 17:14:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150928154518.474FC2210@oc7340732750.ibm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00605.txt.bz2 On 15-09-28 11:45 AM, Ulrich Weigand wrote: > Simon Marchi wrote: > >> @@ -1350,7 +1352,7 @@ ppu2spu_sniffer (const struct frame_unwind *self, >> info.bfd_arch_info = bfd_lookup_arch (bfd_arch_spu, bfd_mach_spu); >> info.byte_order = BFD_ENDIAN_BIG; >> info.osabi = GDB_OSABI_LINUX; >> - info.tdep_info = (void *) &data.id; >> + info.tdep_info = (struct gdbarch_tdep_info *) &data.id; >> data.gdbarch = gdbarch_find_by_info (info); >> if (!data.gdbarch) >> return 0; > > This causes compilation to fail (with the RHEL5 system compiler): > > gdb/ppc-linux-tdep.c: In function 'ppu2spu_sniffer': > gdb/ppc-linux-tdep.c:1355: warning: type-punning to incomplete type might break strict-aliasing rules > > The problem seems to be that "struct gdbarch_tdep_info" actually > does not exist and is not defined anywhere. The info.tdep_info > field is used as a generic pointer; different architectures use > it for diffferent purposes. > > Maybe in this case the correct fix would be to leave the (void *) > casts in place and actually change the type of the field to void * ... > > Bye, > Ulrich Thanks for pointing this out. I was able to reproduce it using a Centos 5 docker container. Changing the field and the cast to void* is ok to me. I don't see any real value in casting to a pointer to a type that doesn't exist. Any other opinions?