Previous Thread
Next Thread
Print Thread
COMPILE issues with ENDIF #19300 26 Jan 12 03:37 AM
Joined: Nov 2007
Posts: 69
J
Jack Rupert Offline OP
Member
OP Offline
Member
J
Joined: Nov 2007
Posts: 69
Using A-Shell/AIX Version 5.0.1001.4

Compiler for AlphasBASIC
COMPIL LIT 12 445-543-215-562 1.1(122)

If I COMPIL/X:2 the same source code without line numbers in the source I receive an error for the following code. If I line number the source it does not issue an error from the compiler. This issue does not allow us to catch erroneous code that could potentially cause a Production issue.

Without line numbers:
?ENDIF without IF (41) - ENDIF

No error with line numbers.

Source Code:
----------
IF EXITCODE<>0 GOTO END'JOB'EXIT
ENDIF
FILEIN=TEMP$
----------
35 IF EXITCODE<>0 GOTO END'JOB'EXIT
36 ENDIF
37 FILEIN=TEMP$
----------

Re: COMPILE issues with ENDIF #19301 26 Jan 12 04:26 AM
Joined: Jun 2001
Posts: 11,945
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,945
Looks like a bona fide compiler bug. Fortunately, in this case it doesn't generate erroneous RUN code (the superfluous ENDIF is just that, superfluous). But if it occurred within a nested IF/ENDIF, the dangling ENDIF would be matched against the first IF, which might well result in erroneous RUN code.

Probably this has gone so long without notice because few people use line numbers any more. Instead, the recommendation is to use the /LF switch to generate a .LSX listing which contains internal "location counters" for each source line. This location counter is reported in Basic errors (and logged to the ashlog.log file if you have the TRACE=BASERR option turned on, which is highly recommended). Although to be useful you need to keep the .LSX matching each version of a .RUN file, this is relatively easy to do. And it shields you from the problem of renumbering (which renders the line numbers embedded in the .RUN useless without having saved a copy of the previously-numbered source). The .LSX also contains all of the ++included code, so there is no doubt about which versions of include files were actually in the RUN file. Better still, in 6.0, you can even recompile the LSX directly, which is really the ultimate way to patch an old version of a RUN file without having to worry about introducing new behavior if your sources have changed in the interim.

But, that doesn't eliminate the need to fix the compiler problem, which I'll work on shortly. Note, however, that because the compiler is embedded in the ashell executable, it would mean updating the entire executable to 5.0.1001.5. (Or, switching to the native compil executable, which is independent of the ashell executable. Or, just updating to 6.0, which you're going to start feeling pressure to do soon, as it becomes the official stable release.)

Re: COMPILE issues with ENDIF #19302 26 Jan 12 07:50 AM
Joined: Sep 2002
Posts: 5,486
F
Frank Online Content
Member
Online Content
Member
F
Joined: Sep 2002
Posts: 5,486
I can concur on the LSX files... can't live without them now!!

Member back in the day, some old company named... Madics was it, would run some sort of archaeic PREBAS or something that would include all ++files and renumber and recompile?? wink

Re: COMPILE issues with ENDIF #19303 26 Jan 12 08:01 AM
A
Anonymous
Unregistered
Anonymous
Unregistered
A
I hate to admit it, but I agree with Frank. Never did I think I could live without line numbers, but love it now.

Re: COMPILE issues with ENDIF #19304 26 Jan 12 08:11 PM
Joined: Sep 2003
Posts: 4,178
Steve - Caliq Offline
Member
Offline
Member
Joined: Sep 2003
Posts: 4,178
You remember well Frank... and we still use PROBAS that pulls together all $COPY {filename} statements with in the program (like ++Include) into one file and then it is compiled. (Cant remember why it was done this way, maybe 20+ years ago you could not nest INCLUDES im not sure)

But Yes, .XLS are great smile

Re: COMPILE issues with ENDIF #19305 30 Jan 12 04:37 AM
Joined: Sep 2002
Posts: 5,486
F
Frank Online Content
Member
Online Content
Member
F
Joined: Sep 2002
Posts: 5,486
Steve, hmmm, probably Gazza's fault wink

Re: COMPILE issues with ENDIF #19306 30 Jan 12 11:34 AM
Joined: Jun 2001
Posts: 11,945
J
Jack McGregor Online Content
Member
Online Content
Member
J
Joined: Jun 2001
Posts: 11,945
I've generated a patch for the problem (and coincidentally for another unrelated problem having to do with /MX failing to list all of the occurrences of the unmapped variable). But I'm sure you can agree that it is absolutely critical that a patch like this (to not only the stable 6.0 compiler but also the stable 5.0 compiler) not introduce any other unwanted changes (i.e. changes to the RUN hash). So, prior to making the patch generally available, I'm putting it out to beta test with selected developers willing to do a mass recompile of their source and VERIFY the output against their existing RUNs.

If anyone wants to participate in that, please email me directly and I'll send you a link to the appropriate beta update to test with. If you have a method of recompiling your programs en masse, the test should be easy and quick, assuming no anomalies. (And if you don't, take a look at the RECOMX.BP program in the SOSLIB, which will recompile all the source code in a single directory and make you a list of any that fail.)


Moderated by  Jack McGregor, Ty Griffin 

Powered by UBB.threads™ PHP Forum Software 7.7.3