Branch: refs/heads/blead Home: https://github.com/Perl/perl5 Commit: 93fbcb7c716b39ce0574f6e1889e2f7d4d1e938d https://github.com/Perl/perl5/commit/93fbcb7c716b39ce0574f6e1889e2f7d4d1e938d Author: Tomasz Konojacki <m...@xenu.pl> Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths: M locale.c M perl.c M pp_ctl.c M regcomp.c M toke.c M util.c Log Message: ----------- Make local constant arrays static Local, non-static constant arrays may get re-initialised at runtime (by pushing their contents on the stack) every time they are reached. This somewhat surprising behaviour is caused by the fact that the C standard requires (almost) every object to have a unique address. In theory, a compiler may eliminate the re-initialisation, if it can prove that the address of an array is never examined. However: 1. This often isn't possible to prove. The compiler has no way to know what will happen to an array pointer once it leaves the compilation unit. 2. Unlike Clang, GCC and Visual C++ don't even attempt this optimisation at all. GCC has an open ticket for this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59863 Making those arrays static avoids the problem, because static arrays are guaranteed to be initialised only once, prior the to the program startup. To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications