nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

undefined sub should exist (but cv = 0x0) #290

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
> perlcc -r -e 'sub t1; print "ok\n" if exists &t1 && not defined &t1;'

What is the expected output? What do you see instead?

> perl -e 'sub t1; print "ok\n" if exists &t1 && not defined &t1;'
ok

Please use labels and text to provide additional information.

Original issue reported on code.google.com by nicolas....@gmail.com on 6 Feb 2014 at 9:36

GoogleCodeExporter commented 9 years ago
different flavors which lead to the same result

> perlcc -r -e 'sub t1(); print "ok\n" if exists &t1 && not defined &t1;'
> perlcc -r -e 'sub t1($); print "ok\n" if exists &t1 && not defined &t1;'
> perlcc -r -e 'sub t1(1;); print "ok\n" if exists &t1 && not defined &t1;'
> perl -e 'sub t1(); print "ok\n" if exists &t1 && not defined &t1;'
ok
> perl -e 'sub t1($); print "ok\n" if exists &t1 && not defined &t1;'
ok
> perl -e 'sub t1(1;); print "ok\n" if exists &t1 && not defined &t1;'
ok

Original comment by nicolas....@gmail.com on 6 Feb 2014 at 9:40

GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 6 Feb 2014 at 11:50

GoogleCodeExporter commented 9 years ago
251 is fixed but this is still an issue

Original comment by nicolas....@gmail.com on 8 May 2014 at 8:39

GoogleCodeExporter commented 9 years ago
Really interesting. The first testcase in t/issue251 looks right and should 
catch this problem, and passes correctly. 
I'll lower the prio since I think it's an artefact.

Original comment by reini.urban on 8 May 2014 at 11:39

GoogleCodeExporter commented 9 years ago
Got an empty GvCV slot, so exists fails.

GP = 0xa31ea0
    SV = 0xa37fb0
    REFCNT = 1
    IO = 0x0
    FORM = 0x0  
    AV = 0x0
    HV = 0x0
    CV = 0x0
    CVGEN = 0x0
    LINE = 1
    FILE = "ccode290.pl"
    FLAGS = 0x2
    EGV = 0xa37f98  "f"

Original comment by reini.urban on 5 Jun 2014 at 6:43

GoogleCodeExporter commented 9 years ago
Explicitly:

   pcc -e'sub f;print "ok" if not defined &f && exists &f'

will create the CV with "not defined &f", so that "exists &f" passes then.

Original comment by reini.urban on 5 Jun 2014 at 8:43

GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 11 Jun 2014 at 11:20

GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 11 Jun 2014 at 11:24