1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
/*
Return-Path: <ucsfcgl!reagan.ai.mit.edu!RUTGERS.EDU!RUTGERS.EDU!uiucdcs!uiucuxc!sys1!sneaky!gordon>
Date: Tue Dec 15, 1987 at 10:25:42 cst
From: uiucdcs!uiucuxc!sys1!sneaky!gordon@rutgers.edu (Gordon Burditt)
Message-Id: <8712151625.AA15898@sneaky.UUCP>
To: uiucdcs!uiucuxc!sys1!techsup!vaxnix!ron@rutgers.edu,
bug-gcc@prep.ai.mit.edu
Subject: gcc bug
Sent: Tue Dec 15, 1987 at 10:25:42 cst
I have been asked to pass along this bug report for gcc 1.15.
I am having trouble figuring out from the ANSI spec whether this really
is a bug or not. ANSI says that side effects caused by function argument
evaluation must be complete by the time the call is done, but how about side
effects in evaluating the function address?
From: ron@vaxnix.tandy.COM (Ron Light)
Date: Sat, 12 Dec 87 7:50:53 CST
*/
typedef int (*Inst)(); /* machine instruction */
#define STOP (Inst)(0)
Inst *pc; /* program counter during execution */
execute(p) /* run the machine */
Inst *p;
{
for(pc = p; *pc != STOP;)
(*(*pc++))();
}
int inst();
Inst instrs[] = {inst, inst, inst, STOP};
int inst() {
if (pc == &instrs[1])
printf("Test passed\n");
else
printf("FAILED, pc = %x, instrs = %x\n", pc, instrs);
exit(0);
}
main()
{
execute(instrs);
}
/*
code produced by gcc:
.text
.even
.globl _execute
_execute:
link a6,#0
movl a6@(8),_pc
jra L2
L5:
movl _pc,a0
movl a0@,a0 ;<---------------------------+
jbsr a0@ ; |
addql #4,_pc ; This should be here--------+
L2:
movl _pc,a0
tstl a0@
jne L5
unlk a6
rts
.comm _pc,4
*/
|