From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Compiler warnings in dispnew.c Date: Sun, 28 Nov 2021 19:02:36 +0800 Message-ID: <87bl247dbn.fsf@yahoo.com> 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: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1127"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 28 12:04:21 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 1mrHym-000AdQ-Id for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Nov 2021 12:04:20 +0100 Original-Received: from localhost ([::1]:38080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrHyk-0000o4-Jf for ged-emacs-devel@m.gmane-mx.org; Sun, 28 Nov 2021 06:04:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:41480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrHxJ-0008WK-CM for emacs-devel@gnu.org; Sun, 28 Nov 2021 06:02:49 -0500 Original-Received: from sonic313-56.consmr.mail.ne1.yahoo.com ([66.163.185.31]:42545) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mrHxG-0004wD-EL for emacs-devel@gnu.org; Sun, 28 Nov 2021 06:02:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1638097364; bh=SzXyYz3IyjyqaDttjVwV/sx2ncF675LtUjTLuP41FsI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=X6CO3iORbkedDnvmrhXXlM1446D5z4M13+2bRq3xVtkahmpeXYk08AlPXIzvkTNmdald0b6wx9a/BZdhK5y2Fuch1J9hHnM5j9W56FeKPvz7sspqh/kdkfW6JVJoWzqsOccy9hpbLOhDziEWcVsWsJG04umeGljscLeOz/Imtz6km+Eo9pz9MreQbcV+uF640C+bYb3J74SiRqONo3Hcqvu2STdjaXJNuz09Rznd0g7K0rSfpuevXokOwxS40JrbRCvRyo/1rHD+9O7U4fg9wKhEfaEn4Ubz9hpNOSuESFK/C0vwVD/ZklQ9ycPWwQxr21WLEKkh7jimh72BCH0hVA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1638097364; bh=ZsQp1rRR0TMpxn5EJWmnqAcQF0oVrNaQhyr83YxFJ2C=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=K9xGkv74gb3SrNoTgsK0UXH6c/n8z3Rwkfn6O7kI11YXXgaJyZZPgxywxfbl0LnuIZjYGuS8CrBuIA9VxcXogxkH/ov3c9Wq0cWLCOyu9lWLIy2kyrH3oBU1RNXU3GGrxb1qLHC4xrqrlIKqvLw35fxmskVG9B/xoFYQg1zDwcGykDRJ2kQz7IJfP5Rnf02nCOfBSNp2mpJ/0Y3akCvesKKayghUBuBNNskjLghv5zRWwPUIc8N9ACo8u7S/kOsykpDUGjwXkut823+YW2+weBe916qD1NLhatlcXEp4Mr+m0KwTdN3PeNA7MWMKmI1HdHsFdgIMsxvnFvTAbR+YcQ== X-YMail-OSG: VZjYk8oVM1k9YU8_A85eUKIY7w.GfBl7N6x_QaUhxTLQf9mgzUb.70HN908hHdw AIyDh_25tEckT_mQKdELqrr2GyOWiZigxrcuCWO.R0I.8aYjIFW9sL_iesFPbIbQ_zQG8BtPg.tS QThT.K0cRnXQB938WetJDw6LEXybsOSjW.b4wrN6nUxRe3AnpDoA5oQGcFRqRmZZ9yJ65Zfc.iA0 pL8vyfYXHmvbuH.T7pY8hNQ85EY2vNdNX0BpRFA9d6CnXaXj1qkkl06pQSnjklPDVr0gkz4eFTfa vJkUAbXgLZGMi56t3a_1AU3lKHxcHTSO5orOeV78DTX22CuJBwtrht.fCREh58LFxR86CqwOb3hD AVcF5aDikNnmgbDsCOsdJcx4SfvB1Y4ETHNwcfM7lZRcj1Y1Viwvusd5MU9WzQuwghen7J_oZ2rJ wtiWCisML6VUy2BqzQG7tBgI4L5AETLIy.I0e3O.vOSI3Byzz6sSYKntDhwXxxS80RQPN32lvjRL 87mGhcHosXGGq.9rgJQzrqgxLdQ.pe1ZMcJOw5IzgTG8gMESeZPZaK0CIrna9Yabgi958vqln_AR 15UVpDZ64SJdsXffsX1ETHLl8E6xSfXdoqMGU0iWw7vRlccVEdezkayO.HL4vCbJMxCHa7rFuIyZ q08oAcWUYY6KQSIoT5MHfv9gGaf2aE9KsHTURWOVeBpb88COW5hztQtoVy09RfEMZia_4bNt6cMt .0eDvItw.Vzw3ccpM6Iti7rQz6mU.OL_Bi3xlfVqcwMGqaTP867kPmtUMNidAYTI8xlNSnqtvSwq psweqUQZXEFDYOnkkbquGeqPwrHEEbaIKSud2NW0iG X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Sun, 28 Nov 2021 11:02:44 +0000 Original-Received: by kubenode512.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID e0485a00435e4bdff60ceddfc2894405; Sun, 28 Nov 2021 11:02:41 +0000 (UTC) In-Reply-To: <83tufwwo7z.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 28 Nov 2021 12:48:00 +0200") X-Mailer: WebService/1.1.19306 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.185.31; envelope-from=luangruo@yahoo.com; helo=sonic313-56.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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:280395 Archived-At: Eli Zaretskii writes: >> From: Po Lu >> Date: Sun, 28 Nov 2021 17:56:30 +0800 >>=20 >> Building with checking, I get: >>=20 >> CC dispnew.o >> In function =E2=80=98copy_row_except_pointers=E2=80=99, >> inlined from =E2=80=98assign_row=E2=80=99 at dispnew.c:1050:3, >> inlined from =E2=80=98mirror_make_current=E2=80=99 at dispnew.c:2761= :3: >> dispnew.c:1037:3: warning: =E2=80=98memcpy=E2=80=99 offset [48, 255] fro= m the object at =E2=80=98current_row=E2=80=99 is out of the bounds of refer= enced subobject =E2=80=98x=E2=80=99 with type =E2=80=98int=E2=80=99 at offs= et 44 [-Warray-bounds] >> 1037 | memcpy (&to->x, &from->x, sizeof *to - off); >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> In file included from termchar.h:23, >> from dispnew.c:28: >> dispnew.c: In function =E2=80=98mirror_make_current=E2=80=99: >> dispextern.h:885:7: note: subobject =E2=80=98x=E2=80=99 declared here >> 885 | int x, y; >> | ^ >>=20 >> I think it would be prudent to fix this, thanks. > Do you understand the problem? It looks like a compiler bug to me. > We copy into the address of glyph_row->x and the size of the copy is > the size of glyph_row structure minus the offset of x from the > beginning. So what is wrong with that? what am I missing? I don't see anything wrong with it, but I think someone has to find a way to silence the warning. I could not find some reasonable way to do so that did not involve #pragma GCC, which I think is not allowed in Emacs code (is that correct?) Thanks. > When you say "building with checking", what do you mean, exactly? Did > you use some non-default warning switches, and if so, which ones? I meant to say with '--enable-checking=3D"yes,glyphs"'. > And what version of GCC is that? It's GCC 11.2.1. Thanks.