develooper Front page | perl.perl5.porters | Postings from September 2014

[perl #122728] Normal mechanisms to create a constant do not work on undef

Thread Previous
From:
yves orton
Date:
September 8, 2014 06:33
Subject:
[perl #122728] Normal mechanisms to create a constant do not work on undef
Message ID:
rt-4.0.18-17814-1410157989-1437.122728-75-0@perl.org
# New Ticket Created by  yves orton 
# Please include the string:  [perl #122728]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122728 >


Both of these subs should be identified as constants by the perl internals,
however the first one fails to be marked as CONSTANT and therefore does not
alter the parse tree.

Bug affects at least perl 5.14, and is still present in bleadperl.

For some reason constant.pm is able to create constants which are undef.

Yves

$ perl -MDevel::Peek -le'sub K1 () { undef } sub K2() { 0 } Dump(\&K1);
Dump(\&K2)'
SV = IV(0x9f6988) at 0x9f6998
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0xa15a98
  SV = PVCV(0xa13ac8) at 0xa15a98
    REFCNT = 2
    FLAGS = (POK,pPOK)
    PROTOTYPE = ""
    COMP_STASH = 0x9f6800 "main"
    START = 0xa20890 ===> 0
    ROOT = 0xa20a10
    GVGV::GV = 0xa1f688 "main" :: "K1"
    FILE = "-e"
    DEPTH = 0
    FLAGS = 0x0
    OUTSIDE_SEQ = 93
    PADLIST = 0xa1f700
    PADNAME = 0xa1f6b8(0xa20f30) PAD = 0x9f6a88(0xa1b730)
    OUTSIDE = 0x9f6bf0 (MAIN)
SV = IV(0x9f6988) at 0x9f6998
  REFCNT = 1
  FLAGS = (TEMP,ROK)
  RV = 0xa1f7f0
  SV = PVCV(0xa51a60) at 0xa1f7f0
    REFCNT = 2
    FLAGS = (POK,pPOK,CONST,ISXSUB)
    PROTOTYPE = ""
    COMP_STASH = 0x0
    XSUB = 0x7f5ae3af1d40
    XSUBANY = 0xa1f820 (CONST SV)
    SV = IV(0xa1f810) at 0xa1f820
      REFCNT = 1
      FLAGS = (IOK,READONLY,pIOK)
      IV = 0
    GVGV::GV = 0xa23680 "main" :: "K2"
    FILE = "-e"
    DEPTH = 0
    FLAGS = 0xc
    OUTSIDE_SEQ = 0
    PADLIST = 0x0
    OUTSIDE = 0x0 (null)


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About