Bug 2616 - #pike doesn't work
: #pike doesn't work
Status: RESOLVED FIXED
: Pike
Core
: 7.3
: All Other
: P3 (normal) normal
: ---
Assigned To:
:
:
: 2589
  Show dependency treegraph
 
Reported: 2001-12-13 00:04 CET by
Modified: 2001-12-17 12:51 CET (History)
Scrum Prio:
In scrum?: ---
Story included in sprints:
Unplanned in sprints:


Attachments


Description From 2001-12-13 00:04:09 CET
(possibly duplicate of 2458)
The program

#pike 7.0
int main() {
  mixed b = Simulate;
  write(__VERSION__ + "\n");
}

yields

Bad argument 1 to sizeof().
/export/d1/nilsson/pike/7.3.12/lib/master.pike:835:
master()->dirnode(0)->create(0,0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:352:

master()->compile_file("/export/d1/nilsson/pike/7.3.12/lib/7.0/modules/Simulate.pmod",0,Si

mulate,master()->dirnode(0))
/export/d1/nilsson/pike/7.3.12/lib/master.pike:528:

master()->low_findprog("/export/d1/nilsson/pike/7.3.12/lib/7.0/modules/Simulate.pmod","",0

,1)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:579:

master()->findprog("/export/d1/nilsson/pike/7.3.12/lib/7.0/modules/Simulate.pmod",".pmod",

0,1)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:610:

master()->low_cast_to_program("/export/d1/nilsson/pike/7.3.12/lib/7.0/modules/Simulate","/

.",0,1)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:802:

master()->low_cast_to_object("/export/d1/nilsson/pike/7.3.12/lib/7.0/modules/Simulate.pmod

","/.",0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:1142:

master()->findmodule("/export/d1/nilsson/pike/7.3.12/lib/7.0/modules/Simulate",0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:1311:

CompatResolver(7.0)->resolv_base("Simulate","/home/nilsson/test.pike",0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:1369:

CompatResolver(7.0)->resolv("Simulate","/home/nilsson/test.pike",0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:352:

master()->compile_file("/home/nilsson/test.pike",0,test.pike,0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:528:

master()->low_findprog("/home/nilsson/test",".pike",0,0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:574:

master()->findprog("/home/nilsson/test",".pike",0,0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:610:

master()->low_cast_to_program("/home/nilsson/test","/export/d1/nilsson/pike/7.3.12/lib/mas

ter.pike",0,0)
/export/d1/nilsson/pike/7.3.12/lib/master.pike:640:

master()->cast_to_program("/home/nilsson/test.pike","/export/d1/nilsson/pike/7.3.12/lib/ma

ster.pike",0)
test.pike:4:Placeholder already has storage!
Pike: Failed to compile script:
Compilation failed.

The problem is probably somewhere in compile (program.c).
------- Comment #1 From 2001-12-13 17:24:19 CET -------
Observation: The code works fine in Pike 7.2.


Hmm, a gdb backtrace at the point of failure reports the following:

#0  f__verify_internals (args=0)
    at /home/grubba/src/Pike/7.3/src/builtin_functions.c:3779
#1  0x4f6d4 in opcode_F_MARK_CALL_BUILTIN (arg1=4245896)
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:2054
#2  0x40b008 in ?? ()
#3  0x3738c in eval_instruction (pc=0x40afa0)
    at /home/grubba/src/Pike/7.3/src/interpret.c:873
#4  0x55eb0 in mega_apply (type=APPLY_LOW, args=0, arg1=0x3b6b18, arg2=0x25)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1409
#5  0xda920 in call_pike_initializers (o=0x3b6b18, args=0)
    at /home/grubba/src/Pike/7.3/src/object.c:279
#6  0x113498 in run_cleanup (c=0x3e15a8, delayed=0)
    at /home/grubba/src/Pike/7.3/src/program.c:4914
#7  0x113b80 in compile (aprog=0x3558a8, ahandler=0xffbedfc8, amajor=3028112,
    aminor=2244608, atarget=0x22dc00, aplaceholder=0x1000)
    at /home/grubba/src/Pike/7.3/src/program.c:5008
#8  0x176484 in f_compile (args=6)
    at /home/grubba/src/Pike/7.3/src/builtin_functions.c:3145
#9  0x4ed14 in opcode_F_CALL_BUILTIN (arg1=4481780)
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:2039
#10 0x437870 in ?? ()
#11 0x56028 in o_catch (pc=0x4385f8)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1447
#12 0x45110 in opcode_F_CATCH ()
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:1151
#13 0x4385f8 in ?? ()
#14 0x3738c in eval_instruction (pc=0x3ed73c)
    at /home/grubba/src/Pike/7.3/src/interpret.c:873
#15 0x55eb0 in mega_apply (type=APPLY_LOW, args=3, arg1=0x3b6c4c, arg2=0xf)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1409
#16 0x57164 in safe_apply_handler (fun=0x22e400 "resolv", handler=0x0,
    compat=0x3b6c4c, args=3, rettypes=0)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1641
#17 0x107e28 in find_module_identifier (ident=0x40f5ac, see_inherit=1)
    at /home/grubba/src/Pike/7.3/src/program.c:897
#18 0x2f664 in yyparse () at language.yacc:3273
#19 0x112fd0 in run_pass1 (c=0x3e5a80)
    at /home/grubba/src/Pike/7.3/src/program.c:4803
#20 0x113a58 in compile (aprog=0x40cf10, ahandler=0x2e3400, amajor=-1,
    aminor=-1, atarget=0x3afbd0, aplaceholder=0x0)
    at /home/grubba/src/Pike/7.3/src/program.c:4990
#21 0x176484 in f_compile (args=6)
    at /home/grubba/src/Pike/7.3/src/builtin_functions.c:3145
#22 0x4ed14 in opcode_F_CALL_BUILTIN (arg1=4481780)
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:2039
#23 0x437870 in ?? ()
#24 0x56028 in o_catch (pc=0x4385f8)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1447
#25 0x45110 in opcode_F_CATCH ()
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:1151
#26 0x4385f8 in ?? ()
#27 0x3738c in eval_instruction (pc=0x439488)
    at /home/grubba/src/Pike/7.3/src/interpret.c:873
#28 0x55eb0 in mega_apply (type=APPLY_LOW, args=2, arg1=0x3b6eb4, arg2=0x21)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1409
#29 0xe20fc in o_cast (type=0x3a5f44, run_time_type=5)
    at /home/grubba/src/Pike/7.3/src/opcodes.c:558
#30 0xe4748 in f_cast () at /home/grubba/src/Pike/7.3/src/opcodes.c:764
#31 0x4b8f4 in opcode_F_CAST ()
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:1630
#32 0x43df9c in ?? ()
#33 0x56028 in o_catch (pc=0x43df38)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1447
#34 0x45110 in opcode_F_CATCH ()
    at /home/grubba/src/Pike/7.3/src/interpret_functions.h:1151
#35 0x43df38 in ?? ()
#36 0x3738c in eval_instruction (pc=0x43a888)
    at /home/grubba/src/Pike/7.3/src/interpret.c:873
#37 0x55eb0 in mega_apply (type=APPLY_LOW, args=2, arg1=0x3b6eb4, arg2=0x4d)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1409
#38 0x577c4 in apply (o=0x3b6eb4, fun=0x22add0 "_main", args=2)
    at /home/grubba/src/Pike/7.3/src/interpret.c:1697
#39 0xcda08 in main (argc=4, argv=0xffbef8cc)
    at /home/grubba/src/Pike/7.3/src/main.c:702

ie it looks like a place-holder related bug.
For some reason there's a dirnode place-holder, and when it gets finalized
create() will be called without arguments.
------- Comment #2 From 2001-12-16 21:25:54 CET -------
After quite a bit of tracking I've narrow it down to this rather interesting
test case:

    inherit String;
    int main() {}

What happens here is that String is resolved to a dirnode, which is inherited
instead of the String module one would expect. The problem probably started
when
String.pmod was converted to a directory.

I believe the way to solve it is to actually use the module.pmod instances as
dirnodes, and let them inherit the dirnode class to get the default magic `[]
etc. Of course one must use another way to initialize them than through
create().
------- Comment #3 From 2001-12-17 11:54:03 CET -------
Inheriting of module objects is bad programming style, and I would prefer if it
wasn't supported at all, but...

The best fix is probably to add support for #pike 7.2...
------- Comment #4 From 2001-12-17 12:52:31 CET -------
Fixed by adding a Pike 7.2 compatibility mode with its own String.pmod.

Note

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