Euphoria
Ticket #86:
compiling error
-
Reported by
Nemo
Oct 05, 2009
The following minimized code will report an error while compiling. Split the for loops at line [1] into 2 lines or comment the code at line [2] will make the error disappear:
public function pack(sequence s, integer m)
return s
end function
public function unpack(sequence s, integer m)
integer cha, ge = 5
atom alen = 10
for j=1 to alen do for j2=1 to ge-1 do cha = 1 end for end for -- [1]
return s
end function
sequence seq
seq = {} for j=1 to 1024 do seq &= rand(256)-1 end for
? equal(seq, unpack(pack(seq, 256), 256)) -- [2]
Console error message:
Translating code, pass: 1 2 3 generating Compiling with Watcom Compiling 12% init-.c Compiling 50% Noname1.c Noname1.c(57): Error! E1017: Label 'L4' already defined Couldn't compile file 'Noname1.c' Status: 8 Command: wcc386 /bt=nt /mf /w0 /zq /j /zp4 /fp5 /fpi87 /5r /otimra /s /ID:\Root\App\Euphoria\4 Noname1.c
bugreport.ex
Version
4.0.0 beta 2 (r2670)
Operating System
Platform: WinNT, Build: WinXP, Service Pack 2:2
Include Directories
1: D:\Root\App
EUDIR
D:\Root\App\Euphoria\4
PATH
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Root\App\Euphoria\4\b in;D:\Root\App\Watcom\BINNT;D:\Root\App\Watcom\BINW;
Details
1. Comment by mattlewis
Oct 05, 2009
The problem appears to be that there are two ENDFOR ops right next to each other. This seems to be confusing the translator as far as generating labels. The key is when the "end for"s are on the same line.
The translator emits lots of STARTLINE ops, which allow it to print source lines in the C code. But, of course, when the ENDFORs are right together, that's not there.
I'm not sure what the best solution is...need to look a little deeper to see what's really going on.
2. Comment by mattlewis
Oct 05, 2009
Fixed in r2902. When translating, ENDFOR ops check to see if the last op was also an ENDFOR, and if so, emit a special STARTLINE op to break it up so that the labels are correct.