emacs-devel
[Top][All Lists]
Advanced

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

warnings compiling emacs28 with gcc 12.1


From: Jose A. Ortega Ruiz
Subject: warnings compiling emacs28 with gcc 12.1
Date: Thu, 28 Jul 2022 04:32:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Hi,

I'm sending this email to devel because i'm not sure this is to be
considered a bug.

I compiled today the emacs28 branch with gcc version
'gcc (Debian 12.1.0-7) 12.1.0' and configured with

   ./configure --with-x-toolkit=no

and i am seeing several new (to me) compilation warnings. 

Some of them are about possible uses of null pointers, like this one:

   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)
         |                         ~~~~^~~~~~~~~~~~~~~

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);
         |   ^~~~~~~~~~~~

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;
         |             ^~~~~~~

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.

Thanks,
jao
-- 
A lot of people have my books on their bookshelves.
That's the problem, they need to read them. - Don Knuth




reply via email to

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