Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 034242a8a539b024648b18318271eabddf40ca48
      
https://github.com/Perl/perl5/commit/034242a8a539b024648b18318271eabddf40ca48
  Author: Nicholas Clark <n...@ccl4.org>
  Date:   2021-09-08 (Wed, 08 Sep 2021)

  Changed paths:
    M pp_hot.c

  Log Message:
  -----------
  In pp_defined assert that the SV is not a hash or array.

The code that handled hashes and arrays was removed by commit 2517717a8902:
    The cases for SVt_PVAV and SVt_PVHV in pp_defined are unreachable.

    Remove them, and hit to the C compiler that it's unlikely that someone used
    `defined` on a subroutine.

    These have been unreachable since `defined @array` and `defined %hash`
    became syntax errors. Whilst the same PP code is used for // and //=,
    expressions such as`@a // @b` put the left array (or hash) in scalar
    context, meaning that it always returns a define value.
    (Should we warn on these?)

However, it turns out that that the removed code was reachable by XS code
generating data structures that would be "illegal" in pure Perl (eg also
triggering "Bizarre copy of ..." errors). Hence with -DDEBUGGING, add logic
to report problematic cases, instead of silently continuing with changed
behaviour.


Reply via email to