all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: emacs-devel@gnu.org
Subject: Re: Compiler warnings in dispnew.c
Date: Sun, 28 Nov 2021 12:48:00 +0200	[thread overview]
Message-ID: <83tufwwo7z.fsf@gnu.org> (raw)
In-Reply-To: <87fsrg7gdt.fsf@yahoo.com> (message from Po Lu on Sun, 28 Nov 2021 17:56:30 +0800)

> From: Po Lu <luangruo@yahoo.com>
> 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]
>  1037 |   memcpy (&to->x, &from->x, sizeof *to - off);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from termchar.h:23,
>                  from dispnew.c:28:
> dispnew.c: In function ‘mirror_make_current’:
> dispextern.h:885:7: note: subobject ‘x’ declared here
>   885 |   int x, y;
>       |       ^
> 
> 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?

When you say "building with checking", what do you mean, exactly?  Did
you use some non-default warning switches, and if so, which ones?

And what version of GCC is that?



  reply	other threads:[~2021-11-28 10:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87fsrg7gdt.fsf.ref@yahoo.com>
2021-11-28  9:56 ` Compiler warnings in dispnew.c Po Lu
2021-11-28 10:48   ` Eli Zaretskii [this message]
2021-11-28 10:57     ` Andreas Schwab
2021-11-28 11:02     ` Po Lu
2021-11-28 11:07       ` Andreas Schwab
2021-11-28 15:29         ` Eli Zaretskii
2021-11-29  0:35           ` Po Lu
2021-11-29 17:49         ` Stefan Monnier
2021-11-29 17:53           ` Andreas Schwab
2021-11-28 11:03     ` Eli Zaretskii
2021-11-28 11:10       ` Andreas Schwab
2021-11-28 11:18         ` Eli Zaretskii
2021-11-28 11:44           ` Andreas Schwab
2021-11-28 11:11       ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83tufwwo7z.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.