Branch: refs/heads/yves/fix_maybe_uninit
  Home:   https://github.com/Perl/perl5
  Commit: c7b4e1f745e0bcda876df403ab81f7e5603d64ed
      
https://github.com/Perl/perl5/commit/c7b4e1f745e0bcda876df403ab81f7e5603d64ed
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
    M toke.c

  Log Message:
  -----------
  toke.c - silence maybe-uninitialized warning on gcc 12

This silences the following (bogus) warning:

toke.c:12104:24: warning:
    ‘b’ may be used uninitialized [-Wmaybe-uninitialized]

It won't be used unitialized, but there is no reason not to initialize
it to shut up the warning on gcc-12

Fixes Github Issue #20816


  Commit: 11e18305d0b150fb7898830747d718237791cce1
      
https://github.com/Perl/perl5/commit/11e18305d0b150fb7898830747d718237791cce1
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
    M ext/mro/mro.pm
    M ext/mro/mro.xs

  Log Message:
  -----------
  mro.xs - silence maybe-uninitialized warning on gcc 12

Silence the following bogus warning:

    mro.xs:561:25: warning:
        ‘fq_subname_len’ may be used uninitialized [-Wmaybe-uninitialized]

    561 |             subname_len = fq_subname_len - (subname - fq_subname);

The code does not need to be structured the way it was, and we actually
don't need to define fq_subname_len at all. So restructure the code and
remove it and make gcc-12 shut up.

Fixes GH Issue #20816


  Commit: ef2219211cc6fd32462467f1ab8736497c8baf6e
      
https://github.com/Perl/perl5/commit/ef2219211cc6fd32462467f1ab8736497c8baf6e
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
    M pp_hot.c

  Log Message:
  -----------
  pp_hot.c - rework padhv_rv2hv_common fix maybe-uninit warning on gcc 12

This function was creating a var is_tied that was not necessary,
and using unnecessarily convoluted code to achieve its goals. Its
still somewhat convoluted, but less so. Since we no longer have to
predeclare all variables, moving the bulk of the var decls down
makes the code more clear, and ensures that nothing ends up
uninitialized.

GCC 12 warnings seems to have crappy warnings and overly senstivie ones
as well. The actual usage was from line 1912 in pp_hot.c, yet the
warning mumbles a lot about embed.h. Feh. Note as far as I am concerned
this warning was bogus, except that it highlighted unnecessarily
convoluted code that should be cleaned up.

    In file included from perl.h:6197,
                     from pp_hot.c:36:
    embed.h: In function ‘S_padhv_rv2hv_common’:
    embed.h:981:49: warning:
      ‘mg’ may be used uninitialized [-Wmaybe-uninitialized]
      981 | #   define magic_scalarpack(a,b)                \
                    Perl_magic_scalarpack(aTHX_ a,b)
          |         ^~~~~~~~~~~~~~~~~~~~~
    pp_hot.c:1878:12: note: ‘mg’ was declared here
     1878 |     MAGIC *mg;
          |            ^~

Fixes Github Issue #20816


  Commit: 22f479e1bc72967eedd09ede76948d92edc433a1
      
https://github.com/Perl/perl5/commit/22f479e1bc72967eedd09ede76948d92edc433a1
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-02-18 (Sat, 18 Feb 2023)

  Changed paths:
    M dist/Devel-PPPort/PPPort_pm.PL
    M dist/Devel-PPPort/parts/inc/misc

  Log Message:
  -----------
  Devel-PPPort - silence maybe-uninitialized warnings on gcc-12

GCC-12 seems to have a propensity to warning about maybe-uninitialized
variables a lot more than it should. Most of the cases I have looked
into it turns out to be a false positive, but at the same time, it is
pretty simple to fix this kind of thing, so just fix it so the darn
thing will shut up.

This one just initializes some variables to NULL at the start of a test
function.

Fixes the following (slightly elided) warning.

    gcc-12 -c ... -Og -g ... -W -Wall RealPPPort.c
    In file included from ../../perl.h:6197,
                     from RealPPPort.xs:31:
    ../../embed.h: In function ‘XS_Devel__PPPort_OpSIBLING_tests’:
    ../../embed.h:461:49:
        warning: ‘lastkid’ may be used uninitialized [-Wmaybe-uninitialized]
      461 | # define op_free(a)
                Perl_op_free(aTHX_ a)
                ^~~~~~~~~~~~
    RealPPPort.xs:1741:21: note: ‘lastkid’ was declared here
     1741 |                 OP *lastkid;
          |                     ^~~~~~~

Fixes Github Issue #20816


Compare: https://github.com/Perl/perl5/compare/c7b4e1f745e0%5E...22f479e1bc72

Reply via email to