[8611] in Athena Bugs
xlc bug compiling perl
daemon@ATHENA.MIT.EDU (John Carr)
Sat Nov 16 09:52:46 1991
To: probe@Athena.MIT.EDU
Cc: bugs@Athena.MIT.EDU, marc@Athena.MIT.EDU
Date: Sat, 16 Nov 91 09:52:51 EST
From: John Carr <jfc@Athena.MIT.EDU>
/afs/athena/user/j/jfc/xlc/dolist.i is a file which xlc compiles incorrectly
with optimization on. The version of xlc on tardis and a slightly older
version both have the same bug.
This code around line 1226 is compiled wrong:
if (curcmd->c_expr && (curcmd->c_flags & 077) == 7) {
curcmd->c_flags &= ~077;
opt_arg(curcmd, 1, curcmd->c_type == 5);
}
This is the declaration of curcmd:
extern CMD * volatile curcmd;
If "volatile" is deleted, the bug is not present.
Here is the relevant section of the .lst file. My comments are in []; the
bad statement is marked with "ERROR". Before this block of code, r31 has
been used as a temporary register so its value is not useful.
1225| 0002A0 l 8062 0028 L r3=.curcmd(r2,0)
[r3 is a pointer to curcmd]
1225| 0002A4 l 80A3 0000 L r5=curcmd(r3,0)
[r5 is the value of curcmd]
1225| 0002A8 l 80A5 0004 L r5=SHADOW4$(r5,4)
[r5 = cur_cmd->c_expr]
1225| 0002AC cmpi 2C05 0000 C cr0=r5,0
[test cur_cmd->c_expr == 0]
1225| 0002B0 bc 4182 005C BT CL.116,cr0,0x4/eq
[branch around block if == 0]
1225| 0002B4 l 80A3 0000 L r5=curcmd(r3,0)
[reload curcmd into r5, because it is volatile]
1225| 0002B8 lha A8A5 0026 LHA r5=SHADOW_VOL6$(r5,38)
[r5 = cur_cmd->c_flags]
1225| 0002BC rlinm 54A5 06BE RN r5=r5,0,0x3F
[r5 = cur_cmd->c_flags & 077]
1225| 0002C0 cmpi 2F85 0007 C cr7=r5,7
[test cur_cmd->c_flags & 077 == 7]
1225| 0002C4 bc 409E 0050 BF CL.117,cr7,0x4/eq
[branch around block if != 7]
1226| 0002C8 l 8083 0000 L r4=curcmd(r3,0)
[reload cur_cmd into r4, because it is volatile]
1226| 0002CC lha A8A4 0026 LHA r5=SHADOW_VOL6$(r4,38)
[reload c_flags, which is also volatile]
1226| 0002D0 rlinm 54A5 0032 RN r5=r5,0,0xFFFFFFC0
[clear bits 077]
1226| 0002D4 sth B0A4 0026 STHA SHADOW_VOL6$(r4,38)=r5
[store back c_flags]
1227| 0002D8 l 80A3 0000 L r5=curcmd(r3,0)
[reload curcmd into r5]
1227| 0002DC l 80A3 0000 L r5=curcmd(r3,0)
[reload curcmd into r5, again]
1227| 0002E0 lbz 88A5 0032 LBC r5=SHADOW6$(r5,50)
[r5 = curcmd->c_type]
1227| 0002E4 cal 3880 0001 LI r4=1
1227| 0002E8 cmpi 2D85 0005 C cr3=r5,5
[test curcmd->c_type == 5]
1227| 0002EC oril 6085 0000 LR r5=r4
1227| 0002F0 bc 418E 0008 BT CL.125,cr3,0x4/eq
1227| 0002F4 cal 38A0 0000 LI r5=0
[r5 = (curcmd->c_type == 5)]
CL.125:
1227| 0002F8 oril 63E3 0000 LR r3=r31
[ERROR. r31 is not set. This should be l 3,0(3).]
1227| 0002FC bl 4BFF FD05 CALL opt_arg,3,SHADOW4$",r3,r4,r5,opt_arg",cr[0167]",r0",r3"-r12",fp0"-fp13",mq",lr"
1227| 000300 cror 4DEF 7B82
0| 000304 l 80BC 0004 L r5=SHADOW4$(r28,4)
0| 000308 b 4800 0010 B CL.23
CL.116:
0| 00030C l 80BC 0004 L r5=SHADOW4$(r28,4)
0| 000310 b 4800 0008 B CL.23
CL.117:
0| 000314 l 80BC 0004 L r5=SHADOW4$(r28,4)
CL.23:
CL.20:
User probe has write access to directory /afs/athena/user/j/jfc/xlc; delete
the files there when they are not needed.