]> Savannah Git Hosting - gnulib.git/commit
regexec: remove alloca usage in build_trtable
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Jan 2021 22:22:15 +0000 (14:22 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 8 Jan 2021 22:26:55 +0000 (14:26 -0800)
commit1731fef3d6d883bc8619c468a1a69b1d090a95c1
tree3d5ec639e2ffef15210cf2adba8dcf9df08f0b69
parentb0e441b886f26b52ad0a96b6505b88090c9248b6
regexec: remove alloca usage in build_trtable

Prompted by this different change proposed by Adhemerval Zanella:
https://sourceware.org/pipermail/libc-alpha/2021-January/121373.html
* lib/regexec.c (build_trtable): Prevent inlining,
so that it doesn’t bloat the caller’s stack.
Use auto variables instead of alloca/malloc.
After these changes, build_trtable’s total stack allocation is
only 20 KiB on a 64-bit machine, and this is less than glibc’s 64
KiB cutoff so there’s little point to using alloca to shrink it.
Although Gnulib traditionally has used a 4 KiB cutoff, going to 20
KiB here should not be a significant problem in practice;
Gnulib-using packages concerned about overflow of tiny stacks can
compile with something like gcc -fstack-clash-protection.
* config/srclist.txt: Comment out regexec.c for now.
ChangeLog
config/srclist.txt
lib/regexec.c