From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Compiler warnings in dispnew.c Date: Sun, 28 Nov 2021 13:03:48 +0200 Message-ID: <83sfvgwnhn.fsf@gnu.org> References: <87fsrg7gdt.fsf.ref@yahoo.com> <87fsrg7gdt.fsf@yahoo.com> <83tufwwo7z.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10558"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: luangruo@yahoo.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 28 12:06:13 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mrI0a-0002ZS-OM for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Nov 2021 12:06:12 +0100 Original-Received: from localhost ([::1]:40118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrI0Y-0002Gq-RZ for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Nov 2021 06:06:10 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrHy8-0000Zo-E4 for emacs-devel@gnu.org; Sun, 28 Nov 2021 06:03:40 -0500 Original-Received: from [2001:470:142:3::e] (port=58622 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrHy8-0004zy-5r; Sun, 28 Nov 2021 06:03:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=o9sirRVuFZwyzvl/v8Ahli0DVUiWoMgh0ElQOtu+R2E=; b=ogO2PxRIp496i7r39GLc 7IpqLx7bBNgwNOauWLXJAWEwARBeOSYBU/x3ea1fZrT3yHDYd+cH4QEIZh/IDdXmRqUaItbfrnJP+ R/5vzkPOYsnaYRQbdxHwEp6cCCPAmxt+1jooAYuTEZtOY7NPjuSKpN4Fa/3SWxbKlwf22Y2qQ5P8A siEy5ph/U1rOCnb1FhOlw+iIF9Si+U959r4IpYWM29qpnTTqBL5hAdfRhF0x1dXIQeCvkZBSMQFlX NPQ9HhtNYaUmLp7NLcGCsJHMzCGyhhiggWacdOggR0kpjX6HlSg4FJ2GQk+vlJ0oxK7AkO0ImgGbN AcFiOi6fIUJiag==; Original-Received: from [87.69.77.57] (port=1907 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrHy6-00053d-Tu; Sun, 28 Nov 2021 06:03:39 -0500 In-Reply-To: <83tufwwo7z.fsf@gnu.org> (message from Eli Zaretskii on Sun, 28 Nov 2021 12:48:00 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:280396 Archived-At: > Date: Sun, 28 Nov 2021 12:48:00 +0200 > From: Eli Zaretskii > Cc: emacs-devel@gnu.org > > > From: Po Lu > > Date: Sun, 28 Nov 2021 17:56:30 +0800 > > > > Building with checking, I get: > > > > CC dispnew.o > > In function ‘copy_row_except_pointers’, > > inlined from ‘assign_row’ at dispnew.c:1050:3, > > inlined from ‘mirror_make_current’ at dispnew.c:2761:3: > > dispnew.c:1037:3: warning: ‘memcpy’ offset [48, 255] from the object at ‘current_row’ is out of the bounds of referenced subobject ‘x’ with type ‘int’ at offset 44 [-Warray-bounds] I don't understand the data the compiler prints, specifically why it says "offset [48, 255]" and then "at offset 44". If you put a breakpoint at line 2761 of mirror_make_current, and when it breaks, type (gdb) ptype /o current_row (gdb) ptype /o desired_row what do you see in offsets of x and in the total size of the structure? (Note: to hit the breakpoint, you need to invoke "emacs -Q -nw", the "-nw" part is important.)