emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler warnings in dispnew.c


From: Eli Zaretskii
Subject: Re: Compiler warnings in dispnew.c
Date: Sun, 28 Nov 2021 12:48:00 +0200

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]