Bug 2571 - Scope pointer bug
: Scope pointer bug
Status: RESOLVED FIXED
: Pike
Core
: 7.3
: All Other
: P3 (normal) normal
: ---
Assigned To:
:
:
: 2589
  Show dependency treegraph
 
Reported: 2001-11-27 21:41 CET by
Modified: 2001-12-07 01:24 CET (History)
Scrum Prio:
In scrum?: ---
Story included in sprints:
Unplanned in sprints:


Attachments


Description From 2001-11-27 21:41:07 CET
The following program produces a segmentation fault:

    int main()
    {
      int var;
      void x() {var++;};
      lambda () {x();}();
    }

Cursory investigation indicates that it's some problem with the scope
pointers. It works in 7.2.
------- Comment #1 From 2001-11-29 18:08:10 CET -------
Identified part of the problem in language.yacc:lexical_islocal().

The fix does however unfortunately not fix the problem...

All sorted identifiers:
Doing function '__lambda_65601_0_line_3' at 0
Identifer = 1
Doing function '__lambda_65601_1_line_4' at 0
Identifer = 2
Doing function 'main' at 0
Identifer = 0
All inherits:
  0:
inherited program: 65601
inherit_level: 0
identifier_level: 0
parent_identifier: -1
parent_offset: -18
storage_offset: 0
parent: 0
All identifiers:
  0:main;
  1:__lambda_65601_0_line_3;
  2:__lambda_65601_1_line_4;
All sorted identifiers:
Doing function '__lambda_65601_0_line_3' at 0
Coding: {x++($<1>0)};
return(0)
===   3    0 byte(0)
===   3    1 byte(0)
===   3    2 entry
===   3    3 function start
===   3    3 &lexical local(0,1)
===   3    b x++ and pop
===   3    d return 0
Identifer = 1
Doing function '__lambda_65601_1_line_4' at f
Coding: {$<1>1()};
return(0)
===   4    f byte(0)
===   4   10 byte(0)
===   4   11 entry
===   4   12 function start
===   4   12 mark
===   4   18 lexical local(1,1)
===   4   1b call function & pop
===   4   1d return 0
Identifer = 2
Doing function 'main' at 1f
Coding: {&$0=0};
{trampoline<__lambda_65601_1_line_4>()};
return($0);
return(0)
===   1   1f byte(2)
===   1   20 byte(0)
===   1   21 entry
===   4   22 mark
===   4   28 trampoline(2,0)
===   4   2b call function & pop
===   5   2d return local(0)
Identifer = 0
All inherits:
  0:
inherited program: 65601
inherit_level: 0
identifier_level: 0
parent_identifier: -1
parent_offset: -18
storage_offset: 0
parent: 0
All identifiers:
  0:main;
  1:__lambda_65601_0_line_3;
  2:__lambda_65601_1_line_4;
All sorted identifiers:
Attempt to call the NULL-value
Unknown program: 0()
bug2571.pike:3: __lambda_65601_1_line_4()
bug2571.pike:4: main()
------- Comment #2 From 2001-12-06 05:38:31 CET -------
The committed patch to language.yacc (r 1.264) introduces some sort of
hard-to-reproduce bug. Triggered by the refdoc system in the last join-stage.
------- Comment #3 From 2001-12-06 06:18:36 CET -------
Hard-to-reproduce if you have no clue about how these things work internally,
that is. The backtrace that appears when using version 1.264 of language.yacc
and making a refdoc is:

Unknown program: 0(Node(2,module))
/export/d1/nilsson/pike/7.3.12/lib/modules/Tools.pmod/AutoDoc.pmod/ProcessXML.pm
od:633: __lambda_65629_5_line_624(Node(2,class))
/export/d1/nilsson/pike/7.3.12/lib/modules/Parser.pmod/XML.pmod/Tree.pmod:214:
    Node(2,class)->walk_preorder(__lambda_65629_5_line_624)

/export/d1/nilsson/pike/7.3.12/lib/modules/Parser.pmod/XML.pmod/Tree.pmod:217:
    Node(2,module)->walk_preorder(__lambda_65629_5_line_624)

... last 1 frames above repeated 1 times ...
/export/d1/nilsson/pike/7.3.12/lib/modules/Tools.pmod/AutoDoc.pmod/ProcessXML.pm
od:637: cleanUndocumented(Node(2,module))
/export/d1/nilsson/pike/7.3.12/lib/modules/Tools.pmod/AutoDoc.pmod/ProcessXML.pm
od:643: postProcess(Node(2,module))
bin/join.pike:83:

main(74,({"/home/nilsson/Pike/7.3/refdoc/bin/join.pike","build/autodoc.xml","bui
ld/lib/master.xml","build/lib/sub_manual.xml","bu
    ild/src/C.xml","build/src/Pike.xml",,,66}))
------- Comment #4 From 2001-12-06 11:24:42 CET -------
Fixed.
------- Comment #5 From 2001-12-06 11:54:56 CET -------
The code generated now is:

All sorted identifiers:
Doing function '__lambda_65601_0_line_3' at 0
Identifer = 1
Doing function '__lambda_65601_1_line_4' at 0
Identifer = 2
Doing function 'main' at 0
Identifer = 0
All inherits:
  0:
inherited program: 65601
inherit_level: 0
identifier_level: 0
parent_identifier: -1
parent_offset: -18
storage_offset: 0
parent: 0
All identifiers:
  0:main;
  1:__lambda_65601_0_line_3;
  2:__lambda_65601_1_line_4;
All sorted identifiers:
Doing function '__lambda_65601_0_line_3' at 0
Coding: {x++($<1>0)};
return(0)
===   3    0 byte(0)
===   3    1 byte(0)
===   3    2 entry
===   3    3 function start
===   3    3 &lexical local(0,1)
===   3    b x++ and pop
===   3    d return 0
Identifer = 1
Doing function '__lambda_65601_1_line_4' at f
Coding: {trampoline<__lambda_65601_0_line_3>()};
return(0)
===   4    f byte(0)
===   4   10 byte(0)
===   4   11 entry
===   4   12 function start
===   4   12 mark
===   3   18 trampoline(1,1)
===   4   20 call function & pop
===   4   26 return 0
Identifer = 2
Doing function 'main' at 28
Coding: {&$0=0};
{trampoline<__lambda_65601_1_line_4>()};
return($0);
return(0)
===   1   28 byte(2)
===   1   29 byte(0)
===   1   2a entry
===   4   2b mark
===   4   31 trampoline(2,0)
===   4   34 call function & pop
===   5   36 return local(0)
Identifer = 0
All inherits:
  0:
inherited program: 65601
inherit_level: 0
identifier_level: 0
parent_identifier: -1
parent_offset: -18
storage_offset: 0
parent: 0
All identifiers:
  0:main;
  1:__lambda_65601_0_line_3;
  2:__lambda_65601_1_line_4;
All sorted identifiers:


Note the trampoline(1,1) instead of lexical local(1,1).
------- Comment #6 From 2001-12-07 01:25:10 CET -------
If it is easy to construct a simple test case for lambda bug in language.yacc r
1.264, I think the testsuite would benefit from addition of such a test. The
bug
did after all not exhibit itself in most pike programs. Same goes for the
original bug, if it isn't already added.

Note

You need to log in before you can comment on or make changes to this bug.