-
Notifications
You must be signed in to change notification settings - Fork 601
Closed
Labels
Bugbackport-5.42Change proposed for backport to maint-5.42Change proposed for backport to maint-5.42
Description
Description
The following code causes a Segmentation fault instead of generating a normal compilation error:
#!/usr/bin/env perl
use v5.42;
use experimental 'class';
class Test {
$id = 6;
field $name : reader = 'isla';
}Steps to Reproduce
isla@Mac ~ $ perl test.pl
Segmentation fault: 11 perl test.pl
Expected behavior
A normal compilation error:
isla@Mac ~ $ perl test.pl
Global symbol "$id" requires explicit package name (did you forget to declare "my $id"?) at test.pl line 7.
Execution of test.pl aborted due to compilation errors.
This only happens with :reader or :writer but not with :param.
isla@Mac ~ $ lldb perl test.pl
(lldb) target create "perl"
Current executable set to '/Users/isla/perl5/perlbrew/perls/perl-5.42.0/bin/perl' (arm64).
(lldb) settings set -- target.run-args "test.pl"
(lldb) run
Process 29249 launched: '/Users/isla/perl5/perlbrew/perls/perl-5.42.0/bin/perl' (arm64)
Process 29249 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000100034978 perl`apply_field_attribute_reader + 516
perl`apply_field_attribute_reader:
-> 0x100034978 <+516>: ldr x8, [x0]
0x10003497c <+520>: ldr w9, [x8, #0x5c]
0x100034980 <+524>: orr w9, w9, #0x100000
0x100034984 <+528>: str w9, [x8, #0x5c]
Target 0: (perl) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x0000000100034978 perl`apply_field_attribute_reader + 516
frame #1: 0x00000001000339d4 perl`Perl_class_apply_field_attributes + 484
frame #2: 0x0000000100178b48 perl`Perl_yyparse.cold.19 + 32
frame #3: 0x0000000100081ac8 perl`Perl_yyparse + 4648
frame #4: 0x0000000100023d94 perl`perl_parse + 8240
frame #5: 0x00000001000006d0 perl`main + 152
frame #6: 0x0000000196e66b98 dyld`start + 6076
Perl configuration
Reproduced on 5.42.0 but I saw it on 5.40.2 as well
perl -V
Summary of my perl5 (revision 5 version 42 subversion 0) configuration:
Platform:
osname=darwin
osvers=24.5.0
archname=darwin-2level
uname='darwin mac.localdomain 24.5.0 darwin kernel version 24.5.0: tue apr 22 19:54:25 pdt 2025; root:xnu-11417.121.6~2release_arm64_t6020 arm64 arm darwin '
config_args='-de -Dprefix=/Users/isla/perl5/perlbrew/perls/perl-5.42.0 -Aeval:scriptdir=/Users/isla/perl5/perlbrew/perls/perl-5.42.0/bin'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags ='-fno-common -DPERL_DARWIN -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -DHAS_BROKEN_LANGINFO_CODESET -DNO_LOCALE_COLLATE -fno-strict-aliasing -pipe
-fstack-protector-strong'
optimize='-O3'
cppflags='-fno-common -DPERL_DARWIN -DNO_THREAD_SAFE_QUERYLOCALE -DNO_POSIX_2008_LOCALE -DHAS_BROKEN_LANGINFO_CODESET -DNO_LOCALE_COLLATE -fno-strict-aliasing -pipe
-fstack-protector-strong'
ccversion=''
gccversion='Apple LLVM 17.0.0 (clang-1700.0.13.5)'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=8
longdblkind=0
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/17/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacO
SX.platform/Developer/SDKs/MacOSX.sdk/usr/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/local/lib /usr/lib
libs=
perllibs=
libc=
so=dylib
useshrplib=false
libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=bundle
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags='-bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_LONG_DOUBLE
HAS_STRTOLD
HAS_TIMES
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_SIPHASH13
PERL_HASH_USE_SBOX32
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
Built under darwin
Compiled at Jul 30 2025 15:29:28
%ENV:
PERL5LIB="/Users/isla/perl5/perlbrew/perls/perl-5.42.0/lib/perl5"
PERLBREW_HOME="/Users/isla/.perlbrew"
PERLBREW_MANPATH="/Users/isla/perl5/perlbrew/perls/perl-5.42.0/man"
PERLBREW_PATH="/Users/isla/perl5/perlbrew/bin:/Users/isla/perl5/perlbrew/perls/perl-5.42.0/bin"
PERLBREW_PERL="perl-5.42.0"
PERLBREW_ROOT="/Users/isla/perl5/perlbrew"
PERLBREW_SHELLRC_VERSION="1.02"
PERLBREW_VERSION="1.02"
@INC:
/Users/isla/perl5/perlbrew/perls/perl-5.42.0/lib/perl5
/Users/isla/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0/darwin-2level
/Users/isla/perl5/perlbrew/perls/perl-5.42.0/lib/site_perl/5.42.0
/Users/isla/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0/darwin-2level
/Users/isla/perl5/perlbrew/perls/perl-5.42.0/lib/5.42.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bugbackport-5.42Change proposed for backport to maint-5.42Change proposed for backport to maint-5.42