chris@umcp-cs.UUCP (11/03/83)
Bug: f77 crashes with "no table entry for op REG". Repeat-By: Try compiling this program: program bug f1=bt*.5*(1./e-e*exp(-2.*x)) end If you get that error during the compilation, you have the bug. Fix: Not sure that this is correct, but: change the entry in ../src/cmd/pcc/table.c, around line 750, which reads ASG OPFLOAT, INAREG|INTAREG|FOREFF|FORCC, SAREG|AWD, TFLOAT, SAREG|AWD, TDOUBLE, NAREG, RLEFT|RESC1|RESCC, " cvtfd AL,A1\n OD2 AR,A1\n cvtdf A1,AL\n", to ASG OPFLOAT, INAREG|INTAREG|FOREFF|FORCC, SAREG|AWD, TFLOAT, SAREG|AWD, TDOUBLE, 2*NTEMP, RLEFT|RESC1|RESCC, " cvtfd AL,A1\n OD2 AR,A1\n cvtdf A1,AL\n", (You might search for "cvtfd"; there aren't many.) From one night's hacking, it appears that NAREG says that the operation needs a temporary register for its results. The only thing is that the operation needs *two* temporary registers. When the code generator goes to compute the ASG OPFLOAT, in the particular example above, it finds that there are no temporary registers (register pairs that is) available. It then tries to use the default rewrite rule for ASG OP operations, and ends up trying to simplify a register (!). It can't, so it gives up in disgust. With the 2*NTEMP, it knows to reserve the space it needs (and in this program winds up using stack space). This fix would also apply to the C compiler, except that the C compiler always does things in double precision and never needs to convert floats to doubles for intermediate results (at least it doesn't need to at this level). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci UUCP: {seismo,allegra,brl-bmd}!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris.umcp-cs@CSNet-Relay