-
Notifications
You must be signed in to change notification settings - Fork 601
Description
In #19098, user @Jamaika1 reports C-level warnings emanating from utf8.c and utf8.h using a devel version of gcc12. Context is sparse; I've requested more detail.
That prompted me to install a devel version of gcc12 on FreeBSD12 (one slightly earlier than used by reporter). I encountered build-time warnings that I did not encounter when building on the same platform with gcc10.
$ gcc12 --version | head -n 2
gcc12 (FreeBSD Ports Collection) 12.0.0 20210822 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
I then built Perl 5 blead with sh ./Configure -des -Dusedevel -Duseithreads -Dcc=gcc12 and parsed the build log for C-level warnings:
$ report-build-warnings 756f0910f9.freebsd.gcc12.threaded.maketp.output.txt.gz
File: 756f0910f9.freebsd.gcc12.threaded.maketp.output.txt.gz
Warray-bounds 6
Wc++-compat 240
Wempty-body 6
Wmaybe-uninitialized 2
Wsign-compare 4
Wtype-limits 2
The last previous version of gcc I've build perl with on this machine was gcc10. At that time I got these build-time warnings:
$ report-build-warnings f72873660d.freebsd.gcc10.maketp.output.txt.gz
File: f72873660d.freebsd.gcc10.maketp.output.txt.gz
Wc++-compat 240
Wempty-body 6
Wsign-compare 4
Wtype-limits 2
So the Warraybounds warnings (6) and the Wmaybe-uninitialized warnings (2) are new in either gcc11 or gcc12; the others appear to have existed at least from gcc10.
The Warraybounds warnings are these:
{
char => 9,
group => "Warray-bounds",
line => 461,
source => "hv.h",
text => "array subscript 0 is outside array bounds of 'HEK[768614336404564650]' {aka 'struct hek[768614336404564650]'}",
},
{
char => 9,
group => "Warray-bounds",
line => 461,
source => "hv.h",
text => "array subscript 0 is outside array bounds of 'HEK[768614336404564650]' {aka 'struct hek[768614336404564650]'}",
},
...
{
char => 9,
group => "Warray-bounds",
line => 461,
source => "hv.h",
text => "array subscript 0 is outside array bounds of 'HEK[768614336404564650]' {aka 'struct hek[768614336404564650]'}",
},
{
char => 9,
group => "Warray-bounds",
line => 461,
source => "hv.h",
text => "array subscript 0 is outside array bounds of 'HEK[768614336404564650]' {aka 'struct hek[768614336404564650]'}",
},
{
char => 9,
group => "Warray-bounds",
line => 461,
source => "hv.h",
text => "array subscript 0 is outside array bounds of 'HEK[768614336404564650]' {aka 'struct hek[768614336404564650]'}",
},
{
char => 9,
group => "Warray-bounds",
line => 461,
source => "hv.h",
text => "array subscript 0 is outside array bounds of 'HEK[768614336404564650]' {aka 'struct hek[768614336404564650]'}",
},
Line 461 in hv.h was last touched in this commit:
commit 1604cfb0273418ed479719f39def5ee559bffda2
Author: Michael G. Schwern <schwern@pobox.com>
AuthorDate: Mon Dec 28 18:04:52 2020 -0800
Commit: Karl Williamson <khw@cpan.org>
CommitDate: Sun Jan 17 09:18:15 2021 -0700
style: Detabify indentation of the C code maintained by the core.
This just detabifies to get rid of the mixed tab/space indentation.
Applying consistent indentation and dealing with other tabs are another issue.
Done with `expand -i`.
* vutil.* left alone, it's part of version.
* Left regen managed files alone for now.
Relevant lines:
468 #define hv_exists_ent(hv, keysv, hash) \
469 cBOOL(hv_common((hv), (keysv), NULL, 0, 0, HV_FETCH_ISEXISTS, 0, (hash)))
470 #define hv_fetch_ent(hv, keysv, lval, hash) \
471 ((HE *) hv_common((hv), (keysv), NULL, 0, 0, \
472 ((lval) ? HV_FETCH_LVALUE : 0), NULL, (hash)))
The Wmaybe-uninitialized warnings are these:
{
char => 21,
group => "Wmaybe-uninitialized",
line => 390,
source => "thread.h",
text => "'my_perl' may be used uninitialized",
},
{
char => 21,
group => "Wmaybe-uninitialized",
line => 390,
source => "thread.h",
text => "'my_perl' may be used uninitialized",
},
Line 390 in thread.h was also last touched in 1604cfb, committed to blead in January of this year.
Relevant lines:
386 #ifndef PERL_SET_CONTEXT
387 # define PERL_SET_CONTEXT(t) \
388 STMT_START { \
389 int _eC_; \
390 if ((_eC_ = pthread_setspecific(PL_thr_key, (void *)(t)))) \
391 Perl_croak_nocontext("panic: pthread_setspecific (%d) [%s:%d]", \
392 _eC_, __FILE__, __LINE__); \
393 } STMT_END
394 #endif /* PERL_SET_CONTEXT */
But I don't see the Woverflow build-time warnings reported in #19098.
@schwern, @khwilliamson or anyone, can you take a look?
Thank you very much.
Jim Keenan