1 #include "/inc/base.inc"
2 
3 int success;
4 
testcall(mixed a,mixed b,mixed c)5 void testcall(mixed a, mixed b, mixed c)
6 {
7     /* Verify that we've been called with all arguments intact. */
8     success = (a==14 && !b && c==this_object());
9 }
10 
test32()11 int test32()
12 {
13     /* Bytecode:
14      *   F_SAVE_ARG_FRAME
15      *   F_CSTRING0 00 ("t-0000709.c")
16      *   F_CSTRING0 01 ("testcall")
17      *   F_CLIT     14 (It is important, that 14 == F_NUMBER)
18      *   F_CONST0      (last_expression will point to this instruction)
19      *   F_THIS_OBJECT (will decrement last_expression on defective drivers
20      *                  so it will point to 14 (F_NUMBER))
21      *   F_CALL_OTHER
22      *   F_RESTORE_ARG_FRAME
23      *   F_POP_VALUE   (will look at last_expression (14 = F_NUMBER), the
24      *                  distance between F_POP_VALUE and 14 must be
25      *                  1 + sizeof(p_int) to trigger this bug.)
26      */
27     __FILE__->testcall(14, 0, this_object());
28     return 1;
29 }
30 
test64()31 int test64()
32 {
33     /* Bytecode is the same as in test32(), except that we use symbolp()
34      * to fill up some space to get the distance right for ia64 machines.
35      */
36     __FILE__->testcall(14, symbolp(symbolp(symbolp(symbolp(0)))), this_object());
37     return 1;
38 }
39 
run_test()40 void run_test()
41 {
42     msg("\nRunning test for #0000709:\n"
43           "--------------------------\n");
44 
45     call_out(#'shutdown, 0, 1); // Just to make sure.
46 
47     test32();
48     if(!success)
49     {
50         shutdown(1);
51         return;
52     }
53     else
54         success = 0;
55 
56     test64();
57     shutdown(!success);
58 
59     remove_call_out(#'shutdown);
60 }
61 
62 string *epilog(int eflag)
63 {
64     run_test();
65     return 0;
66 }
67