From: Eli Zaretskii <eliz@gnu.org>
To: "Jose A. Ortega Ruiz" <jao@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: warnings compiling emacs28 with gcc 12.1
Date: Thu, 28 Jul 2022 20:02:08 +0300 [thread overview]
Message-ID: <83o7x9892n.fsf@gnu.org> (raw)
In-Reply-To: <87h731vrmw.fsf@mail.jao.io>
> From: "Jose A. Ortega Ruiz" <jao@gnu.org>
> Date: Thu, 28 Jul 2022 04:32:39 +0100
>
> I compiled today the emacs28 branch with gcc version
> 'gcc (Debian 12.1.0-7) 12.1.0' and configured with
The lesson to be learned here is never use NN.1 version of GCC with
too high level of warnings: you get a lot of noise due to bugs in an
immature GCC version.
> In file included from intervals.c:45:
> intervals.c: In function ‘graft_intervals_into_buffer’:
> intervals.h:101:29: warning: potential null pointer dereference [-Wnull-dereference]
> 101 | #define TOTAL_LENGTH(i) ((i)->total_length)
> | ~~~~^~~~~~~~~~~~~~~
Nonsense.
> and there's another one about free that looks a bit scary:
>
> alloc.c: In function ‘lisp_free’:
> alloc.c:1052:3: warning: pointer ‘block’ used after ‘free’ [-Wuse-after-free]
> 1052 | mem_delete (mem_find (block));
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> alloc.c:1050:3: note: call to ‘free’ here
> 1050 | free (block);
> | ^~~~~~~~~~~~
Another nonsense. Look in mem_find, and you will see that it uses its
argument as just a number, it never dereferences it.
> There are also several out-of-bounds access in xdisp.c that look like
> this one:
>
> xdisp.c: In function ‘append_space_for_newline’:
> xdisp.c:22011:7: warning: ‘memset’ offset [2352, 2359] from the object at ‘it’ is out of the bounds of referenced subobject ‘charpos’ with type ‘long int’ at offset 2344 [-Warray-bounds]
> 22011 | memset (&it->position, 0, sizeof it->position);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from composite.h:29,
> from xdisp.c:441:
> dispextern.h:214:13: note: subobject ‘charpos’ declared here
> 214 | ptrdiff_t charpos;
> | ^~~~~~~
I see no problem there.
> And so on. I guess the whole list is easily reproducible by anyone
> compiling git gcc 12.1 in a GNU/Linux system, so i'm not sending it in
> full. I can do that in a bug report if you think it's needed.
>
> Apologies if all this is already well-known/spurious.
I wouldn't worry about these.
Thanks.
next prev parent reply other threads:[~2022-07-28 17:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 3:32 warnings compiling emacs28 with gcc 12.1 Jose A. Ortega Ruiz
2022-07-28 17:02 ` Eli Zaretskii [this message]
2022-07-28 17:12 ` Óscar Fuentes
2022-07-28 17:38 ` Eli Zaretskii
2022-07-28 18:31 ` Andreas Schwab
2022-07-28 18:35 ` Óscar Fuentes
2022-07-28 17:23 ` Jose A. Ortega Ruiz
2022-07-28 18:13 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83o7x9892n.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=jao@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).