GNU bug report logs - #51254
sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope

Previous Next

Package: emacs;

Reported by: Håkon Hægland <hakon.hagland <at> gmail.com>

Date: Sun, 17 Oct 2021 20:50:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51254 in the body.
You can then email your comments to 51254 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51254; Package emacs. (Sun, 17 Oct 2021 20:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Håkon Hægland <hakon.hagland <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 17 Oct 2021 20:50:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Håkon Hægland <hakon.hagland <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope
Date: Sun, 17 Oct 2021 22:49:08 +0200
[Message part 1 (text/plain, inline)]
I am trying to install emacs 27.2 from source on Ubuntu 21.10:

$ gcc --version
gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0

$ wget http://ftp.gnu.org/gnu/emacs/emacs-27.2.tar.gz
$ tar zvxf emacs-27.2.tar.gz
$ cd emacs-27.2
$ ./configure --prefix=/opt/emacs27.2
$ make
make -C lib all
make[1]: Entering directory '/home/hakon/test/install_emacs/emacs-27.2/lib'
  GEN      alloca.h
  GEN      dirent.h
  GEN      fcntl.h
  GEN      inttypes.h
  GEN      limits.h
  GEN      signal.h
  GEN      stdio.h
  GEN      stdlib.h
  GEN      string.h
  GEN      sys/select.h
  GEN      sys/stat.h
  GEN      sys/time.h
  GEN      sys/types.h
  GEN      time.h
  GEN      unistd.h
  CC       fingerprint.o
  CC       fcntl.o
  CC       fsusage.o
  CC       regex.o
  CC       sig2str.o
  CC       time_rz.o
  CC       acl-errno-valid.o
  CC       acl-internal.o
  CC       get-permissions.o
  CC       set-permissions.o
  CC       allocator.o
  CC       binary-io.o
  CC       c-ctype.o
  CC       c-strcasecmp.o
  CC       c-strncasecmp.o
  CC       careadlinkat.o
careadlinkat.c: In function ‘careadlinkat’:
cc1: warning: function may return address of local variable
[-Wreturn-local-addr]
careadlinkat.c:73:8: note: declared here
   73 |   char stack_buf[1024];
      |        ^~~~~~~~~
  CC       close-stream.o
  CC       count-leading-zeros.o
  CC       count-one-bits.o
  CC       count-trailing-zeros.o
  CC       md5.o
  CC       sha1.o
  CC       sha256.o
  CC       sha512.o
  CC       dtoastr.o
  CC       dtotimespec.o
  CC       filemode.o
  CC       filevercmp.o
  CC       gettime.o
  CC       nstrftime.o
  CC       pipe2.o
  CC       qcopy-acl.o
  CC       stat-time.o
  CC       tempname.o
  CC       timespec.o
  CC       timespec-add.o
  CC       timespec-sub.o
  CC       u64.o
  CC       unistd.o
  CC       utimens.o
utimens.c: In function ‘fdutimens’:
utimens.c:382:17: warning: ‘update_timespec’ accessing 16 bytes in a region
of size 8 [-Wstringop-overflow=]
  382 |       if (ts && update_timespec (&st, &ts))
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
utimens.c:382:17: note: referencing argument 2 of type ‘struct timespec **’
utimens.c:133:1: note: in a call to function ‘update_timespec’
  133 | update_timespec (struct stat const *statbuf, struct timespec *ts[2])
      | ^~~~~~~~~~~~~~~
utimens.c: In function ‘lutimens’:
utimens.c:595:17: warning: ‘update_timespec’ accessing 16 bytes in a region
of size 8 [-Wstringop-overflow=]
  595 |       if (ts && update_timespec (&st, &ts))
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
utimens.c:595:17: note: referencing argument 2 of type ‘struct timespec **’
utimens.c:133:1: note: in a call to function ‘update_timespec’
  133 | update_timespec (struct stat const *statbuf, struct timespec *ts[2])
      | ^~~~~~~~~~~~~~~
  CC       openat-die.o
  CC       save-cwd.o
  AR       libgnu.a
make[1]: Leaving directory '/home/hakon/test/install_emacs/emacs-27.2/lib'
make -C lib-src all
make[1]: Entering directory
'/home/hakon/test/install_emacs/emacs-27.2/lib-src'
  CCLD     etags
  CCLD     ctags
etags.c: In function ‘main’:
cc1: warning: ‘__builtin_memcpy’ writing 12 bytes into a region of size
between 0 and 7 [-Wstringop-overflow=]
In file included from ctags.c:2:
etags.c:1395:21: note: destination object of size [0, 7] allocated by
‘xmalloc’
 1395 |         char *cmd = xmalloc (2 * strlen (tagfile) + sizeof "sort -u
-o..");
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
etags.c:1401:14: warning: writing 1 byte into a region of size 0
[-Wstringop-overflow=]
 1401 |         *z++ = ' ';
      |         ~~~~~^~~~~
etags.c:1395:21: note: at offset 11 into destination object of size [0, 7]
allocated by ‘xmalloc’
 1395 |         char *cmd = xmalloc (2 * strlen (tagfile) + sizeof "sort -u
-o..");
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:519,
                 from ../lib/string.h:41,
                 from etags.c:120,
                 from ctags.c:2:
In function ‘stpcpy’,
    inlined from ‘main’ at etags.c:1400:6:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:86:10: warning:
‘__builtin_stpcpy’ writing 1 or more bytes into a region of size 0
overflows the destination [-Wstringop-overflow=]
   86 |   return __builtin___stpcpy_chk (__dest, __src, __glibc_objsize
(__dest));
      |
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ctags.c:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h: In function ‘main’:
etags.c:1395:21: note: at offset 11 into destination object of size [0, 7]
allocated by ‘xmalloc’
 1395 |         char *cmd = xmalloc (2 * strlen (tagfile) + sizeof "sort -u
-o..");
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:519,
                 from ../lib/string.h:41,
                 from etags.c:120,
                 from ctags.c:2:
In function ‘strcpy’,
    inlined from ‘main’ at etags.c:1402:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:79:10: warning:
‘__builtin_strcpy’ writing 1 or more bytes into a region of size 0
overflows the destination [-Wstringop-overflow=]
   79 |   return __builtin___strcpy_chk (__dest, __src, __glibc_objsize
(__dest));
      |
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ctags.c:2:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h: In function ‘main’:
etags.c:1395:21: note: at offset 12 into destination object of size [0, 7]
allocated by ‘xmalloc’
 1395 |         char *cmd = xmalloc (2 * strlen (tagfile) + sizeof "sort -u
-o..");
      |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CCLD     emacsclient
  CCLD     ebrowse
  CCLD     hexl
  CC       pop.o
  CCLD     movemail
  CCLD     make-docfile
  CCLD     make-fingerprint
make[1]: Leaving directory
'/home/hakon/test/install_emacs/emacs-27.2/lib-src'
make -C src VCSWITNESS='' all
make[1]: Entering directory '/home/hakon/test/install_emacs/emacs-27.2/src'
  GEN      lisp.mk
  GEN      globals.h
  CC       dispnew.o
  CC       frame.o
  CC       scroll.o
  CC       xdisp.o
  CC       menu.o
  CC       xmenu.o
  CC       window.o
  CC       charset.o
  CC       coding.o
  CC       category.o
  CC       ccl.o
  CC       character.o
  CC       chartab.o
  CC       bidi.o
  CC       cm.o
  CC       term.o
  CC       terminal.o
  CC       xfaces.o
  CC       xterm.o
  CC       xfns.o
  CC       xselect.o
  CC       xrdb.o
  CC       xsmfns.o
  CC       xsettings.o
  CC       gtkutil.o
  CC       emacsgtkfixed.o
  CC       dbusbind.o
  CC       emacs.o
  CC       keyboard.o
  CC       macros.o
  CC       keymap.o
  CC       sysdep.o
sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope
 1821 | static unsigned char sigsegv_stack[SIGSTKSZ];
      |                      ^~~~~~~~~~~~~
make[1]: *** [Makefile:406: sysdep.o] Error 1
make[1]: Leaving directory '/home/hakon/test/install_emacs/emacs-27.2/src'
make: *** [Makefile:424: src] Error 2
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51254; Package emacs. (Mon, 18 Oct 2021 02:29:01 GMT) Full text and rfc822 format available.

Message #8 received at 51254 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Håkon Hægland <hakon.hagland <at> gmail.com>
Cc: 51254 <at> debbugs.gnu.org
Subject: Re: bug#51254: sysdep.c:1821:22: error: variably modified
 ‘sigsegv_stack’ at file scope
Date: Mon, 18 Oct 2021 05:28:16 +0300
> From: Håkon Hægland
>  <hakon.hagland <at> gmail.com>
> Date: Sun, 17 Oct 2021 22:49:08 +0200
> 
> I am trying to install emacs 27.2 from source on Ubuntu 21.10:
> 
> $ gcc --version
> gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
> [...]
>   CC       sysdep.o
> sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope
>  1821 | static unsigned char sigsegv_stack[SIGSTKSZ];
>       |                      ^~~~~~~~~~~~~
> make[1]: *** [Makefile:406: sysdep.o] Error 1
> make[1]: Leaving directory '/home/hakon/test/install_emacs/emacs-27.2/src'
> make: *** [Makefile:424: src] Error 2

This is due to a change in your system headers.

There won't be any Emacs 27 releases, and the problem is fixed in the
current development sources, which will become Emacs 28.1.  So my
suggestion is to use the code we have there now:

  /* Storage for the alternate signal stack.
     64 KiB is not too large for Emacs, and is large enough
     for all known platforms.  Smaller sizes may run into trouble.
     For example, libsigsegv 2.6 through 2.8 have a bug where some
     architectures use more than the Linux default of an 8 KiB alternate
     stack when deciding if a fault was caused by stack overflow.  */
  static max_align_t sigsegv_stack[(64 * 1024
				    + sizeof (max_align_t) - 1)
				   / sizeof (max_align_t)];




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51254; Package emacs. (Mon, 18 Oct 2021 11:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 51254 <at> debbugs.gnu.org (full text, mbox):

From: Håkon Hægland <hakon.hagland <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51254 <at> debbugs.gnu.org
Subject: Re: bug#51254: sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope
Date: Mon, 18 Oct 2021 13:41:47 +0200
[Message part 1 (text/plain, inline)]
Thanks! I tried version 29.0.50 at https://github.com/emacs-mirror/emacs.git
and it compiles fine:

$ git clone https://github.com/emacs-mirror/emacs.git
$ cd emacs
$ ./autogen.sh
$ ./configure --prefix=/opt/emacs-29
$ make
$ sudo make install
$ /opt/emacs-29/bin/emacs --version
GNU Emacs 29.0.50
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.


On Mon, Oct 18, 2021 at 4:28 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Håkon Hægland
> >  <hakon.hagland <at> gmail.com>
> > Date: Sun, 17 Oct 2021 22:49:08 +0200
> >
> > I am trying to install emacs 27.2 from source on Ubuntu 21.10:
> >
> > $ gcc --version
> > gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
> > [...]
> >   CC       sysdep.o
> > sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope
> >  1821 | static unsigned char sigsegv_stack[SIGSTKSZ];
> >       |                      ^~~~~~~~~~~~~
> > make[1]: *** [Makefile:406: sysdep.o] Error 1
> > make[1]: Leaving directory
> '/home/hakon/test/install_emacs/emacs-27.2/src'
> > make: *** [Makefile:424: src] Error 2
>
> This is due to a change in your system headers.
>
> There won't be any Emacs 27 releases, and the problem is fixed in the
> current development sources, which will become Emacs 28.1.  So my
> suggestion is to use the code we have there now:
>
>   /* Storage for the alternate signal stack.
>      64 KiB is not too large for Emacs, and is large enough
>      for all known platforms.  Smaller sizes may run into trouble.
>      For example, libsigsegv 2.6 through 2.8 have a bug where some
>      architectures use more than the Linux default of an 8 KiB alternate
>      stack when deciding if a fault was caused by stack overflow.  */
>   static max_align_t sigsegv_stack[(64 * 1024
>                                     + sizeof (max_align_t) - 1)
>                                    / sizeof (max_align_t)];
>
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 18 Oct 2021 13:01:02 GMT) Full text and rfc822 format available.

Notification sent to Håkon Hægland <hakon.hagland <at> gmail.com>:
bug acknowledged by developer. (Mon, 18 Oct 2021 13:01:02 GMT) Full text and rfc822 format available.

Message #16 received at 51254-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Håkon Hægland <hakon.hagland <at> gmail.com>
Cc: 51254-done <at> debbugs.gnu.org
Subject: Re: bug#51254: sysdep.c:1821:22: error: variably modified
 ‘sigsegv_stack’ at file scope
Date: Mon, 18 Oct 2021 16:00:20 +0300
> From: Håkon Hægland <hakon.hagland <at> gmail.com>
> Date: Mon, 18 Oct 2021 13:41:47 +0200
> Cc: 51254 <at> debbugs.gnu.org
> 
> Thanks! I tried version 29.0.50 at https://github.com/emacs-mirror/emacs.git and it compiles fine:

Great, I'm therefore closing this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 16 Nov 2021 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.