Closed samiam95124 closed 2 months ago
The cks/ckv/cke statements end up as a set and always occur in that sequence in the intermediate. It begins with a cks that occurs after a load. I solved this by treating the cke instruction as a terminal and gathering the components into a single routine.
The problem is that cke cannot be a terminal, since it can be executed in an expression. I believe that this needs to be moved to being an expression leaf. It has no net effect on the code that calls it, but it could produce side effect issues if executed out of context, and this would occur if cke is a terminal. Moving it to being a expression operator is tricky, and it must be subtractable.
Code for cks/ckv/cke committed, it needs to be tied into assreg() and genexp(), they will simply execute the cl fork of expression operators if not nil.
Then head for testing.
I already found that it gets to some 3000 of 3300 lines of ISO 7185 test when this fix is done.
I have given consideration to converting the present tree graph system to a full DAG (Directed Acyclic Graph). The reasons are:
What this would involve is:
This would not happen before 0.3. I want to get a running version up before significant refactors such as this.
The optimizations that would go better with this change are:
Back on this after breaking my arm. The current test is:
pe standard_tests/iso7185pat
Which compiles and runs the standard acceptance test to iso7185pat.s, the output assembly file.
My debug flow is pretty simple, I put in writeln() statements of the form:
;writeln;writeln(prr, 'routine: xxx');
Flush left. The flush left makes them easier to find. The leading ';' makes the syntax work better, and also marks them as easier to find, using a search like '$;' meaning semicolon at start of line. The extra writeln at the start makes sure that we won't simply add to an incomplete line. Outputting to the prr file instead of output makes the debug statements sync with the output code, which makes it (for me) easier to see the flow of the code.
The majority of what is happening with pgen can be determined by looking at the .s file. This is because pgen dumps an incredible amount of tracking information into the .s file, to the point of being annoying. As previously related, everything non-functional in the file can be dropped out with:
cat test.s | sed '/^#/d'
Which filters all comments out of the file.
I also have a habit of marking routines with 'xxx: begin' and 'xxx: end' so that I can track routine entry/exits.
Yes. If you know me, I tend not to use even IDE debuggers. I find the writeln()/printf() method easier and more flexible, you can output complex diagnostics in the code. However, I should use the debugger method more, if nothing else, to help prove it out.
One change I have made coming back to the project is that I am debugging the whole PAT file instead of a cut down version of it. This just makes it a more straightforward operation.
Pretty much exclusively vscode. I supplement this occasionally with Eclipse, which has less braindamaged block editing features. I'll be honest, I grew up with Brief on MS-DOS[1], and I used every feature of that including block operations and macros. I have yet to see an editor/IDE that has the same functionality as Brief did. Block operations "kinda" work in Eclipse, are completely broken in vscode, and macros in Eclipse actually managed to drop characters from the macro output, making them completely useless. I haven't looked at macros in vscode.
The advantage to vscode is it works everywhere There are some features that work better in vscode as well. Both of these editors make it hard to turn off automatic editing features as well, which (perhaps showing my age) I really CAN'T STAND. I know how to edit my code and don't need to be fighting the editor for control, thank you much.
[1] Keep in mind that I am old enough to remember TECO on the PDP-11. Don't worry if you don't know what that is.
The cta instruction has the same issues as chk instructions (transparent operators, listed above). Thus this same processing method needs to be applied to it.
dup instruction (and friends)
So as I think I have related before, the SC (stack computer) instruction set is not really designed for compilation into machine code. It contains "tricks" that work on the SC, but not elsewhere. How do I know this? Because I put them there. Most or all of the tricks didn't happen before about Pascal-P5.
There were two solutions to this in pgen:
Obviously, the first rule is better. We don't want to mess with a working SC implementation just to accommodate pgen. However, sometimes the solution was just an obvious tweak to the SC that fixed both. The new cuf (call user function) and cif (call indirect function) opcodes illustrate this perfectly. The original SC cup (call user procedure) and cip (call indirect procedure) were ambiguous to pgen between procedure and function calls, but not to the SC. It was a simple fix.
So dup is an example of an SC instruction that creates a mess in pgen. Basically it creates a tree with two branches pointing to the same subnode. I even tried to find the term for such a tree. There is "acyclic", or not containing loops, but I could not find a term for duplicate branches. If you study compiler literature[1] you rapidly find that compiler writers deal with these situations by eliminating them. Quickly. Which is why generating acyclic graphs for intermediate code is a thing.
Anyways, I tried several methods to deal with the dup instruction. which if you look at the pcom.pas source, is only used for addresses and integers. Finally, I realized that it is being used to effectively implement subexpression optimization on the cheap. Since I plan to implement subexpression elimination at some point, the answer was:
The fix part for dup is to copy one tree to another. The good news is the routine to do this is almost poetic:
{ duplicate subtree }
procedure duptre(s: expptr; var d: expptr);
begin
if s = nil then d := nil else begin
getexp(d); d^ := s^; duptre(s^.l, d^.l); duptre(s^.r, d^.r);
duptre(s^.x1, d^.x1)
end
end;
The secret to its simplicity is the fact that Pascal can copy an entire structure at a single assignment statement. So duptre() copes the entire expression entry at a step, including links to invariants like strings. Then the links are substituted by copies recursively.
So if the dup issue is fixed, it turns out that this fixes other issues as well. The Pascal-P6 SC contains what I call "side chains", which are things like the cks/cke instructions, that destructively check tags for variants. The operation has to be destructive, because it checks tags whose access is unrelated to the operation being performed, usually access to one of the fields controlled by the tag. In the SC, these side chains are executed in place on the stack, then they disappear. In pgen this does not work. So one of the common things that side chains do is use the dup instruction to get a copy of the base pointer for a record with variants. Now, with the new way of handling dups, we get side chains with duplicates that are isolated from the included instruction tree. Thus the entire side chain can be pruned from the tree and set aside to be executed first.
The whole of iso7185pat.pas is now translated to assembly. Next phase is verify assembly syntax, then verify function.
iso7185pat.pas output assembly iso7185pat.s now is error free. Next phase is verify run output.
At run it prints the test suite banner and segfaults.
Some stats for grins:
3380 lines in iso7185pat.pas 40120 lines in iso7185pat.p6 151443 lines in iso7185pat.s
of which:
42246 lines are active in iso7185pat.s (comments stripped out)
Interesting how the intermediate in almost exactly matches the assembly output in size.
So what's it like debugging this? I have never done a compiler with output to assembly source. IP Pascal was direct to object code. I suspect that IP, if I ever work on it again, will get the same treatment. When IP Pascal was done in 1986, saving the entire assembly pass and the time to do it was important, but I don't think anyone values that anymore. Its too much work to directly output binary from the compiler, and computers are so fast the extra processing time is not a big deal.
The biggest impact was that the assembly output had to be correct before moving on. Usually I would just go directly to debugging the output code.
Another difference with this system is the need for %rip relative mode. gas requires either %rip relative mode be used, or use the -fPIC mode, which stands for "Position Independent Code". The PIC flag, according to gas documentation, means that it will compile so that the resulting code will run at any position in memory without change.
Something is actually FUBAR with that description, because the assembler gas has nothing to do with that. In any case using %rip relative mode fixes it. What %rip relative mode does is include the instruction pointer in the calculation of address of objects in the .text segment. This means that any addresses formed are relative to the PC, and thus the code is position independent.
In IP Pascal, the addresses are absolute, but the linker takes care of them. That is, the code is NOT position independent, but the linker fixes that without complaint. I don't actually mind using %rip relative mode, but at some point I should find out what the net cost of that is.
The output of a program in Pascaline is a single .s module. Uniting that with a system support module is a classic implementation method. Of course, what psystem, the system support module really does is translate Pascaline calls to libc (glibc) calls. The code for this is not really new, most of it was obtained directly from cmach, the Pascal-P stack computer coded in C.
So what are the relative sizes of the sources?
7782 for pint.pas 3432 for pmach.pas 3299 for cmach.pas 3898 for pgen_gcc_AMD64.pas
Of course, this is not a fair comparison. pint.pas includes the full debugger, so its not surprising it is twice the size of the others. pgen does not yet support all of Pascaline, so it may yet double in size. Hopefully not. I'd like to see it remain below 5000 lines, simply because that will mean porting it to other processors will not be such a job. However, it is interesting that the cost to interpret is similar to the cost to translate.
Today's code vignette:
# 794: 3108: ! a[1] := 1; ! this is the statement being encoded
# 810: 3125: 5: lao 196
# 810: 3126: 123: ldci 1
# 810: 3127: 26: chki 1 10
# 810: 3128: 57: deci 1
# 810: 3129: 16: ixa 8
# 810: 3130: ! esia[two] := 1;
# 810: 3131: 123: ldci 1
# 810: 3132: 6: stoi
# expr:
# 16: ixa r1: rcx
# Left:
# 5: lao r1: rcx
# right:
# 57: deci r1: rsi
# Left:
# 26: chki r1: rsi t1: rdi
# Left:
# 123: ldci r1: rsi
# expr:
# 123: ldci r1: rbx
# generating: 5: lao
leaq globals_start+196(%rip),%rcx ! get address of a
# generating: 123: ldci
movq $1,%rsi ! load index 1
# generating: 26: chki
movq $1,%rdi ! check bound of index between 1 and 10
cmpq %rdi,%rsi
jae .+ 21
movq $ValueOutOfRange,%rax
call psystem_errore
movq $10,%rdi
cmpq %rdi,%rsi
jbe .+ 11
call psystem_errore
# generating: 57: deci ! base index to 0
subq $1,%rsi
# generating: 16: ixa
movq $8,%rax ! scale by size of integer (8)
mul %rsi
add %rax,%rcx ! add to base address a
# generating: 123: ldci
movq $1,%rbx ! get 1 (right side expression)
# generating: 6: stoi
movq %rbx,(%rcx) ! store to net address of a[1]
So for this one you might reread the dup instruction solution above.
One way of looking at this is that transparent operators and dups break the rules of orthogonal trees. That is, duplicate branches, operators with more than one result (which makes them effectively multiple branch) etc.
What the dup solution is is "fix" the expression tree to be orthogonal again. So extending the principle, we duplicate the tree under transparent operators and separate those trees out to be on their own.
This duplication has to be limited. There are too many variations on expression links. So the duptre() routine was extended to null out everything else but simple trees.
The intermediate language for Pascal-P does not have to be a linearized tree form. So what we have are phases:
So this gets optimized. What transparents and dups did from this point of view is try to do optimization too early in the process. So instead we deal with rational trees and let the lower levels handle the optimization.
The source files for pgen 64 bit version were moved down to:
source/AMD64/gcc
And now it is pgen.pas in source form, and pgen_gcc_AMD64 in executable form.
The division of CPU type should be fairly obvious. Why the gcc directory? pgen is dependent on both a C compiler and on its associated assembler. This includes gcc, the llvm compiler and assembler, Microsoft's Visual Studio tools, and IP Pascal's own assembler.
gcc/llvm are compatible, so they can live in the same directory. The VS compiler/assembler uses original Intel format assembly instructions, and has a different calling convention, so it needs a separate directory even though its C compiler is mostly compatible, if you stick to libc calls.
IP Pascal's assembler also uses Intel format, but it is not a typed assembly language. However, there will never be an IP C compiler, so its debatable if there will ever be a fork for that.
Progress:
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ standard_tests/iso7185pat
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
The following are implementation defined characteristics
Maxint: 9223372036854775807 Bit length of integer without sign bit appears to be: 1 Integer default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1 Real default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1.20000000000000e+00 Note that the exponent character 'e' or 'E' is implementation defined as well as the number of exponent digits Boolean default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 false true Note that the upper or lower case state of the characters in 'true' and 'false' are implementation defined Char default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 a Appears to be ASCII Appears to not be ASCII
Control structures tests
Control1: 140736673330288 s/b 1 2 3 4 5 6 7 8 9 10 Control2: 140736673330288 s/b 10 9 8 7 6 5 4 3 2 1 Control3: 1 s/b 1 2 3 4 5 6 7 8 9 10 Control4: 1 s/b 1 2 3 4 5 6 7 8 9 10 Control5: 1 s/b 1 2 3 4 5 6 7 8 9 10 Control6: yesno s/b yes Control7: noyes s/b yes Control8: yes stop s/b yes stop Control9: no stop s/b stop Control10: one two three four five six seven eight nine-ten Control10: s/b one two three four five six seven eight nine-ten nine-ten Control11: start stop s/b start stop Control12: start !! BAD !!stop s/b start stop Control13: start 140736673330288 s/b start 1 2 3 4 5 6 7 8 9 10 Control14: start 140736673330288 s/b start 10 9 8 7 6 5 4 3 2 1 Control15: start 140736673330288 s/b start 0 1 2 3 4 5 6 7 8 9 Control16: start 140736673330288 s/b start 9 8 7 6 5 4 3 2 1 0
Q. Why did it take so long to get to the first tests? A. I left all of the checks in, array assigns, variant assigns, etc. It took a while to get through them.
*******************************************************************************
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
*******************************************************************************
The following are implementation defined characteristics
Maxint: 9223372036854775807
Bit length of integer without sign bit appears to be: 1
Integer default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1
Real default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1.20000000000000e+00
Note that the exponent character 'e' or 'E' is implementation
defined as well as the number of exponent digits
Boolean default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
false
true
Note that the upper or lower case state of the characters in
'true' and 'false' are implementation defined
Char default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
a
Appears to be ASCII
******************* Control structures tests *******************
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1
Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control6: yes s/b yes
Control7: yes s/b yes
Control8: yes stop s/b yes stop
Control9: stop s/b stop
Segmentation fault (core dumped)
So the phase of needing to correct the assembly output had to be repeated. Why?
The reason was that some of the instructions were not completely evaluated. Thus, since pgen gathers code into expression trees, not finishing the evaluation of the tree essentially discards it. You can think of it this way. The program is essentially one big graph (tree). So it was not completely explored. Thus there were bad encodes that didn't get revealed because they existed in unexplored parts of the tree. Thus fixing assembly language generation was required again in those cases.
There are two basic ways to evaluate intermediate code that I have used: Linear and graph construction. Linear evaluation means you look at the intermediate code one operation at a time. Graph construction means to take the intermediate and build a big graph/tree of how it works, including interconnection.
As related above, linearly evaluated code does not have to be in rational tree format, which is no duplicate branches, no cycles, each branch yields a single result, etc. In fact, this is a feature of most linear/stack evaluated code. Forth has a duplication operator.
So what lesson have I learned from pgen? It would be that linear/stack machine code can be read in as a rational tree by "rerationalizing" the code, essentially massaging it so that it becomes a rational tree again. I say "again" because the source code (Pascal) is essentially in rational tree form.
This is a fundamental insight.
*******************************************************************************
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
*******************************************************************************
The following are implementation defined characteristics
Maxint: 9223372036854775807
Bit length of integer without sign bit appears to be: 1
Integer default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1
Real default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1.20000000000000e+00
Note that the exponent character 'e' or 'E' is implementation
defined as well as the number of exponent digits
Boolean default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
false
true
Note that the upper or lower case state of the characters in
'true' and 'false' are implementation defined
Char default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
a
Appears to be ASCII
******************* Control structures tests *******************
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1
Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control6: yes s/b yes
Control7: yes s/b yes
Control8: yes stop s/b yes stop
Control9: stop s/b stop
Control10: one two three four five six seven eight nine-ten nine-ten
Control10: s/b one two three four five six seven eight nine-ten nine-ten
Control11: start stop s/b start stop
Control12: start stop s/b start stop
Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10
Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1
Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9
Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0
Control17: start *** bad *** start s/b start good
Control18: start stop s/b start stop
******************* Integers *******************
Integer1: 121 s/b 121
Integer2: 35 s/b 35
Integer3: 3354 s/b 3354
Integer4: 0 s/b 1
Integer5: 43 s/b 35
Integer6: 44 s/b 44
Integer7: 42 s/b 42
Integer8: 86 s/b 1849
Integer9: N s/b N
Integer10: 43 s/b 43
Integer11: false s/b true
Integer12: false s/b false
Integer13: true s/b true
Integer14: false s/b false
Integer15: true s/b true
Integer16: false s/b false
Integer17: true s/b true
Integer18: false s/b false
Integer19: true s/b true
Integer20: false s/b false
Integer21: true s/b true
Integer22: true s/b true
Integer23: false s/b false
Integer24: true s/b true
Integer25: true s/b true
Integer26: false s/b false
Integer27: 546 s/b 546
Integer28: 90 s/b 90
Integer29: 22 s/b 22
Integer30: 1904 s/b 1904
Integer31: 0 s/b 1
Integer32: 34 s/b 22
Integer33: 6 s/b 6
Integer34: 4 s/b 4
Integer35: 14 s/b 49
Integer36: A s/b A
Integer37: 65 s/b 65
Integer38: 768 s/b 768
Integer39: false s/b true
Integer40: false s/b false
Integer41: true s/b true
Integer42: false s/b false
Integer43: true s/b true
Integer44: false s/b false
Integer45: true s/b true
Integer46: false s/b false
Integer47: true s/b true
Integer48: false s/b false
Integer49: true s/b true
Integer50: true s/b true
Integer51: false s/b false
Integer52: true s/b true
Integer53: true s/b true
Integer54: false s/b false
*** Runtime error
The nice thing about this phase of debugging is that you can just clip out the failing code into a test.pas file and process it alone.
Fixed the error message:
...
Integer53: true s/b true
Integer54: false s/b false
*** Runtime error: Value out of range
Here's the debug for this:
Reading symbols from standard_tests/iso7185pat...
(gdb) b psystem_errorv
Breakpoint 1 at 0x1312: file source/AMD64/gcc/psystem.c, line 441.
(gdb)
Breakpoint 1, psystem_errorv (ea=93824992248478) at source/AMD64/gcc/psystem.c:441
(gdb) bt
#0 psystem_errorv (ea=93824992248478) at source/AMD64/gcc/psystem.c:441
#1 0x0000555555555a7c in psystem_errore (ei=14) at source/AMD64/gcc/psystem.c:559
#2 0x00005555555604d4 in iso7185pat () at standard_tests/iso7185pat.s:18971
# 1048: 6101: 123: ldci 9223372036854775807
# 1048: 6102: 36: ngi
# 1048: 6103: 26: chki -9223372036854775807 9223372036854775807
# 1048: 6104: 3: sroi 1536
# expr:
# 26: chki r1: rbx t1: rcx
# Left:
# 36: ngi r1: rbx
# Left:
# 123: ldci r1: rbx
# generating: 123: ldci
movq $9223372036854775807,%rbx
# generating: 36: ngi
negq %rbx
# generating: 26: chki
movq $-9223372036854775807,%rcx
cmpq %rcx,%rbx
jae 1f
movq $ValueOutOfRange,%rdi
call psystem_errore
1:
movq $9223372036854775807,%rcx
cmpq %rcx,%rbx
jbe 1f
movq $ValueOutOfRange,%rdi
call psystem_errore <<===== 18971
1:
# generating: 3: sroi
movq %rbx,globals_start+1536(%rip)
*******************************************************************************
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
*******************************************************************************
The following are implementation defined characteristics
Maxint: 9223372036854775807
Bit length of integer without sign bit appears to be: 63
Integer default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1
Real default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1.20000000000000e+00
Note that the exponent character 'e' or 'E' is implementation
defined as well as the number of exponent digits
Boolean default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
false
true
Note that the upper or lower case state of the characters in
'true' and 'false' are implementation defined
Char default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
a
Appears to be ASCII
******************* Control structures tests *******************
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1
Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control6: yes s/b yes
Control7: yes s/b yes
Control8: yes stop s/b yes stop
Control9: stop s/b stop
Control10: one two three four five six seven eight nine-ten nine-ten
Control10: s/b one two three four five six seven eight nine-ten nine-ten
Control11: start stop s/b start stop
Control12: start stop s/b start stop
Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10
Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1
Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9
Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0
Control17: start good s/b start good
Control18: start stop s/b start stop
******************* Integers *******************
Integer1: 121 s/b 121
Integer2: 35 s/b 35
Integer3: 3354 s/b 3354
Integer4: 1 s/b 1
Integer5: 35 s/b 35
Integer6: 44 s/b 44
Integer7: 42 s/b 42
Integer8: 1849 s/b 1849
Integer9: N s/b N
Integer10: 43 s/b 43
Integer11: true s/b true
Integer12: false s/b false
Integer13: true s/b true
Integer14: false s/b false
Integer15: true s/b true
Integer16: false s/b false
Integer17: true s/b true
Integer18: false s/b false
Integer19: true s/b true
Integer20: false s/b false
Integer21: true s/b true
Integer22: true s/b true
Integer23: false s/b false
Integer24: true s/b true
Integer25: true s/b true
Integer26: false s/b false
Integer27: 546 s/b 546
Integer28: 90 s/b 90
Integer29: 22 s/b 22
Integer30: 1904 s/b 1904
Integer31: 1 s/b 1
Integer32: 22 s/b 22
Integer33: 6 s/b 6
Integer34: 4 s/b 4
Integer35: 49 s/b 49
Integer36: A s/b A
Integer37: 65 s/b 65
Integer38: 768 s/b 768
Integer39: true s/b true
Integer40: false s/b false
Integer41: true s/b true
Integer42: false s/b false
Integer43: true s/b true
Integer44: false s/b false
Integer45: true s/b true
Integer46: false s/b false
Integer47: true s/b true
Integer48: false s/b false
Integer49: true s/b true
Integer50: true s/b true
Integer51: false s/b false
Integer52: true s/b true
Integer53: true s/b true
Integer54: false s/b false
Integer55: 6 s/b 6
Integer56: 6 s/b 6
Integer57: -12 s/b -12
Integer58: -46 s/b -46
Integer59: 34 s/b 34
Integer60: -52 s/b -52
Integer61: -18 s/b -18
Integer62: -280 s/b -280
Integer63: -280 s/b -280
Integer64: 448 s/b 448
Integer65: -1 s/b -1
Integer66: -1 s/b -1
Integer67: 2 s/b 2
Integer68: -13 s/b -13
Integer69: -33 s/b -33
Integer70: 196 s/b 196
Integer71: false s/b false
Integer72: true s/b true
Integer73: true s/b true
Integer74: false s/b false
Integer75: true s/b true
Integer76: false s/b false
Integer77: true s/b true
Integer78: true s/b true
Integer79: false s/b false
Integer80: false s/b false
Integer81: true s/b true
Integer82: true s/b true
Integer83: false s/b false
Integer84: false s/b false
Integer85: true s/b true
Integer86: true s/b true
Integer87: true s/b true
Integer88: false s/b false
Integer89: false s/b false
Integer90: true s/b true
Integer91: true s/b true
Integer92: true s/b true
Integer93: false s/b false
Integer94: false s/b false
Integer95: 14 s/b 14
Integer96: 0 s/b 0
Integer97: 0 s/b 0
Integer98: 0 s/b 0
Integer99: 15 s/b 15
Integer100: 45 s/b 45
Integer101: -39 s/b -39
Integer102: -35 s/b -35
Integer103: 34 s/b 34
Integer104: -48 s/b -48
Integer105: -44 s/b -44
Integer106: -20 s/b -20
Integer107: -126 s/b -126
Integer108: 520 s/b 520
Integer109: -6 s/b -6
Integer110: -25 s/b -25
Integer111: 5 s/b 5
Integer112: -9 s/b -9
Integer113: 0 s/b 0
Integer114: -2 s/b -2
Integer115: 64 s/b 64
Integer116: -55 s/b -55
Integer117: false s/b false
Integer118: true s/b true
Integer119: true s/b true
Integer120: false s/b false
Integer121: true s/b true
Integer122: false s/b false
Integer123: true s/b true
Integer124: true s/b true
Integer125: false s/b false
Integer126: false s/b false
Integer127: true s/b true
Integer128: true s/b true
Integer129: false s/b false
Integer130: false s/b false
Integer131: true s/b true
Integer132: true s/b true
Integer133: true s/b true
Integer134: false s/b false
Integer135: false s/b false
Integer136: true s/b true
Integer137: true s/b true
Integer138: true s/b true
Integer139: false s/b false
Integer140: false s/b false
Integer141: 6 s/b 6
Integer142: -52 s/b -52
Integer143: 52 s/b 52
Integer144: -768 s/b -768
Integer145: 52 s/b 52
Integer146: 0 s/b 0
Integer147: 42 s/b 42
Integer148: 1 2 3 4 5 6 7 8 9 10 11 12 13 s/b 1 2 3 4 5 6 7 8 9 10 11 12 13
******************* Subranges *******************
Subrange1: 121 s/b 121
Subrange2: 35 s/b 35
Subrange3: 3354 s/b 3354
Subrange4: 1 s/b 1
Subrange5: 35 s/b 35
Subrange6: 44 s/b 44
Subrange7: 42 s/b 42
Subrange8: N s/b N
Subrange9: 43 s/b 43
Subrange10: true s/b true
Subrange11: false s/b false
Subrange12: true s/b true
Subrange13: false s/b false
Subrange14: true s/b true
Subrange15: false s/b false
Subrange16: true s/b true
Subrange17: false s/b false
Subrange18: true s/b true
Subrange19: false s/b false
Subrange20: true s/b true
Subrange21: true s/b true
Subrange22: false s/b false
Subrange23: true s/b true
Subrange24: true s/b true
Subrange25: false s/b false
Subrange26: 6 s/b 6
Subrange27: 6 s/b 6
Subrange28: -12 s/b -12
Subrange29: -46 s/b -46
Subrange30: 34 s/b 34
Subrange31: -52 s/b -52
Subrange32: -18 s/b -18
Subrange33: -280 s/b -280
Subrange34: -280 s/b -280
Subrange35: 448 s/b 448
Subrange36: -1 s/b -1
Subrange37: -1 s/b -1
Subrange38: 2 s/b 2
Subrange39: -13 s/b -13
Subrange40: -33 s/b -33
Subrange41: false s/b false
Subrange42: true s/b true
Subrange43: true s/b true
Subrange44: false s/b false
Subrange45: true s/b true
Subrange46: false s/b false
Subrange47: true s/b true
Subrange48: true s/b true
Subrange49: false s/b false
Subrange50: false s/b false
Subrange51: true s/b true
Subrange52: true s/b true
Subrange53: false s/b false
Subrange54: false s/b false
Subrange55: true s/b true
Subrange56: true s/b true
Subrange57: true s/b true
Subrange58: false s/b false
Subrange59: false s/b false
Subrange60: true s/b true
Subrange61: true s/b true
Subrange62: true s/b true
Subrange63: false s/b false
Subrange64: false s/b false
Subrange65: 14 s/b 14
******************* Characters*******************
Character1: g g u s/b g g u
Character2: h s/b h
Character3: f s/b f
Character4: 103 s/b 103
Character5: u s/b u
Character6: true s/b true
Character7: false s/b false
Character8: true s/b true
Character9: false s/b false
Character10: true s/b true
Character11: false s/b false
Character12: true s/b true
Character13: false s/b false
Character14: true s/b true
Character15: true s/b true
Character16: false s/b false
Character17: true s/b true
Character18: true s/b true
Character19: false s/b false
Character20: s/b porker porker parker
Character21: true s/b true
Character22: true s/b false
Character23: true s/b true
Character24: true s/b false
Character25: true s/b true
Character26: true s/b false
Character27: true s/b true
Character28: true s/b false
Character29: true s/b true
Character30: true s/b true
Character40: true s/b false
Character41: true s/b true
Character42: true s/b true
Character43: true s/b false
Character44: a s/b abcdefghijklmnopqrstuvwxyz
Character45: z s/b zyxwvutsrqponmlkjihgfedcba
Character46: 0
Character46: s/b 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character47: n s/b n
Character48: s/b junky01234
Character49:
Segmentation fault (core dumped)
I wonder if github cares a lot about how much space I use here? Oh, well, Microsoft just passed 3 trillion, so, you know.
Well, I thought I would describe my debug flow during this phase. The hardest part of debugging pgen encoder was at the start, getting it to output "hello, world" meant having the framing, basic system calls and program layout all working. Debugging the acceptance test is pretty straightforward by comparison. It consists of a long (very long) series of fixes for problems in the test, one by one.
The first step is to identify the next problem to work on. I do this (ideally) in linear fashion, that is, find the topmost failure in the test and work on it. It helps that the pat (Pascal Acceptance Test) is designed to support this, and starts with simple operations progressing to harder and more complex tests. Unless the solution to the problem is obvious, I start by taking the failing test by number/type, and moving that to test.pas. Usually that also involves moving the declarations it needs to test.pas as well.
Then I get three copies:
These are all kinda redundant, since the .s includes both previous files in comments. But I find it is clearer in the original form.
Then I execute:
gdbtui test
This is gdb in assembly debug mode. However, gdb is capable of mixed mode debugging. The Pascal stuff will all be in assembly language, gdb does not know how to relate that to the Pascal source (yet). But if you run into C code, such in the support library psystem.c, it will revert to C level debugging.
As it is, gdb will be able to use the line numbers from the assembly file, so "b line" works. Since gdb is showing you the assembly source, complete with annotations, its actually surprisingly high level. The Pascal source is there, and so is the intermediate code, and the assembly code being executed is there in context. If I add comments to the assembly file at the right of source lines, not altering the line structure of the file, those show up as well. I commonly add a running interpretation of what I think the code is doing in comments, to either print out or show up in debugging.
I had the occasion to go look at IP Pascal's back end encoder for 80386 (32 bit). So the comparison is (with admittedly pgen not quite complete yet):
pgen - 3999 lines IP Pascal encoder - 29683
So you could say pgen is significantly simpler than IP Pascal. We'll see if the results are anywhere near comparable.
A lot of the complexity of IP Pascal is that it does not use an assembler for the backend. It directly encodes machine instructions, and so acts as its own assembler. This made IP Pascal run faster because it didn't run a separate assembly pass. However, it does inflate the code quite a bit.
Back in 1993 when IP Pascal was created, compile speed was considered an important issue. It still is, but not so much any more.
So I just cleaned up another int vs. long error in the support code. And this means what? You say. Well, on a 64 bit processor int is.... errrr....32 bits. Long is 64 bits. On gcc at least. What about a 32 bit processor? Well, int is 32 bits, and long is 32 bits.
If you read C, going back to the whitebook, int is "supposed" to be the size of the basic machine word. Its the most efficient processing element in the machine, its word size. What happened?
Well, processors, at least in the microprocessor world, have marched on from the 1970's 16 bit processors[1] to 32 bits in the 1980's, to 64 bits in the 2000's and beyond[2]. In those periods of transitions some C compiler writers made the decision[3] to refrain from doubling the int word size when moving to the newer, larger, and we presume better, processors. Why would they do such a thing? It clearly says in the whitebook to not do that. RTFM. The reason why is that it breaks programs when you change the size of int. These programs were written without regard for the whitebook's council that programs should endevor to NOT be dependent on the size of int. It shouldn't be the compiler's job to FIX stupidly written programs.
But there you are.
So what happened? I live in the C world, too. So what you do is use "long" when you want the word size to adjust with the processor, and int if you want to remain in 32 bits. None of this makes sense if you dig into it. The rule that int stays the same was never followed, ether, since if it WAS, int would be 16 bits. Like forever. It makes sense only if you realize that the 16 bit compilers and the 32 bit compilers were written by different people at different times. IE, they were just responding to the number of customer/user complaints they were getting.
Similarly, long makes no sense. The original purpose of long was to be a double precision type. That is, on a 32 bit machine, int would be 32 bits, and long would be 64 bits. Instead they are both 32 bits. If you REALLY want 64 bits on a 32 bit machine, and your compiler implements that, you want "long long". Curious, since there is no "int int", but there you are. On a 64 bit machine, int is 32 bits, long is 64 bits, and long long is....also 64 bits (on most compilers).
If this sounds crazy to you, you will understand why most users have an include file with definitions such as int32, int64, uint32, uint64, etc. IE, you want so many bits, you specify so many bits. In the include file these translate to the actual compiler definition such as short, int, long, long long, uber long, etc.
So I went into this because Pascal compilers, at least mine, GPC and FPC, do not do this. Integer is 32 bits on a 32 bit machine, and 64 bits on a 64 bit machine. Your program is supposed to adapt. For that purpose you have maxint.
To be fair, this might not have been so with GPC. When moving to 64 bits, the compiler writers had a discussion about how to handle integer, and had decided to use the "integer is always 32 bits" plan. Or at least they did until the users, including me, pushed back on that plan.
Pascaline is its own category. Integer, indeed, does follow word size of the machine, 32 bits, 64 bits or even 16 bits. And maxint follows that. And there is linteger, cardinal (unsigned) and lcardinal. linteger is supposed to be double the size of integer (not garanteed!), and lcardinal double the size of cardinal. Really, any integer size can be specified by a subrange, like 0..255 is an unsigned byte, and -127..127 is a signed byte, etc. Pascal is "dial a size", or is supposed to be. All of these compilers support a "byte" type, but it is supposed to be equivalent to 0..255. If it gets special treatment from the compiler it should be automatic.
Pascaline is a bit different in that it considers all named integer types to be a subrange of the theoretical integer type, which is a range extending from negative infinity to positive infinity. The type integer specifies the word size of the machine, and using that is supposed to be more efficient.
What Pascaline does is open the implementation to the idea that any size of integer can be created. And, indeed, such math packages exist. N-ary math packages are routines that can have any length of integer.
[1] Pedantically you could say "8 bits", but realistically they had to process 16 bits for addresses. Most compilers targeting these processors just assumed a 16 bit word length. [2] Yes, they years of introduction are an approximation. Sit down. Drink coffee. [3] Yes, compiler writers make decisions, walk and chew gum, and some even have lives (present company not accounted for).
So I have been dealing with a series of segfaults of late. If you are paying attention, there's a lot wrong with that statement, not just the title of this note, which is a pun, son.
First of all, what is a segfault? It means "segment violation" or fault. Segment? What is a segment? That was Intel terminology for a segmented memory processor. There was a period, extending from about 1979 to 1987, when memory sizes and 16 bit addresses became two trains meeting from opposite directions at high speed and causing a gigantic train wreck. I refer to it still as "the microprocessor dark ages". The 8 bit and 16 bit processors that followed them both had a 16 bit address limitation. A lot of CPU makers, not just Intel, decided the answer was to implement "segmentation", which were 16 bit memory address descriptors that floated in a larger address space. In the case of Intel 8086, this was a 20 bit (1mb) address space. You could only address 64kb of memory at one time, but then you could set the "segment" offset so that you could address all of memory, abet only 64kb at a time.
Many processor makers implemented such a system, in various ways. I worked for a company that rolled their own by taking 4 bits of the top of the address, uniting it with 4 bits from an offset register, and piping that through a bipolar 256 byte memory (an ancient term for FAAAAASSSTTT) and used the resulting translated 8 bits, together with the 12 bits of processor address, to get a 20 bit address. The system was brilliant but hard to use, because it created 16 distinct address spaces made up of 4kb blocks. I came to work there, looked at the mess of offset switching software that they were using, and created a macro that could call and return from anywhere to anywhere in the 1mb address space, and fixed everything. The company rewarded me by immediately firing me (of course still using my code). Such is life[4].
Even Zilog with the Z80 used a segmenting system, using the Z180 processor, and the Z280 processor, which used a system that was an exact copy, implemented on silicon, of the above 256 to 256 translation system I mentioned above. I worked on the Z280 when I came to Silicon Valley, as I was a hardware engineer in those days. Many days working till 11pm while chain smoking, but that is another story. The Z8000 processor also had a segmenting system.
Anyways, segfault, means, that the processor accessed outside of a segment, or accessed it with incorrect permissions, say, writing to a read only segment. So what happened to segments? Well.... I actually refused to work with segments. In the early 1980's, when most code was still done with assembly languages, segmentation was in your face. You had to program specially to get around the limitations in accessing memory. Anyways, in later years, I worked for a company that used the Intel 80186 as an embedded processor and a previous programmer had written a multitask operating system using segmentation on the 80186. Now I HATE SEGMENTATION with a passion, so when they asked me to work on the system, I said "ok". In short order, I learned wayyyyyy to much about segmentation, and came up with a way to completely work around it in both assembly language and HLL. No, I didn't invent it. It was called "huge pointer math", and Borland invented it. I came up with a way to use it in assembly language, and included direct support for that in the assembler for IP Pascal.
Anyways, in 1987, the age of segmentation came to a crashing halt with the introduction of the 80386 processor. Intel introduced "flat mode addressing", which the rest of us called "normal mode", as in the way the dang thing should have worked in the first place. This is a case where designers need to step back and look at their work from afar. You don't have enough address bits to access the memory you need? You can come up with a thousand different convoluted schemes to get around that, but some uneducated rube from the back of the room raises his hand and asks "umm... why not just get more address bits?". Ok, obvious in retrospect, but let's note that this was not the end of the "memory space exceeds address space" wars. It happened again with the transition from 32 bit to 64 bit processors, which were largely marketed as a solution to the 4gb memory limit, and in fact are in the process of happening yet again for 64 to 128 bits. The great result of segmentation is that any designer that proposes it I highly suspect would be chucked out the front door summarily.
In fact, segmentation DIDN'T DIE WITH THE 80386! Intel, in their magnificent all high wisdom, implemented a newer, better 32 bit segmentation in the 80386, should you ever need to exceed 4gb! Well, in 1987 nobody was worried about exceeding 4gb, and most everyone (outside of Intel) breathed a giant sigh of relief that segmentation was finally over. So the idea of implementing newer better segmentation went over like someone farting at a high end French restaurant. In fact, Unix/Linux came to the 80386 processor largely because flat 32 bit addressing meant that hacks to accommodate segmentation finally were no longer necessary.
But even that was not the end of the story! OS/2 3.0[1] used a flash of rare IBM brilliance by using the 32 bit segmentation to integrate 80286 segmented programs from OS/2 2.0 into OS/2 3.0. This would be like inventing a way to teleport blocks of ice to users before the invention of refrigeration, only to be forgotten instantly[3].
So you read this far, and you would be justified in asking "what does this have to do with the price of tomatoes?". Well, in the 80386 fault interrupt model, the fault for memory accesses (again, invalid or incorrect permissions) ended up as: you guessed it, a "segmentation fault". Even though nowadays it really means "page fault". To be kind to Intel, when they designed the 80386, there was already a fault for memory accesses, and that was a segfault. And segmentation still existed on the 80386. And Intel was still laboring under the reality distorting illusion that someone, somewhere, would actually stoop to using it! And they were right in the case of IBM![2].
So that is a long explanation of why, even today, we have segfaults or segmentation faults in a processor that does not even have the ability to do segmentation anymore. AMD, when they designed the AMD64 64 bit model, wisely discarded segmentation and sent the feature to a well deserved grave.
Anyways, what does this have to do with Pascal-P6? Well, Pascal-P6 checks for things like double free, and invalid pointer accesses. So why didn't that work? Well, we are not using Pascal-P6, we are using GPC, which does not check for any of that. So the solution was to roll my own check for double free. It (as you can see from the code) consists of adding a ".free" flag to expptr, then turning it off and on in getexp() and putexp(). In fact, it found the problem immediately, and so there you go.
This is the difference between Pascal-P6 and other Pascals. Pascal-P6 checks for these things (with the option enabled). If you double free an entry, you are notified immediately, at the location where the fault occurred. The same with pointer access violations.
[1] A virtual study in how not to name your product, since it was not version 2, and the "2" it referred to in the "OS/2" referred to the 80286 processor, which OS/2 3.0 didn't use!
[2] And I will admit that I told Gerstner, the president of IBM at that time, that I thought they had handled OS/2 3.0 brilliantly. He was manning the CES booth with A broken arm from (IIRC) from skiing.
[3] As so well documented in the film "Rocky".
[4] Why did they fire me? Another "programmer" (in name only), after being shown the macro, went to management and proudly announced it as his own "brilliant discovery" and was promoted to manger of the group, replacing my previous boss, who was summarily fired as well. He in turn fired me. Its called "getting rid of the evidence". At the tender age of 20 years I was unaware of such things (in defense of the company that went along with this charade, I may have become a bit hot when I discovered credit for my work had been appropriated).
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
The following are implementation defined characteristics
Maxint: 9223372036854775807 Bit length of integer without sign bit appears to be: 63 Integer default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1 Real default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1.20000000000000e+00 Note that the exponent character 'e' or 'E' is implementation defined as well as the number of exponent digits Boolean default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 false true Note that the upper or lower case state of the characters in 'true' and 'false' are implementation defined Char default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 a Appears to be ASCII
Control structures tests
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1 Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control6: yes s/b yes Control7: yes s/b yes Control8: yes stop s/b yes stop Control9: stop s/b stop Control10: one two three four five six seven eight nine-ten nine-ten Control10: s/b one two three four five six seven eight nine-ten nine-ten Control11: start stop s/b start stop Control12: start stop s/b start stop Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10 Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1 Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9 Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0 Control17: start good s/b start good Control18: start stop s/b start stop
Integers
Integer1: 121 s/b 121 Integer2: 35 s/b 35 Integer3: 3354 s/b 3354 Integer4: 1 s/b 1 Integer5: 35 s/b 35 Integer6: 44 s/b 44 Integer7: 42 s/b 42 Integer8: 1849 s/b 1849 Integer9: N s/b N Integer10: 43 s/b 43 Integer11: true s/b true Integer12: false s/b false Integer13: true s/b true Integer14: false s/b false Integer15: true s/b true Integer16: false s/b false Integer17: true s/b true Integer18: false s/b false Integer19: true s/b true Integer20: false s/b false Integer21: true s/b true Integer22: true s/b true Integer23: false s/b false Integer24: true s/b true Integer25: true s/b true Integer26: false s/b false Integer27: 546 s/b 546 Integer28: 90 s/b 90 Integer29: 22 s/b 22 Integer30: 1904 s/b 1904 Integer31: 1 s/b 1 Integer32: 22 s/b 22 Integer33: 6 s/b 6 Integer34: 4 s/b 4 Integer35: 49 s/b 49 Integer36: A s/b A Integer37: 65 s/b 65 Integer38: 768 s/b 768 Integer39: true s/b true Integer40: false s/b false Integer41: true s/b true Integer42: false s/b false Integer43: true s/b true Integer44: false s/b false Integer45: true s/b true Integer46: false s/b false Integer47: true s/b true Integer48: false s/b false Integer49: true s/b true Integer50: true s/b true Integer51: false s/b false Integer52: true s/b true Integer53: true s/b true Integer54: false s/b false Integer55: 6 s/b 6 Integer56: 6 s/b 6 Integer57: -12 s/b -12 Integer58: -46 s/b -46 Integer59: 34 s/b 34 Integer60: -52 s/b -52 Integer61: -18 s/b -18 Integer62: -280 s/b -280 Integer63: -280 s/b -280 Integer64: 448 s/b 448 Integer65: -1 s/b -1 Integer66: -1 s/b -1 Integer67: 2 s/b 2 Integer68: -13 s/b -13 Integer69: -33 s/b -33 Integer70: 196 s/b 196 Integer71: false s/b false Integer72: true s/b true Integer73: true s/b true Integer74: false s/b false Integer75: true s/b true Integer76: false s/b false Integer77: true s/b true Integer78: true s/b true Integer79: false s/b false Integer80: false s/b false Integer81: true s/b true Integer82: true s/b true Integer83: false s/b false Integer84: false s/b false Integer85: true s/b true Integer86: true s/b true Integer87: true s/b true Integer88: false s/b false Integer89: false s/b false Integer90: true s/b true Integer91: true s/b true Integer92: true s/b true Integer93: false s/b false Integer94: false s/b false Integer95: 14 s/b 14 Integer96: 0 s/b 0 Integer97: 0 s/b 0 Integer98: 0 s/b 0 Integer99: 15 s/b 15 Integer100: 45 s/b 45 Integer101: -39 s/b -39 Integer102: -35 s/b -35 Integer103: 34 s/b 34 Integer104: -48 s/b -48 Integer105: -44 s/b -44 Integer106: -20 s/b -20 Integer107: -126 s/b -126 Integer108: 520 s/b 520 Integer109: -6 s/b -6 Integer110: -25 s/b -25 Integer111: 5 s/b 5 Integer112: -9 s/b -9 Integer113: 0 s/b 0 Integer114: -2 s/b -2 Integer115: 64 s/b 64 Integer116: -55 s/b -55 Integer117: false s/b false Integer118: true s/b true Integer119: true s/b true Integer120: false s/b false Integer121: true s/b true Integer122: false s/b false Integer123: true s/b true Integer124: true s/b true Integer125: false s/b false Integer126: false s/b false Integer127: true s/b true Integer128: true s/b true Integer129: false s/b false Integer130: false s/b false Integer131: true s/b true Integer132: true s/b true Integer133: true s/b true Integer134: false s/b false Integer135: false s/b false Integer136: true s/b true Integer137: true s/b true Integer138: true s/b true Integer139: false s/b false Integer140: false s/b false Integer141: 6 s/b 6 Integer142: -52 s/b -52 Integer143: 52 s/b 52 Integer144: -768 s/b -768 Integer145: 52 s/b 52 Integer146: 0 s/b 0 Integer147: 42 s/b 42 Integer148: 1 2 3 4 5 6 7 8 9 10 11 12 13 s/b 1 2 3 4 5 6 7 8 9 10 11 12 13
Subranges
Subrange1: 121 s/b 121 Subrange2: 35 s/b 35 Subrange3: 3354 s/b 3354 Subrange4: 1 s/b 1 Subrange5: 35 s/b 35 Subrange6: 44 s/b 44 Subrange7: 42 s/b 42 Subrange8: N s/b N Subrange9: 43 s/b 43 Subrange10: true s/b true Subrange11: false s/b false Subrange12: true s/b true Subrange13: false s/b false Subrange14: true s/b true Subrange15: false s/b false Subrange16: true s/b true Subrange17: false s/b false Subrange18: true s/b true Subrange19: false s/b false Subrange20: true s/b true Subrange21: true s/b true Subrange22: false s/b false Subrange23: true s/b true Subrange24: true s/b true Subrange25: false s/b false Subrange26: 6 s/b 6 Subrange27: 6 s/b 6 Subrange28: -12 s/b -12 Subrange29: -46 s/b -46 Subrange30: 34 s/b 34 Subrange31: -52 s/b -52 Subrange32: -18 s/b -18 Subrange33: -280 s/b -280 Subrange34: -280 s/b -280 Subrange35: 448 s/b 448 Subrange36: -1 s/b -1 Subrange37: -1 s/b -1 Subrange38: 2 s/b 2 Subrange39: -13 s/b -13 Subrange40: -33 s/b -33 Subrange41: false s/b false Subrange42: true s/b true Subrange43: true s/b true Subrange44: false s/b false Subrange45: true s/b true Subrange46: false s/b false Subrange47: true s/b true Subrange48: true s/b true Subrange49: false s/b false Subrange50: false s/b false Subrange51: true s/b true Subrange52: true s/b true Subrange53: false s/b false Subrange54: false s/b false Subrange55: true s/b true Subrange56: true s/b true Subrange57: true s/b true Subrange58: false s/b false Subrange59: false s/b false Subrange60: true s/b true Subrange61: true s/b true Subrange62: true s/b true Subrange63: false s/b false Subrange64: false s/b false Subrange65: 14 s/b 14
Characters
Character1: g g u s/b g g u
Character2: h s/b h
Character3: f s/b f
Character4: 103 s/b 103
Character5: u s/b u
Character6: true s/b true
Character7: false s/b false
Character8: true s/b true
Character9: false s/b false
Character10: true s/b true
Character11: false s/b false
Character12: true s/b true
Character13: false s/b false
Character14: true s/b true
Character15: true s/b true
Character16: false s/b false
Character17: true s/b true
Character18: true s/b true
Character19: false s/b false
Character20: porker porker parker s/b porker porker parker
Character21: true s/b true
Character22: false s/b false
Character23: true s/b true
Character24: false s/b false
Character25: true s/b true
Character26: false s/b false
Character27: true s/b true
Character28: false s/b false
Character29: true s/b true
Character30: true s/b true
Character40: false s/b false
Character41: true s/b true
Character42: true s/b true
Character43: false s/b false
Character44: abcdefghijklmnopqrstuvwxyz s/b abcdefghijklmnopqrstuvwxyz
Character45: zyxwvutsrqponmlkjihgfedcba s/b zyxwvutsrqponmlkjihgfedcba
Character46: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Character46: s/b 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character47: n s/b n
Character48: junky01234 s/b junky01234
Character49:
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character49: s/b
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character50:
zero one two three four five six seven eight nine
s/b zero one two three four five six seven eight nine
Character51: a s/b a
Character52: b s/b b
Character53: y s/b y
Character54: 99 s/b 99
Character55: g s/b g
Character56: true s/b true
Character57: false s/b false
Character58: true s/b true
Character59: false s/b false
Character60: true s/b true
Character61: false s/b false
Character62: true s/b true
Character63: false s/b false
Character64: true s/b true
Character65: true s/b true
Character66: false s/b false
Character67: true s/b true
Character68: true s/b true
Character69: false s/b false
Character70: true s/b true
Character71: false s/b false
Character72: true s/b true
Character73: false s/b false
Character74: true s/b true
Character75: false s/b false
Character76: true s/b true
Character77: false s/b false
Character78: true s/b true
Character79: true s/b true
Character80: false s/b false
Character81: true s/b true
Character82: true s/b true
Character83: false s/b false
Character84: this is a string s/b this is a string
Character85: v s/b v
Character86:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character87: s/b:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character88:
true true true true true true true true true
s/b
true true true true true true true true true
Character89:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Character90:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Booleans
Boolean1: true false s/b true false Boolean2: true s/b true Boolean3: false s/b false Boolean4: 0 s/b 0 Boolean5: 1 s/b 1 Boolean6: true s/b true Boolean7: true s/b true Boolean8: false s/b false Boolean9: true s/b true Boolean10: false s/b false Boolean11: true s/b true Boolean12: false s/b false Boolean13: true s/b true Boolean14: false s/b false Boolean15: true s/b true Boolean16: true s/b true Boolean17: false s/b false Boolean18: true s/b true Boolean19: true s/b true Boolean20: false s/b false Boolean21: false true s/b false true Boolean22: true false s/b true false Boolean23: true s/b true Boolean24: false s/b false Boolean25: true false s/b true false Boolean26: true s/b true Boolean27: false s/b false Boolean28: 0 s/b 0 Boolean29: 1 s/b 1 Boolean30: true s/b true Boolean31: true s/b true Boolean32: false s/b false Boolean33: true s/b true Boolean34: false s/b false Boolean35: true s/b true Boolean36: false s/b false Boolean37: true s/b true Boolean38: false s/b false Boolean39: true s/b true Boolean40: true s/b true Boolean41: false s/b false Boolean42: true s/b true Boolean43: true s/b true Boolean44: false s/b false Boolean45: false false false false false false fals fal fa f Boolean45: s/b: false false false false false false fals fal fa f Boolean46: true true true true true true true tru tr t Boolean46: s/b: true true true true true true true tru tr t
Scalar
Scalar1: true s/b true Scalar2: true s/b true Scalar3: 0 s/b 0 Scalar4: 2 s/b 2 Scalar5: true s/b true Scalar6: true s/b true Scalar7: false s/b false Scalar8: true s/b true Scalar9: false s/b false Scalar10: true s/b true Scalar11: false s/b false Scalar12: true s/b true Scalar13: false s/b false Scalar14: true s/b true Scalar15: true s/b true Scalar16: false s/b false Scalar17: true s/b true Scalar18: true s/b true Scalar19: false s/b false Scalar20: 0 1 2 3 4 5 6 s/b 0 1 2 3 4 5 6 Scalar21: 6 5 4 3 2 1 0 s/b 6 5 4 3 2 1 0 Scalar20: true s/b true Scalar21: true s/b true Scalar22: 2 s/b 2 Scalar23: 6 s/b 6 Scalar24: true s/b true Scalar25: true s/b true Scalar26: false s/b false Scalar27: true s/b true Scalar28: false s/b false Scalar29: true s/b true Scalar30: false s/b false Scalar31: true s/b true Scalar32: false s/b false Scalar33: true s/b true Scalar34: true s/b true Scalar35: false s/b false Scalar36: true s/b true Scalar37: true s/b true Scalar38: false s/b false
*** Reals **
Real1: 1.5540000e+00 s/b 1.554000e+00 Real2: 3.3400000e-03 s/b 3.340000e-03 Real3: 3.3400000e-24 s/b 3.340000e-24 Real4: 4.0000000e-45 s/b 4.000000e-45 Real5: 0.0000000e+00 s/b -5.565000e+00 Real6: 0.0000000e+00 s/b -9.440000e-03 Real7: 0.0000000e+00 s/b -6.364000e+29 Real8: 0.0000000e+00 s/b -2.000000e-14 Real9: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.23e+00 1.235e+00 1.2346e+00 1.23457e+00 1.234568e+00 1.2345679e+00 1.23456789e+00 1.234567890e+00 1.2345678901e+00 1.23456789012e+00 1.234567890123e+00 s/b (note precision dropoff at right): 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.23e+000 1.234e+000 1.2345e+000 1.23456e+000 1.234567e+000 1.2345678e+000 1.23456789e+000 1.234567890e+000 1.2345678901e+000 1.23456789012e+000 1.234567890123e+000 Real10: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2 2.23 3.235 4.2346 5.23457 6.234568 7.2345679 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901235 14.23456789012346 15.234567890123456 16.2345678901234578 17.23456789012345780 18.234567890123457801 19.2345678901234578007 20.23456789012345780066 s/b (note precision dropoff at right): 1.2 2.23 3.234 4.2345 5.23456 6.234567 7.2345678 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901234 14.23456789012345 15.234567890123456 16.2345678901234567 17.23456789012345678 18.234567890123456789 19.2345678901234567890 20.23456789012345678901 Real11: 1.4189000e+03 s/b 1.418900e+03 Rea112: 5.4844000e+02 s/b 5.484399e+02 Real13: 4.2812269e+05 s/b 4.281227e+05 Real14: 2.2601153e+00 s/b 2.260115e+00 Real15: true s/b true Real16: true s/b false Real17: false s/b true Real18: false s/b false Real19: false s/b true Real20: false s/b false Real21: false s/b true Real22: false s/b false Real23: false s/b true Real24: false s/b true Real25: false s/b false Real26: true s/b true Real27: true s/b true Real28: true s/b false Real29: 1.8676113e+02 s/b 4.35230e+02 Real30: 8.7046000e+02 s/b 1.89425e+05
At the midway point in the file.
I had a nasty one, yes, another segfault, a day or so ago. It was going into one of the system routines and segfaulting in glibc code. After many dives with gdb to see if I had set up the parameters going in, I reached a dead end.
So of course I pulled out one of my "super power" weapons(tm). What I did was a multistep process:
That ran without a segfault.
So now I had two different assembly programs, one generated by pgen, and one generated from C. They did the same thing but the pgen code faulted. Both were about a page long.
There are of course, minor differences. gcc uses different assembler directives. It uses a different method of framing. It picks up real constants differently (it loads them into an integer register and transfers them to a floating point register). Etc.
The idea is to copy lines from the working C program .s file to the failing Pascal .s file, testing it on each copied line or lines. At the end of the process, the files would be equal, but the idea is that at some point the failing file will start working, as indeed, it did.
Turns out the failure was in this code:
test:
# 1: 12: 245: sfr l test.6
# 1: 13: l test.6=0
test.6 = 0
# 1: 14: 12: cup l test.3
# expr:
# 12: cup
# call start:
# 245: sfr
# generating: 12: cup
# generating: 245: sfr
sub $test.6,%rsp
call test.3
# 1: 16: 22: ret
ret
This is a startup stub, its purpose is to call the next block in a series of loaded code blocks that are modules. That's how Pascaline implements a module structure. They are not formal blocks because they don't need to be. They don't have locals. As a result they have no framing.
If you eliminate the linkage block, the execution from main falls through to the main routine, and it starts working, no segfault. After that, I figured that it didn't appreciate the linkage blocks being unframed, so I put framing in:
test:
pushq %rbp
movq %rsp,%rbp
# 1: 12: 245: sfr l test.6
# 1: 13: l test.6=0
test.6 = 0
# 1: 14: 12: cup l test.3
# expr:
# 12: cup
# call start:
# 245: sfr
# generating: 12: cup
# generating: 245: sfr
sub $test.6,%rsp
call test.3
popq %rbp
# 1: 16: 22: ret
ret
One of the nice things about having an assembly phase is you can modify the final assembly code and just run the assembly step.
After the linkage block was framed, no more seqfault.
Why did that happen?
So first of all, the failure is rare. Most code works. It happened on a certain combination of calls to glibc functions. glibc is a very complex package. My personal guess is that one of the routines there climbed the frames in the runtime, which is easy to do if you know the framing format in advance. You look at the rbp, find the old rbp pointer at that location, and repeat all the way up the framing stack. If you know the default entry location of the stack, you can even tell when the frames end.
So I fixed this by adding two new instructions to the intermediate:
test:
# 1: 11: 248: lfs
pushq %rbp
movq %rsp,%rbp
# 1: 12: 245: sfr l test.6
# 1: 13: l test.6=0
test.6 = 0
# 1: 14: 12: cup l test.3
# expr:
# 12: cup
# call start:
# 245: sfr
# generating: 12: cup
# generating: 245: sfr
sub $test.6,%rsp
call test.3
# 1: 15: 249: lfe
popq %rbp
# 1: 16: 22: ret
ret
lfs and lfe do nothing in interpretation. What they do is allow pgen to insert a framing sequence into the block. They mean Linker Frame Start and Linker Frame End.
Could I have debugged this all the way down into glibc?
Yes, and I have done that before. The real question is if it is worth the effort. In this case the answer is no. If it reoccurs, that may change.
What are the implications of this?
This is not the only unframed block that Pascal-P6 generates. There are also "code strips" (described in the Pascal-P6 documentation) that initialize locals for things like variable container arrays. They may have to get the same treatment.
There is also the subject of optimization. If a function/procedure has no locals, and does not reference locals of other, enclosing functions or procedures, it is possible to drop framing on that function or procedure. IE, it just gets called, and returns normally. No framing, no rbp.
Thus that may indicate this type of optimization is not possible.
Ok, so the segment fault came up again, failing deep inside glibc. The old rule applies here: if you fixed something and you don't know exactly how you fixed it, then you haven't fixed it. Time to get serious.
The first order of business was to get a source level debug capability going for glibc. Fortunately, I have fought that battle before, with petit-ami, and there is a nice layout and script that handles fetching and building a particular version of glibc. Why a particular version? The glibc you make has to match the one in the system you are using, or it won't work.
What I found is covered well here:
Short answer: You have to keep the stack aligned to 128 bits (16 bytes) before making any call to glibc, or any other routine that turns around and calls glibc. In fact its one particular routine in glibc that does it, sscanf(). It does a 128 bit copy using the xmm register set, and that faults because such operations must be 128 bit aligned. Since trying to figure out if the code you are calling will contain such instructions would be insane, this means that there is effective requirement to keep the stack aligned to 128 bits.
How to fix this in Pascal-P6? It means that we have to keep track of stack depth and, if required, adjust the stack alignment before issuing any call.
So an interesting side effect of the stack align fix. AMD64 bit mode only results in 64 bit data addressing. Program code addressing is still 32 bit, limited to 4GB program sizes (still pretty big, I haven't heard any complaints)[1][2]. This results in an odd effect of the alignment fix. All calls inherently knock the stack out of alignment!
What?
Think about it. A call pushes a 32 bit address onto the stack, which means it is now off alignment by 8 bytes. So lets look at an empty function in C:
void junk(void)
{
}
pushq %rbp
movq %rsp, %rbp
nop
popq %rbp
ret
I have removed the assembler directives. The push and new setting of rbp is a standard frame in C without locals allocation. This means:
Call instruction: -8 bytes Framing: -8 bytes
For a total of 8 bytes, and thus 128 bit (16 bytes) alignment is kept.
Of course, this is Pascal, not C, so we don't use the C type framing. However, this basic symmetry must be kept. The call will give us an entry address that is misaligned by 8 bytes, and then we fix it by giving it a framing sequence that is an even number of 16 bytes +/- 8. Thus the framing sequence "fixes" the alignment[3].
How much fun is that?
[1] Yes, when I tell people that AMD64 mode is 32 bit program addresses some programmers point out that calculated jumps don't have this restriction, like jmp *%rax. If you actually attempt to construct a program that is > 4gb you will end up with code that makes the old segmented code model look good.
[2] True story: When the Hammer CPU (the original name for AMD's 64 bit CPU) came out, I attended classes on it, and got a set of manuals beforehand. After the class I went up to the presenter and said something like "you know this is a 32 bit program CPU, don't you". He gave me a look. I explained it, and he said "I have to talk to the design team". Then later he called me and admitted that it was true.
[3] Actually its worse than that in Pascal. Since the display system puts a variable number of display pointers on the stack, you have to decide if the total stack count is or isn't divisible by 16.
So glibc includes this time bomb of an unaligned access exception. How does the startup of a gcc compiled program go? We would assume that "main" is called with a 16 byte aligned stack?
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from test...
(gdb) b main
Breakpoint 1 at 0x721a: file test.s, line 145.
(gdb) r
Starting program: /home/samiam/projects/pascal/pascal-p6/test
Breakpoint 1, main () at test.s:145
(gdb) i r
rax 0x55555555b21a 93824992260634
rbx 0x55555555b290 93824992260752
rcx 0x555555592860 93824992487520
rdx 0x7fffffffdf48 140737488346952
rsi 0x7fffffffdf38 140737488346936
rdi 0x1 1
rbp 0x0 0x0
rsp 0x7fffffffde48 0x7fffffffde48 <<== Lookeee!
r8 0x0 0
r9 0x7ffff7fe0d60 140737354009952
r10 0x7ffff7ffcf68 140737354125160
r11 0x206 518
r12 0x5555555551f0 93824992236016
r13 0x7fffffffdf30 140737488346928
r14 0x0 0
r15 0x0 0
rip 0x55555555b21a 0x55555555b21a <main>
eflags 0x246 [ PF ZF IF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
And there you are. We are entered at main with a stack pointer that is NOT aligned to
16 bytes!
Nice.
*******************************************************************************
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
*******************************************************************************
The following are implementation defined characteristics
Maxint: 9223372036854775807
Bit length of integer without sign bit appears to be: 63
Integer default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1
Real default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
1.20000000000000e+00
Note that the exponent character 'e' or 'E' is implementation
defined as well as the number of exponent digits
Boolean default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
false
true
Note that the upper or lower case state of the characters in
'true' and 'false' are implementation defined
Char default output field
1111111111222222222233333333334
1234567890123456789012345678901234567890
a
Appears to be ASCII
******************* Control structures tests *******************
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1
Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Control6: yes s/b yes
Control7: yes s/b yes
Control8: yes stop s/b yes stop
Control9: stop s/b stop
Control10: one two three four five six seven eight nine-ten nine-ten
Control10: s/b one two three four five six seven eight nine-ten nine-ten
Control11: start stop s/b start stop
Control12: start stop s/b start stop
Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10
Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1
Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9
Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0
Control17: start good s/b start good
Control18: start stop s/b start stop
******************* Integers *******************
Integer1: 121 s/b 121
Integer2: 35 s/b 35
Integer3: 3354 s/b 3354
Integer4: 1 s/b 1
Integer5: 35 s/b 35
Integer6: 44 s/b 44
Integer7: 42 s/b 42
Integer8: 1849 s/b 1849
Integer9: N s/b N
Integer10: 43 s/b 43
Integer11: true s/b true
Integer12: false s/b false
Integer13: true s/b true
Integer14: false s/b false
Integer15: true s/b true
Integer16: false s/b false
Integer17: true s/b true
Integer18: false s/b false
Integer19: true s/b true
Integer20: false s/b false
Integer21: true s/b true
Integer22: true s/b true
Integer23: false s/b false
Integer24: true s/b true
Integer25: true s/b true
Integer26: false s/b false
Integer27: 546 s/b 546
Integer28: 90 s/b 90
Integer29: 22 s/b 22
Integer30: 1904 s/b 1904
Integer31: 1 s/b 1
Integer32: 22 s/b 22
Integer33: 6 s/b 6
Integer34: 4 s/b 4
Integer35: 49 s/b 49
Integer36: A s/b A
Integer37: 65 s/b 65
Integer38: 768 s/b 768
Integer39: true s/b true
Integer40: false s/b false
Integer41: true s/b true
Integer42: false s/b false
Integer43: true s/b true
Integer44: false s/b false
Integer45: true s/b true
Integer46: false s/b false
Integer47: true s/b true
Integer48: false s/b false
Integer49: true s/b true
Integer50: true s/b true
Integer51: false s/b false
Integer52: true s/b true
Integer53: true s/b true
Integer54: false s/b false
Integer55: 6 s/b 6
Integer56: 6 s/b 6
Integer57: -12 s/b -12
Integer58: -46 s/b -46
Integer59: 34 s/b 34
Integer60: -52 s/b -52
Integer61: -18 s/b -18
Integer62: -280 s/b -280
Integer63: -280 s/b -280
Integer64: 448 s/b 448
Integer65: -1 s/b -1
Integer66: -1 s/b -1
Integer67: 2 s/b 2
Integer68: -13 s/b -13
Integer69: -33 s/b -33
Integer70: 196 s/b 196
Integer71: false s/b false
Integer72: true s/b true
Integer73: true s/b true
Integer74: false s/b false
Integer75: true s/b true
Integer76: false s/b false
Integer77: true s/b true
Integer78: true s/b true
Integer79: false s/b false
Integer80: false s/b false
Integer81: true s/b true
Integer82: true s/b true
Integer83: false s/b false
Integer84: false s/b false
Integer85: true s/b true
Integer86: true s/b true
Integer87: true s/b true
Integer88: false s/b false
Integer89: false s/b false
Integer90: true s/b true
Integer91: true s/b true
Integer92: true s/b true
Integer93: false s/b false
Integer94: false s/b false
Integer95: 14 s/b 14
Integer96: 0 s/b 0
Integer97: 0 s/b 0
Integer98: 0 s/b 0
Integer99: 15 s/b 15
Integer100: 45 s/b 45
Integer101: -39 s/b -39
Integer102: -35 s/b -35
Integer103: 34 s/b 34
Integer104: -48 s/b -48
Integer105: -44 s/b -44
Integer106: -20 s/b -20
Integer107: -126 s/b -126
Integer108: 520 s/b 520
Integer109: -6 s/b -6
Integer110: -25 s/b -25
Integer111: 5 s/b 5
Integer112: -9 s/b -9
Integer113: 0 s/b 0
Integer114: -2 s/b -2
Integer115: 64 s/b 64
Integer116: -55 s/b -55
Integer117: false s/b false
Integer118: true s/b true
Integer119: true s/b true
Integer120: false s/b false
Integer121: true s/b true
Integer122: false s/b false
Integer123: true s/b true
Integer124: true s/b true
Integer125: false s/b false
Integer126: false s/b false
Integer127: true s/b true
Integer128: true s/b true
Integer129: false s/b false
Integer130: false s/b false
Integer131: true s/b true
Integer132: true s/b true
Integer133: true s/b true
Integer134: false s/b false
Integer135: false s/b false
Integer136: true s/b true
Integer137: true s/b true
Integer138: true s/b true
Integer139: false s/b false
Integer140: false s/b false
Integer141: 6 s/b 6
Integer142: -52 s/b -52
Integer143: 52 s/b 52
Integer144: -768 s/b -768
Integer145: 52 s/b 52
Integer146: 0 s/b 0
Integer147: 42 s/b 42
Integer148: 1 2 3 4 5 6 7 8 9 10 11 12 13 s/b 1 2 3 4 5 6 7 8 9 10 11 12 13
******************* Subranges *******************
Subrange1: 121 s/b 121
Subrange2: 35 s/b 35
Subrange3: 3354 s/b 3354
Subrange4: 1 s/b 1
Subrange5: 35 s/b 35
Subrange6: 44 s/b 44
Subrange7: 42 s/b 42
Subrange8: N s/b N
Subrange9: 43 s/b 43
Subrange10: true s/b true
Subrange11: false s/b false
Subrange12: true s/b true
Subrange13: false s/b false
Subrange14: true s/b true
Subrange15: false s/b false
Subrange16: true s/b true
Subrange17: false s/b false
Subrange18: true s/b true
Subrange19: false s/b false
Subrange20: true s/b true
Subrange21: true s/b true
Subrange22: false s/b false
Subrange23: true s/b true
Subrange24: true s/b true
Subrange25: false s/b false
Subrange26: 6 s/b 6
Subrange27: 6 s/b 6
Subrange28: -12 s/b -12
Subrange29: -46 s/b -46
Subrange30: 34 s/b 34
Subrange31: -52 s/b -52
Subrange32: -18 s/b -18
Subrange33: -280 s/b -280
Subrange34: -280 s/b -280
Subrange35: 448 s/b 448
Subrange36: -1 s/b -1
Subrange37: -1 s/b -1
Subrange38: 2 s/b 2
Subrange39: -13 s/b -13
Subrange40: -33 s/b -33
Subrange41: false s/b false
Subrange42: true s/b true
Subrange43: true s/b true
Subrange44: false s/b false
Subrange45: true s/b true
Subrange46: false s/b false
Subrange47: true s/b true
Subrange48: true s/b true
Subrange49: false s/b false
Subrange50: false s/b false
Subrange51: true s/b true
Subrange52: true s/b true
Subrange53: false s/b false
Subrange54: false s/b false
Subrange55: true s/b true
Subrange56: true s/b true
Subrange57: true s/b true
Subrange58: false s/b false
Subrange59: false s/b false
Subrange60: true s/b true
Subrange61: true s/b true
Subrange62: true s/b true
Subrange63: false s/b false
Subrange64: false s/b false
Subrange65: 14 s/b 14
******************* Characters*******************
Character1: g g u s/b g g u
Character2: h s/b h
Character3: f s/b f
Character4: 103 s/b 103
Character5: u s/b u
Character6: true s/b true
Character7: false s/b false
Character8: true s/b true
Character9: false s/b false
Character10: true s/b true
Character11: false s/b false
Character12: true s/b true
Character13: false s/b false
Character14: true s/b true
Character15: true s/b true
Character16: false s/b false
Character17: true s/b true
Character18: true s/b true
Character19: false s/b false
Character20: porker porker parker s/b porker porker parker
Character21: true s/b true
Character22: false s/b false
Character23: true s/b true
Character24: false s/b false
Character25: true s/b true
Character26: false s/b false
Character27: true s/b true
Character28: false s/b false
Character29: true s/b true
Character30: true s/b true
Character40: false s/b false
Character41: true s/b true
Character42: true s/b true
Character43: false s/b false
Character44: abcdefghijklmnopqrstuvwxyz s/b abcdefghijklmnopqrstuvwxyz
Character45: zyxwvutsrqponmlkjihgfedcba s/b zyxwvutsrqponmlkjihgfedcba
Character46: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Character46: s/b 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character47: n s/b n
Character48: junky01234 s/b junky01234
Character49:
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character49: s/b
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character50:
zero one two three four five six seven eight nine
s/b zero one two three four five six seven eight nine
Character51: a s/b a
Character52: b s/b b
Character53: y s/b y
Character54: 99 s/b 99
Character55: g s/b g
Character56: true s/b true
Character57: false s/b false
Character58: true s/b true
Character59: false s/b false
Character60: true s/b true
Character61: false s/b false
Character62: true s/b true
Character63: false s/b false
Character64: true s/b true
Character65: true s/b true
Character66: false s/b false
Character67: true s/b true
Character68: true s/b true
Character69: false s/b false
Character70: true s/b true
Character71: false s/b false
Character72: true s/b true
Character73: false s/b false
Character74: true s/b true
Character75: false s/b false
Character76: true s/b true
Character77: false s/b false
Character78: true s/b true
Character79: true s/b true
Character80: false s/b false
Character81: true s/b true
Character82: true s/b true
Character83: false s/b false
Character84: this is a string s/b this is a string
Character85: v s/b v
Character86:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character87: s/b:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character88:
true true true true true true true true true
s/b
true true true true true true true true true
Character89:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Character90:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
******************* Booleans *******************
Boolean1: true false s/b true false
Boolean2: true s/b true
Boolean3: false s/b false
Boolean4: 0 s/b 0
Boolean5: 1 s/b 1
Boolean6: true s/b true
Boolean7: true s/b true
Boolean8: false s/b false
Boolean9: true s/b true
Boolean10: false s/b false
Boolean11: true s/b true
Boolean12: false s/b false
Boolean13: true s/b true
Boolean14: false s/b false
Boolean15: true s/b true
Boolean16: true s/b true
Boolean17: false s/b false
Boolean18: true s/b true
Boolean19: true s/b true
Boolean20: false s/b false
Boolean21: false true s/b false true
Boolean22: true false s/b true false
Boolean23: true s/b true
Boolean24: false s/b false
Boolean25: true false s/b true false
Boolean26: true s/b true
Boolean27: false s/b false
Boolean28: 0 s/b 0
Boolean29: 1 s/b 1
Boolean30: true s/b true
Boolean31: true s/b true
Boolean32: false s/b false
Boolean33: true s/b true
Boolean34: false s/b false
Boolean35: true s/b true
Boolean36: false s/b false
Boolean37: true s/b true
Boolean38: false s/b false
Boolean39: true s/b true
Boolean40: true s/b true
Boolean41: false s/b false
Boolean42: true s/b true
Boolean43: true s/b true
Boolean44: false s/b false
Boolean45:
false
false
false
false
false
false
fals
fal
fa
f
Boolean45: s/b:
false
false
false
false
false
false
fals
fal
fa
f
Boolean46:
true
true
true
true
true
true
true
tru
tr
t
Boolean46: s/b:
true
true
true
true
true
true
true
tru
tr
t
******************* Scalar *******************
Scalar1: true s/b true
Scalar2: true s/b true
Scalar3: 0 s/b 0
Scalar4: 2 s/b 2
Scalar5: true s/b true
Scalar6: true s/b true
Scalar7: false s/b false
Scalar8: true s/b true
Scalar9: false s/b false
Scalar10: true s/b true
Scalar11: false s/b false
Scalar12: true s/b true
Scalar13: false s/b false
Scalar14: true s/b true
Scalar15: true s/b true
Scalar16: false s/b false
Scalar17: true s/b true
Scalar18: true s/b true
Scalar19: false s/b false
Scalar20: 0 1 2 3 4 5 6 s/b 0 1 2 3 4 5 6
Scalar21: 6 5 4 3 2 1 0 s/b 6 5 4 3 2 1 0
Scalar20: true s/b true
Scalar21: true s/b true
Scalar22: 2 s/b 2
Scalar23: 6 s/b 6
Scalar24: true s/b true
Scalar25: true s/b true
Scalar26: false s/b false
Scalar27: true s/b true
Scalar28: false s/b false
Scalar29: true s/b true
Scalar30: false s/b false
Scalar31: true s/b true
Scalar32: false s/b false
Scalar33: true s/b true
Scalar34: true s/b true
Scalar35: false s/b false
Scalar36: true s/b true
Scalar37: true s/b true
Scalar38: false s/b false
******************* Reals ******************************
Real1: 1.5540000e+00 s/b 1.554000e+00
Real2: 3.3400000e-03 s/b 3.340000e-03
Real3: 3.3400000e-24 s/b 3.340000e-24
Real4: 4.0000000e-45 s/b 4.000000e-45
Real5: -5.5650000e+00 s/b -5.565000e+00
Real6: -9.4400000e-03 s/b -9.440000e-03
Real7: -6.3640000e+29 s/b -6.364000e+29
Real8: -2.0000000e-14 s/b -2.000000e-14
Real9:
11111111112222222222333333333344444444445
12345678901234567890123456789012345678901234567890
1.2e+00
1.2e+00
1.2e+00
1.2e+00
1.2e+00
1.2e+00
1.2e+00
1.2e+00
1.2e+00
1.23e+00
1.235e+00
1.2346e+00
1.23457e+00
1.234568e+00
1.2345679e+00
1.23456789e+00
1.234567890e+00
1.2345678901e+00
1.23456789012e+00
1.234567890123e+00
s/b (note precision dropoff at right):
1.2e+000
1.2e+000
1.2e+000
1.2e+000
1.2e+000
1.2e+000
1.2e+000
1.2e+000
1.2e+000
1.23e+000
1.234e+000
1.2345e+000
1.23456e+000
1.234567e+000
1.2345678e+000
1.23456789e+000
1.234567890e+000
1.2345678901e+000
1.23456789012e+000
1.234567890123e+000
Real10:
11111111112222222222333333333344444444445
12345678901234567890123456789012345678901234567890
1.2
2.23
3.235
4.2346
5.23457
6.234568
7.2345679
8.23456789
9.234567890
10.2345678901
11.23456789012
12.234567890123
13.2345678901235
14.23456789012346
15.234567890123456
16.2345678901234578
17.23456789012345780
18.234567890123457801
19.2345678901234578007
20.23456789012345780066
s/b (note precision dropoff at right):
1.2
2.23
3.234
4.2345
5.23456
6.234567
7.2345678
8.23456789
9.234567890
10.2345678901
11.23456789012
12.234567890123
13.2345678901234
14.23456789012345
15.234567890123456
16.2345678901234567
17.23456789012345678
18.234567890123456789
19.2345678901234567890
20.23456789012345678901
Real11: 1.4189000e+03 s/b 1.418900e+03
Rea112: 5.4844000e+02 s/b 5.484399e+02
Real13: 4.2812269e+05 s/b 4.281227e+05
Real14: 2.2601153e+00 s/b 2.260115e+00
Real15: true s/b true
Real16: false s/b false
Real17: true s/b true
Real18: false s/b false
Real19: true s/b true
Real20: false s/b false
Real21: true s/b true
Real22: false s/b false
Real23: true s/b true
Real24: true s/b true
Real25: false s/b false
Real26: true s/b true
Real27: true s/b true
Real28: false s/b false
Real29: 1.8676113e+02 s/b 4.35230e+02
Real30: 8.7046000e+02 s/b 1.89425e+05
Real31: 3.1363514e+01 s/b 3.13635e+01
Real32: -3.4430594e-01 s/b -3.44290e-01
Real33: 1.5684987e+00 s/b 1.56850e+00
Real34: 1.4110019e+00 s/b 1.41100e+00
Real35: 6.0758746e+00 s/b 6.07587e+00
Real36: 435 s/b 435
Real37: 984 s/b 984
Real38: 435 s/b 435
Real39: 1.2780520e+03 s/b 1.278052e+03
Real40: 2.3894600e+02 s/b 2.389460e+02
Real41: 1.0472018e+05 s/b 1.047202e+05
Real42: 7.2595975e-03 s/b 7.259598e-03
Real43: true s/b true
Real44: false s/b false
Real45: true s/b true
Real46: false s/b false
Real47: true s/b true
Real48: true s/b false
Real49: true s/b true
Real50: false s/b false
Real51: true s/b true
Real52: true s/b true
Real53: false s/b false
Real54: true s/b true
Real55: true s/b true
Real56: false s/b false
Real57: 1.1645307e+02 s/b 3.493000e+01
Real58: 4.6800000e+00 s/b 5.475600e+00
Real59: 9.7233328e+01 s/b 9.723333e+01
Real60: 3.3114727e-01 s/b 3.311461e-01
Real61: 1.5678826e+00 s/b 1.567883e+00
Real62: 1.3937528e+00 s/b 1.393753e+00
Real63: 4.4214877e+00 s/b 4.421488e+00
Real64: 24 s/b 24
Real65: 75 s/b 75
Real66: 83 s/b 83
Real67: 4.3330000e+01 s/b 4.333000e+01
Real68: 3.0034000e+02 s/b 3.003400e+02
Real69: 3.0034000e+02 s/b 3.003400e+02
Real70: -6.5999800e+03 s/b -6.599980e+03
Real71: -8.3687200e+03 s/b -8.368720e+03
Real72: 1.7687400e+03 s/b 1.768740e+03
Real73: -8.6690600e+03 s/b -8.669061e+03
Real74: -6.9003200e+03 s/b -6.900320e+03
Real75: -7.5955927e+05 s/b -7.595593e+05
Real76: -7.5955927e+05 s/b -7.595593e+05
Real77: 5.6052646e+06 s/b 5.605265e+06
Real78: -1.4090711e+00 s/b -1.409071e+00
Real79: -7.3796277e+00 s/b -7.379627e+00
Real80: 1.0398420e+01 s/b 1.039842e+01
Real81: true s/b true
Real82: false s/b false
Real83: true s/b true
Real84: false s/b false
Real85: true s/b true
Real86: true s/b true
Real87: false s/b false
Real88: false s/b false
Real89: false s/b true
Real90: false s/b true
Real91: false s/b false
Real92: false s/b false
Real93: true s/b true
Real94: true s/b true
Real95: true s/b true
Real96: false s/b false
Real97: false s/b false
Real98: false s/b true
Real99: false s/b true
Real100: false s/b true
Real101: false s/b false
Real102: false s/b false
Real103: -1.7026062e+03 s/b 7.34200e+02
Real104: -1.4684000e+03 s/b 5.39050e+05
Real105: -4.3483206e-01 s/b -4.34850e-01
Real106: -1.5694343e+00 s/b -1.56943e+00
Real107: 6.8056632e-01 s/b 6.80566e-01
Real108: -734 s/b -734
Real109: -7635 s/b -7635
Real110: -734 s/b -734
Real111: 1.5100000e+01 s/b 1.510000e+01
Real112: 4.5133000e+01 s/b 4.513300e+01
Real113: -3.8640000e+01 s/b -3.864000e+01
Real114: -3.6581000e+01 s/b -3.658100e+01
Real115: 3.5548000e+01 s/b 3.554800e+01
Real116: -4.9398400e+01 s/b -4.939840e+01
Real117: -4.4001000e+01 s/b -4.400100e+01
Real118: -2.6412232e+01 s/b -2.641223e+01
Real119: -1.4890414e+02 s/b -1.489041e+02
Real120: 5.5856325e+02 s/b 5.585632e+02
Real121: -5.2201566e+00 s/b -5.220157e+00
Real122: -1.7721625e+01 s/b -1.772163e+01
Real123: 4.2745824e+00 s/b 4.274582e+00
Real124: true s/b true
Real125: false s/b false
Real126: true s/b true
Real127: false s/b false
Real128: true s/b true
Real129: true s/b true
Real130: false s/b false
Real131: false s/b false
Real132: true s/b true
Real133: false s/b true
Real134: false s/b false
Real135: false s/b false
Real136: true s/b true
Real137: true s/b true
Real138: true s/b true
Real139: false s/b false
Real140: false s/b false
Real141: false s/b true
Real142: true s/b true
Real143: true s/b true
Real144: false s/b false
Real145: true s/b false
Real146: -2.8912156e+00 s/b 6.823000e+00
Real147 -6.9644000e+02 s/b 1.212572e+05
Real148: 9.4212450e-01 s/b 9.421146e-01
Real149: -1.5706771e+00 s/b -1.570677e+00
Real150: 4.1715393e-01 s/b 4.171539e-01
Real151: -33 s/b -33
Real152: -843 s/b -843
Real153: -6244 s/b -6244
Real154: -8.4220000e+01 s/b -8.422000e+01
Real155: 8.4220000e+01 s/b 8.422000e+01
Real156: -4.3330000e+01 s/b -4.333000e+01
Real157: 8.4220000e+01 s/b 8.422000e+01
******************* sets ******************************
Oh, well, the first pass algorithm in pgen isn't going to work. The idea is that sets, which are 32 bytes, get loaded onto the stack with pointers to them placed in the registers. Then went they are removed, they are dumped from the stack. The problem is that push/pops to guard registers could happen anywhere in the expression tree, so that no workee. The stack allocation for the set needs to travel within the expression tree until it is consumed and dumped.
What we need is a system of temps allocated on stack before any code is executed. An array contains a series of temps indicating if they are occupied, and what the address on stack is, kinda like heap allocation. At the end of the routine you know what the "high water mark" is, the maximum number of temps consumed, then you know how much to allocate at the start of the routine.
Wait what? How do you know how much temp space you need at the start of the routine? Fortunately, this is already a feature of the Pascal-P system. The mst instruction accepts the space allocated by locals as a parameter, in label form. That is because pcom does not know how big the locals are at the start either. So the locals size is inserted in the assembly source as a forward referencing label. Thus we can grab that label, add the required temps space, and then define it after the routine is done. The assembler does the work of backpatching it for us.
Wait, how can you allocate space arbitrarily on the stack? Well, the return instructions don't actually use the stack directly to access the return address and unwind the frame. They use the rbp register and get the old stack pointer, and return address from that.
By the way, its more efficient as well. Allocating from areas on the stack means that no additions or subtractions on rsp are required. Its just a fixed address for the temp slot.
Thus life gets interesting again.
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
The following are implementation defined characteristics
Maxint: 9223372036854775807 Bit length of integer without sign bit appears to be: 63 Integer default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1 Real default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1.20000000000000e+00 Note that the exponent character 'e' or 'E' is implementation defined as well as the number of exponent digits Boolean default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 false true Note that the upper or lower case state of the characters in 'true' and 'false' are implementation defined Char default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 a Appears to be ASCII
Control structures tests
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1 Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control6: yes s/b yes Control7: yes s/b yes Control8: yes stop s/b yes stop Control9: stop s/b stop Control10: one two three four five six seven eight nine-ten nine-ten Control10: s/b one two three four five six seven eight nine-ten nine-ten Control11: start stop s/b start stop Control12: start stop s/b start stop Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10 Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1 Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9 Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0 Control17: start good s/b start good Control18: start stop s/b start stop
Integers
Integer1: 121 s/b 121 Integer2: 35 s/b 35 Integer3: 3354 s/b 3354 Integer4: 1 s/b 1 Integer5: 35 s/b 35 Integer6: 44 s/b 44 Integer7: 42 s/b 42 Integer8: 1849 s/b 1849 Integer9: N s/b N Integer10: 43 s/b 43 Integer11: true s/b true Integer12: false s/b false Integer13: true s/b true Integer14: false s/b false Integer15: true s/b true Integer16: false s/b false Integer17: true s/b true Integer18: false s/b false Integer19: true s/b true Integer20: false s/b false Integer21: true s/b true Integer22: true s/b true Integer23: false s/b false Integer24: true s/b true Integer25: true s/b true Integer26: false s/b false Integer27: 546 s/b 546 Integer28: 90 s/b 90 Integer29: 22 s/b 22 Integer30: 1904 s/b 1904 Integer31: 1 s/b 1 Integer32: 22 s/b 22 Integer33: 6 s/b 6 Integer34: 4 s/b 4 Integer35: 49 s/b 49 Integer36: A s/b A Integer37: 65 s/b 65 Integer38: 768 s/b 768 Integer39: true s/b true Integer40: false s/b false Integer41: true s/b true Integer42: false s/b false Integer43: true s/b true Integer44: false s/b false Integer45: true s/b true Integer46: false s/b false Integer47: true s/b true Integer48: false s/b false Integer49: true s/b true Integer50: true s/b true Integer51: false s/b false Integer52: true s/b true Integer53: true s/b true Integer54: false s/b false Integer55: 6 s/b 6 Integer56: 6 s/b 6 Integer57: -12 s/b -12 Integer58: -46 s/b -46 Integer59: 34 s/b 34 Integer60: -52 s/b -52 Integer61: -18 s/b -18 Integer62: -280 s/b -280 Integer63: -280 s/b -280 Integer64: 448 s/b 448 Integer65: -1 s/b -1 Integer66: -1 s/b -1 Integer67: 2 s/b 2 Integer68: -13 s/b -13 Integer69: -33 s/b -33 Integer70: 196 s/b 196 Integer71: false s/b false Integer72: true s/b true Integer73: true s/b true Integer74: false s/b false Integer75: true s/b true Integer76: false s/b false Integer77: true s/b true Integer78: true s/b true Integer79: false s/b false Integer80: false s/b false Integer81: true s/b true Integer82: true s/b true Integer83: false s/b false Integer84: false s/b false Integer85: true s/b true Integer86: true s/b true Integer87: true s/b true Integer88: false s/b false Integer89: false s/b false Integer90: true s/b true Integer91: true s/b true Integer92: true s/b true Integer93: false s/b false Integer94: false s/b false Integer95: 14 s/b 14 Integer96: 0 s/b 0 Integer97: 0 s/b 0 Integer98: 0 s/b 0 Integer99: 15 s/b 15 Integer100: 45 s/b 45 Integer101: -39 s/b -39 Integer102: -35 s/b -35 Integer103: 34 s/b 34 Integer104: -48 s/b -48 Integer105: -44 s/b -44 Integer106: -20 s/b -20 Integer107: -126 s/b -126 Integer108: 520 s/b 520 Integer109: -6 s/b -6 Integer110: -25 s/b -25 Integer111: 5 s/b 5 Integer112: -9 s/b -9 Integer113: 0 s/b 0 Integer114: -2 s/b -2 Integer115: 64 s/b 64 Integer116: -55 s/b -55 Integer117: false s/b false Integer118: true s/b true Integer119: true s/b true Integer120: false s/b false Integer121: true s/b true Integer122: false s/b false Integer123: true s/b true Integer124: true s/b true Integer125: false s/b false Integer126: false s/b false Integer127: true s/b true Integer128: true s/b true Integer129: false s/b false Integer130: false s/b false Integer131: true s/b true Integer132: true s/b true Integer133: true s/b true Integer134: false s/b false Integer135: false s/b false Integer136: true s/b true Integer137: true s/b true Integer138: true s/b true Integer139: false s/b false Integer140: false s/b false Integer141: 6 s/b 6 Integer142: -52 s/b -52 Integer143: 52 s/b 52 Integer144: -768 s/b -768 Integer145: 52 s/b 52 Integer146: 0 s/b 0 Integer147: 42 s/b 42 Integer148: 1 2 3 4 5 6 7 8 9 10 11 12 13 s/b 1 2 3 4 5 6 7 8 9 10 11 12 13
Subranges
Subrange1: 121 s/b 121 Subrange2: 35 s/b 35 Subrange3: 3354 s/b 3354 Subrange4: 1 s/b 1 Subrange5: 35 s/b 35 Subrange6: 44 s/b 44 Subrange7: 42 s/b 42 Subrange8: N s/b N Subrange9: 43 s/b 43 Subrange10: true s/b true Subrange11: false s/b false Subrange12: true s/b true Subrange13: false s/b false Subrange14: true s/b true Subrange15: false s/b false Subrange16: true s/b true Subrange17: false s/b false Subrange18: true s/b true Subrange19: false s/b false Subrange20: true s/b true Subrange21: true s/b true Subrange22: false s/b false Subrange23: true s/b true Subrange24: true s/b true Subrange25: false s/b false Subrange26: 6 s/b 6 Subrange27: 6 s/b 6 Subrange28: -12 s/b -12 Subrange29: -46 s/b -46 Subrange30: 34 s/b 34 Subrange31: -52 s/b -52 Subrange32: -18 s/b -18 Subrange33: -280 s/b -280 Subrange34: -280 s/b -280 Subrange35: 448 s/b 448 Subrange36: -1 s/b -1 Subrange37: -1 s/b -1 Subrange38: 2 s/b 2 Subrange39: -13 s/b -13 Subrange40: -33 s/b -33 Subrange41: false s/b false Subrange42: true s/b true Subrange43: true s/b true Subrange44: false s/b false Subrange45: true s/b true Subrange46: false s/b false Subrange47: true s/b true Subrange48: true s/b true Subrange49: false s/b false Subrange50: false s/b false Subrange51: true s/b true Subrange52: true s/b true Subrange53: false s/b false Subrange54: false s/b false Subrange55: true s/b true Subrange56: true s/b true Subrange57: true s/b true Subrange58: false s/b false Subrange59: false s/b false Subrange60: true s/b true Subrange61: true s/b true Subrange62: true s/b true Subrange63: false s/b false Subrange64: false s/b false Subrange65: 14 s/b 14
Characters
Character1: g g u s/b g g u
Character2: h s/b h
Character3: f s/b f
Character4: 103 s/b 103
Character5: u s/b u
Character6: true s/b true
Character7: false s/b false
Character8: true s/b true
Character9: false s/b false
Character10: true s/b true
Character11: false s/b false
Character12: true s/b true
Character13: false s/b false
Character14: true s/b true
Character15: true s/b true
Character16: false s/b false
Character17: true s/b true
Character18: true s/b true
Character19: false s/b false
Character20: porker porker parker s/b porker porker parker
Character21: true s/b true
Character22: false s/b false
Character23: true s/b true
Character24: false s/b false
Character25: true s/b true
Character26: false s/b false
Character27: true s/b true
Character28: false s/b false
Character29: true s/b true
Character30: true s/b true
Character40: false s/b false
Character41: true s/b true
Character42: true s/b true
Character43: false s/b false
Character44: abcdefghijklmnopqrstuvwxyz s/b abcdefghijklmnopqrstuvwxyz
Character45: zyxwvutsrqponmlkjihgfedcba s/b zyxwvutsrqponmlkjihgfedcba
Character46: 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character46: s/b 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character47: n s/b n
Character48: junky01234 s/b junky01234
Character49:
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character49: s/b
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character50:
zero one two three four five six seven eight nine
s/b zero one two three four five six seven eight nine
Character51: a s/b a
Character52: b s/b b
Character53: y s/b y
Character54: 99 s/b 99
Character55: g s/b g
Character56: true s/b true
Character57: false s/b false
Character58: true s/b true
Character59: false s/b false
Character60: true s/b true
Character61: false s/b false
Character62: true s/b true
Character63: false s/b false
Character64: true s/b true
Character65: true s/b true
Character66: false s/b false
Character67: true s/b true
Character68: true s/b true
Character69: false s/b false
Character70: true s/b true
Character71: false s/b false
Character72: true s/b true
Character73: false s/b false
Character74: true s/b true
Character75: false s/b false
Character76: true s/b true
Character77: false s/b false
Character78: true s/b true
Character79: true s/b true
Character80: false s/b false
Character81: true s/b true
Character82: true s/b true
Character83: false s/b false
Character84: this is a string s/b this is a string
Character85: v s/b v
Character86:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character87: s/b:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character88:
true true true true true true true true true
s/b
true true true true true true true true true
Character89:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Character90:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Booleans
Boolean1: true false s/b true false Boolean2: true s/b true Boolean3: false s/b false Boolean4: 0 s/b 0 Boolean5: 1 s/b 1 Boolean6: true s/b true Boolean7: true s/b true Boolean8: false s/b false Boolean9: true s/b true Boolean10: false s/b false Boolean11: true s/b true Boolean12: false s/b false Boolean13: true s/b true Boolean14: false s/b false Boolean15: true s/b true Boolean16: true s/b true Boolean17: false s/b false Boolean18: true s/b true Boolean19: true s/b true Boolean20: false s/b false Boolean21: false true s/b false true Boolean22: true false s/b true false Boolean23: true s/b true Boolean24: false s/b false Boolean25: true false s/b true false Boolean26: true s/b true Boolean27: false s/b false Boolean28: 0 s/b 0 Boolean29: 1 s/b 1 Boolean30: true s/b true Boolean31: true s/b true Boolean32: false s/b false Boolean33: true s/b true Boolean34: false s/b false Boolean35: true s/b true Boolean36: false s/b false Boolean37: true s/b true Boolean38: false s/b false Boolean39: true s/b true Boolean40: true s/b true Boolean41: false s/b false Boolean42: true s/b true Boolean43: true s/b true Boolean44: false s/b false Boolean45: false false false false false false fals fal fa f Boolean45: s/b: false false false false false false fals fal fa f Boolean46: true true true true true true true tru tr t Boolean46: s/b: true true true true true true true tru tr t
Scalar
Scalar1: true s/b true Scalar2: true s/b true Scalar3: 0 s/b 0 Scalar4: 2 s/b 2 Scalar5: true s/b true Scalar6: true s/b true Scalar7: false s/b false Scalar8: true s/b true Scalar9: false s/b false Scalar10: true s/b true Scalar11: false s/b false Scalar12: true s/b true Scalar13: false s/b false Scalar14: true s/b true Scalar15: true s/b true Scalar16: false s/b false Scalar17: true s/b true Scalar18: true s/b true Scalar19: false s/b false Scalar20: 0 1 2 3 4 5 6 s/b 0 1 2 3 4 5 6 Scalar21: 6 5 4 3 2 1 0 s/b 6 5 4 3 2 1 0 Scalar20: true s/b true Scalar21: true s/b true Scalar22: 2 s/b 2 Scalar23: 6 s/b 6 Scalar24: true s/b true Scalar25: true s/b true Scalar26: false s/b false Scalar27: true s/b true Scalar28: false s/b false Scalar29: true s/b true Scalar30: false s/b false Scalar31: true s/b true Scalar32: false s/b false Scalar33: true s/b true Scalar34: true s/b true Scalar35: false s/b false Scalar36: true s/b true Scalar37: true s/b true Scalar38: false s/b false
*** Reals **
Real1: 1.5540000e+00 s/b 1.554000e+00 Real2: 3.3400000e-03 s/b 3.340000e-03 Real3: 3.3400000e-24 s/b 3.340000e-24 Real4: 4.0000000e-45 s/b 4.000000e-45 Real5: -5.5650000e+00 s/b -5.565000e+00 Real6: -9.4400000e-03 s/b -9.440000e-03 Real7: -6.3640000e+29 s/b -6.364000e+29 Real8: -2.0000000e-14 s/b -2.000000e-14 Real9: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.23e+00 1.235e+00 1.2346e+00 1.23457e+00 1.234568e+00 1.2345679e+00 1.23456789e+00 1.234567890e+00 1.2345678901e+00 1.23456789012e+00 1.234567890123e+00 s/b (note precision dropoff at right): 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.23e+000 1.234e+000 1.2345e+000 1.23456e+000 1.234567e+000 1.2345678e+000 1.23456789e+000 1.234567890e+000 1.2345678901e+000 1.23456789012e+000 1.234567890123e+000 Real10: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2 2.23 3.235 4.2346 5.23457 6.234568 7.2345679 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901235 14.23456789012346 15.234567890123456 16.2345678901234578 17.23456789012345780 18.234567890123457801 19.2345678901234578007 20.23456789012345780066 s/b (note precision dropoff at right): 1.2 2.23 3.234 4.2345 5.23456 6.234567 7.2345678 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901234 14.23456789012345 15.234567890123456 16.2345678901234567 17.23456789012345678 18.234567890123456789 19.2345678901234567890 20.23456789012345678901 Real11: 1.4189000e+03 s/b 1.418900e+03 Rea112: 5.4844000e+02 s/b 5.484399e+02 Real13: 4.2812269e+05 s/b 4.281227e+05 Real14: 2.2601153e+00 s/b 2.260115e+00 Real15: true s/b true Real16: false s/b false Real17: true s/b true Real18: false s/b false Real19: true s/b true Real20: false s/b false Real21: true s/b true Real22: false s/b false Real23: true s/b true Real24: true s/b true Real25: false s/b false Real26: true s/b true Real27: true s/b true Real28: false s/b false Real29: 4.3523000e+02 s/b 4.35230e+02 Real30: 1.8942515e+05 s/b 1.89425e+05 Real31: 3.1363514e+01 s/b 3.13635e+01 Real32: -3.4430594e-01 s/b -3.44290e-01 Real33: 1.5684987e+00 s/b 1.56850e+00 Real34: 1.4110019e+00 s/b 1.41100e+00 Real35: 6.0758746e+00 s/b 6.07587e+00 Real36: 435 s/b 435 Real37: 984 s/b 984 Real38: 435 s/b 435 Real39: 1.2780520e+03 s/b 1.278052e+03 Real40: 2.3894600e+02 s/b 2.389460e+02 Real41: 1.0472018e+05 s/b 1.047202e+05 Real42: 7.2595975e-03 s/b 7.259598e-03 Real43: true s/b true Real44: false s/b false Real45: true s/b true Real46: false s/b false Real47: true s/b true Real48: false s/b false Real49: true s/b true Real50: false s/b false Real51: true s/b true Real52: true s/b true Real53: false s/b false Real54: true s/b true Real55: true s/b true Real56: false s/b false Real57: 3.4930000e+01 s/b 3.493000e+01 Real58: 5.4756000e+00 s/b 5.475600e+00 Real59: 9.7233328e+01 s/b 9.723333e+01 Real60: 3.3114727e-01 s/b 3.311461e-01 Real61: 1.5678826e+00 s/b 1.567883e+00 Real62: 1.3937528e+00 s/b 1.393753e+00 Real63: 4.4214877e+00 s/b 4.421488e+00 Real64: 24 s/b 24 Real65: 75 s/b 75 Real66: 83 s/b 83 Real67: 4.3330000e+01 s/b 4.333000e+01 Real68: 3.0034000e+02 s/b 3.003400e+02 Real69: 3.0034000e+02 s/b 3.003400e+02 Real70: -6.5999800e+03 s/b -6.599980e+03 Real71: -8.3687200e+03 s/b -8.368720e+03 Real72: 1.7687400e+03 s/b 1.768740e+03 Real73: -8.6690600e+03 s/b -8.669061e+03 Real74: -6.9003200e+03 s/b -6.900320e+03 Real75: -7.5955927e+05 s/b -7.595593e+05 Real76: -7.5955927e+05 s/b -7.595593e+05 Real77: 5.6052646e+06 s/b 5.605265e+06 Real78: -1.4090711e+00 s/b -1.409071e+00 Real79: -7.3796277e+00 s/b -7.379627e+00 Real80: 1.0398420e+01 s/b 1.039842e+01 Real81: true s/b true Real82: false s/b false Real83: true s/b true Real84: false s/b false Real85: true s/b true Real86: true s/b true Real87: false s/b false Real88: false s/b false Real89: true s/b true Real90: true s/b true Real91: false s/b false Real92: false s/b false Real93: true s/b true Real94: true s/b true Real95: true s/b true Real96: false s/b false Real97: false s/b false Real98: true s/b true Real99: true s/b true Real100: true s/b true Real101: false s/b false Real102: false s/b false Real103: 7.3420000e+02 s/b 7.34200e+02 Real104: 5.3904964e+05 s/b 5.39050e+05 Real105: -4.3483206e-01 s/b -4.34850e-01 Real106: -1.5694343e+00 s/b -1.56943e+00 Real107: 6.8056632e-01 s/b 6.80566e-01 Real108: -734 s/b -734 Real109: -7635 s/b -7635 Real110: -734 s/b -734 Real111: 1.5100000e+01 s/b 1.510000e+01 Real112: 4.5133000e+01 s/b 4.513300e+01 Real113: -3.8640000e+01 s/b -3.864000e+01 Real114: -3.6581000e+01 s/b -3.658100e+01 Real115: 3.5548000e+01 s/b 3.554800e+01 Real116: -4.9398400e+01 s/b -4.939840e+01 Real117: -4.4001000e+01 s/b -4.400100e+01 Real118: -2.6412232e+01 s/b -2.641223e+01 Real119: -1.4890414e+02 s/b -1.489041e+02 Real120: 5.5856325e+02 s/b 5.585632e+02 Real121: -5.2201566e+00 s/b -5.220157e+00 Real122: -1.7721625e+01 s/b -1.772163e+01 Real123: 4.2745824e+00 s/b 4.274582e+00 Real124: true s/b true Real125: false s/b false Real126: true s/b true Real127: false s/b false Real128: true s/b true Real129: true s/b true Real130: false s/b false Real131: false s/b false Real132: true s/b true Real133: true s/b true Real134: false s/b false Real135: false s/b false Real136: true s/b true Real137: true s/b true Real138: true s/b true Real139: false s/b false Real140: false s/b false Real141: true s/b true Real142: true s/b true Real143: true s/b true Real144: false s/b false Real145: false s/b false Real146: 6.8230000e+00 s/b 6.823000e+00 Real147 1.2125717e+05 s/b 1.212572e+05 Real148: 9.4212450e-01 s/b 9.421146e-01 Real149: -1.5706771e+00 s/b -1.570677e+00 Real150: 4.1715393e-01 s/b 4.171539e-01 Real151: -33 s/b -33 Real152: -843 s/b -843 Real153: -6244 s/b -6244 Real154: -8.4220000e+01 s/b -8.422000e+01 Real155: 8.4220000e+01 s/b 8.422000e+01 Real156: -4.3330000e+01 s/b -4.333000e+01 Real157: 8.4220000e+01 s/b 8.422000e+01
*** sets **
Set1: 10101010101010101010 s/b 10101010101010101010 Set2: 1101110001 s/b 1101110001 Set3: 0100010000 s/b 0100010000 Set4: 0100001000 s/b 0100001000 Set5: false s/b false Set6: true s/b true Set7: true s/b true Set8: false s/b false Set9: true s/b true Set10: true s/b true Set11: false s/b false Set12: true s/b true Set13: true s/b true Set14: false s/b false Set15: 0101010000 s/b 0101010000 Set16: true s/b true Set17: a_c_e_g_i_k_m_o_qs s/b a_c_e_g_i_k_m_o_qs Set18: a_cd_fg_ s/b a_cdfg Set19: a__h s/b a____h Set20: b____j s/b _b____j Set21: false s/b false Set22: true s/b true Set23: true s/b true Set24: false s/b false Set25: true s/b true Set26: true s/b true Set27: false s/b false Set28: true s/b true Set29: true s/b true Set30: false s/b false Set31: ae__ s/b ae_____ Set32: 0101010101 s/b 0101010101 Set33: 1101110001 s/b 1101110001 Set34: 0100010000 s/b 0100010000 Set35: 0100001000 s/b 0100001000 Set36: false s/b false Set37: true s/b true Set38: true s/b true Set39: false s/b false Set40: true s/b true Set41: true s/b true Set42: false s/b false Set43: true s/b true Set44: true s/b true Set45: false s/b false Set46: 0110000000 s/b 0110000000 Set47: 01 s/b 01 Set48: 11 s/b 11 Set49: 10 s/b 10 Set50: 10 s/b 10 Set51: false s/b false Set52: true s/b true Set53: true s/b true Set54: false s/b false Set55: true s/b true Set56: true s/b true Set57: false s/b false Set58: true s/b true Set59: true s/b true Set60: false s/b false Set61: 11 s/b 11 set62: true s/b true set63: 1000000001 s/b 1000000001
*** Pointers **
Pointer1: 4594 s/b 4594
By lines, 2/3 done.
The register allocator in pgen could be described as "simple, but difficult". Its basically a tree structured allocator, as opposed to a SSA (Static Single Assignment) allocator that is the state of the art, see the LLVM project. It only has about 5 primitives in it, getreg()/getfreg(), resreg() and resreg(). The result is that it can handle basically any allocation situation, but the means are sometimes far from obvious. Let's go through a test case.
the inn instruction (test in set), as a pair looks like:
{inn}
48: begin
asscall;
assreg(ep^.l, rf, rgrdi, rgnull); resreg(rgrdi);
assreg(ep^.r, rf, rgrsi, rgnull);
if (r1 = rgnull) and (rgrax in rf) then ep^.r1 := rgrax else
ep^.r1 := r1;
if ep^.r1 = rgnull then getreg(ep^.r1, rf)
end;
For the register allocator, and:
{inn}
48: begin
wrtins20('call psystem_setsin ', 0, 0, rgnull, rgnull, nil);
if ep^.r1 <> rgrax then
wrtins20('movq %rax,%1 ', 0, 0, ep^.r1, rgnull, nil);
puttmp(ep^.r^.r1a)
end;
For the encoder. First of all, it is a downcall to psystem_setsin, which has the header:
boolean psystem_setsin(
/* set element */ long i, /* rdi */
/* set */ settype s /* rsi */
)
Because it is a downcall (calls out of the generated code), the calling convention dictates that the registers rax, rcx, rdx, rsi, rdi, r8, r9, r10 and r11 could be trashed by the called routine (see System V ABI/AMD64 supplement). Point of fact, it doesn't. I have stepped through that code, and it leaves most of those registers intact. However, its a big mistake to depend on that. If you do, you set up a time bomb for later when things change. Thus the register assignment begins with asscall(), which clears the registers, or more accurately "guards" the registers using a dstreg() or destroy register call.
I formerly used a resreg() call for this, but resreg() removes the register from the free register mask on the current node, meaning that it affects register allocation within the node. dstreg() does not remove the register from the free mask, but DOES set the save register mask if the register is not free on entry to the node. The meaning of this is that destroying a register requires the branch that uses the current node to protect the register if it is used above, because it is destroyed. But within the node, we don't care if it is destroyed. We can use that register at will or not.
Moving down in the assignment code, the two branches of inn are the value at left branch and the set to check it exists in on the right branch. Here is where ordering matters. We process the left branch and then the right branch, then we determine the result, in that order. The left branch ends up in rdi, and the right in rsi, because that is the calling convention. The result ends up in the rax register as a boolean value.
The way assreg() works is we can specify what registers the left and right end up in directly. However, the two nodes don't know or care about each other, which means that the right node processing could easily scribble on the left node's register. So we do a reservation with resreg() for the left. We could do the same for the right register, but it is pointless. The parameters are set up for the call at that point, and the registers are going to get wiped out in any case by the call.
The result ends up in the rax register, and we check if that matches the demand register r1. If not, we need to put it there, which is done at encode time. If there was no demand register specified, and rax is not free on entry, we need another register to move it to as a return register. But wait, didn't we wipe out the rax register because of the call? Yes, but the node that called us could be using that. In that case it would be protected (pushed). So we move it to another register, which was picked as a free register.
Finally, because a set was involved, and that gets consumed, we have to free that with puttmp() at the end of the encode.
What is illustrated here is that register assignments must be done fairly carefully and are order dependent. Again simple but difficult.
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
The following are implementation defined characteristics
Maxint: 9223372036854775807 Bit length of integer without sign bit appears to be: 63 Integer default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1 Real default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1.20000000000000e+00 Note that the exponent character 'e' or 'E' is implementation defined as well as the number of exponent digits Boolean default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 false true Note that the upper or lower case state of the characters in 'true' and 'false' are implementation defined Char default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 a Appears to be ASCII
Control structures tests
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1 Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control6: yes s/b yes Control7: yes s/b yes Control8: yes stop s/b yes stop Control9: stop s/b stop Control10: one two three four five six seven eight nine-ten nine-ten Control10: s/b one two three four five six seven eight nine-ten nine-ten Control11: start stop s/b start stop Control12: start stop s/b start stop Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10 Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1 Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9 Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0 Control17: start good s/b start good Control18: start stop s/b start stop
Integers
Integer1: 121 s/b 121 Integer2: 35 s/b 35 Integer3: 3354 s/b 3354 Integer4: 1 s/b 1 Integer5: 35 s/b 35 Integer6: 44 s/b 44 Integer7: 42 s/b 42 Integer8: 1849 s/b 1849 Integer9: N s/b N Integer10: 43 s/b 43 Integer11: true s/b true Integer12: false s/b false Integer13: true s/b true Integer14: false s/b false Integer15: true s/b true Integer16: false s/b false Integer17: true s/b true Integer18: false s/b false Integer19: true s/b true Integer20: false s/b false Integer21: true s/b true Integer22: true s/b true Integer23: false s/b false Integer24: true s/b true Integer25: true s/b true Integer26: false s/b false Integer27: 546 s/b 546 Integer28: 90 s/b 90 Integer29: 22 s/b 22 Integer30: 1904 s/b 1904 Integer31: 1 s/b 1 Integer32: 22 s/b 22 Integer33: 6 s/b 6 Integer34: 4 s/b 4 Integer35: 49 s/b 49 Integer36: A s/b A Integer37: 65 s/b 65 Integer38: 768 s/b 768 Integer39: true s/b true Integer40: false s/b false Integer41: true s/b true Integer42: false s/b false Integer43: true s/b true Integer44: false s/b false Integer45: true s/b true Integer46: false s/b false Integer47: true s/b true Integer48: false s/b false Integer49: true s/b true Integer50: true s/b true Integer51: false s/b false Integer52: true s/b true Integer53: true s/b true Integer54: false s/b false Integer55: 6 s/b 6 Integer56: 6 s/b 6 Integer57: -12 s/b -12 Integer58: -46 s/b -46 Integer59: 34 s/b 34 Integer60: -52 s/b -52 Integer61: -18 s/b -18 Integer62: -280 s/b -280 Integer63: -280 s/b -280 Integer64: 448 s/b 448 Integer65: -1 s/b -1 Integer66: -1 s/b -1 Integer67: 2 s/b 2 Integer68: -13 s/b -13 Integer69: -33 s/b -33 Integer70: 196 s/b 196 Integer71: false s/b false Integer72: true s/b true Integer73: true s/b true Integer74: false s/b false Integer75: true s/b true Integer76: false s/b false Integer77: true s/b true Integer78: true s/b true Integer79: false s/b false Integer80: false s/b false Integer81: true s/b true Integer82: true s/b true Integer83: false s/b false Integer84: false s/b false Integer85: true s/b true Integer86: true s/b true Integer87: true s/b true Integer88: false s/b false Integer89: false s/b false Integer90: true s/b true Integer91: true s/b true Integer92: true s/b true Integer93: false s/b false Integer94: false s/b false Integer95: 14 s/b 14 Integer96: 0 s/b 0 Integer97: 0 s/b 0 Integer98: 0 s/b 0 Integer99: 15 s/b 15 Integer100: 45 s/b 45 Integer101: -39 s/b -39 Integer102: -35 s/b -35 Integer103: 34 s/b 34 Integer104: -48 s/b -48 Integer105: -44 s/b -44 Integer106: -20 s/b -20 Integer107: -126 s/b -126 Integer108: 520 s/b 520 Integer109: -6 s/b -6 Integer110: -25 s/b -25 Integer111: 5 s/b 5 Integer112: -9 s/b -9 Integer113: 0 s/b 0 Integer114: -2 s/b -2 Integer115: 64 s/b 64 Integer116: -55 s/b -55 Integer117: false s/b false Integer118: true s/b true Integer119: true s/b true Integer120: false s/b false Integer121: true s/b true Integer122: false s/b false Integer123: true s/b true Integer124: true s/b true Integer125: false s/b false Integer126: false s/b false Integer127: true s/b true Integer128: true s/b true Integer129: false s/b false Integer130: false s/b false Integer131: true s/b true Integer132: true s/b true Integer133: true s/b true Integer134: false s/b false Integer135: false s/b false Integer136: true s/b true Integer137: true s/b true Integer138: true s/b true Integer139: false s/b false Integer140: false s/b false Integer141: 6 s/b 6 Integer142: -52 s/b -52 Integer143: 52 s/b 52 Integer144: -768 s/b -768 Integer145: 52 s/b 52 Integer146: 0 s/b 0 Integer147: 42 s/b 42 Integer148: 1 2 3 4 5 6 7 8 9 10 11 12 13 s/b 1 2 3 4 5 6 7 8 9 10 11 12 13
Subranges
Subrange1: 121 s/b 121 Subrange2: 35 s/b 35 Subrange3: 3354 s/b 3354 Subrange4: 1 s/b 1 Subrange5: 35 s/b 35 Subrange6: 44 s/b 44 Subrange7: 42 s/b 42 Subrange8: N s/b N Subrange9: 43 s/b 43 Subrange10: true s/b true Subrange11: false s/b false Subrange12: true s/b true Subrange13: false s/b false Subrange14: true s/b true Subrange15: false s/b false Subrange16: true s/b true Subrange17: false s/b false Subrange18: true s/b true Subrange19: false s/b false Subrange20: true s/b true Subrange21: true s/b true Subrange22: false s/b false Subrange23: true s/b true Subrange24: true s/b true Subrange25: false s/b false Subrange26: 6 s/b 6 Subrange27: 6 s/b 6 Subrange28: -12 s/b -12 Subrange29: -46 s/b -46 Subrange30: 34 s/b 34 Subrange31: -52 s/b -52 Subrange32: -18 s/b -18 Subrange33: -280 s/b -280 Subrange34: -280 s/b -280 Subrange35: 448 s/b 448 Subrange36: -1 s/b -1 Subrange37: -1 s/b -1 Subrange38: 2 s/b 2 Subrange39: -13 s/b -13 Subrange40: -33 s/b -33 Subrange41: false s/b false Subrange42: true s/b true Subrange43: true s/b true Subrange44: false s/b false Subrange45: true s/b true Subrange46: false s/b false Subrange47: true s/b true Subrange48: true s/b true Subrange49: false s/b false Subrange50: false s/b false Subrange51: true s/b true Subrange52: true s/b true Subrange53: false s/b false Subrange54: false s/b false Subrange55: true s/b true Subrange56: true s/b true Subrange57: true s/b true Subrange58: false s/b false Subrange59: false s/b false Subrange60: true s/b true Subrange61: true s/b true Subrange62: true s/b true Subrange63: false s/b false Subrange64: false s/b false Subrange65: 14 s/b 14
Characters
Character1: g g u s/b g g u
Character2: h s/b h
Character3: f s/b f
Character4: 103 s/b 103
Character5: u s/b u
Character6: true s/b true
Character7: false s/b false
Character8: true s/b true
Character9: false s/b false
Character10: true s/b true
Character11: false s/b false
Character12: true s/b true
Character13: false s/b false
Character14: true s/b true
Character15: true s/b true
Character16: false s/b false
Character17: true s/b true
Character18: true s/b true
Character19: false s/b false
Character20: porker porker parker s/b porker porker parker
Character21: true s/b true
Character22: false s/b false
Character23: true s/b true
Character24: false s/b false
Character25: true s/b true
Character26: false s/b false
Character27: true s/b true
Character28: false s/b false
Character29: true s/b true
Character30: true s/b true
Character40: false s/b false
Character41: true s/b true
Character42: true s/b true
Character43: false s/b false
Character44: abcdefghijklmnopqrstuvwxyz s/b abcdefghijklmnopqrstuvwxyz
Character45: zyxwvutsrqponmlkjihgfedcba s/b zyxwvutsrqponmlkjihgfedcba
Character46: 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character46: s/b 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character47: n s/b n
Character48: junky01234 s/b junky01234
Character49:
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character49: s/b
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character50:
zero one two three four five six seven eight nine
s/b zero one two three four five six seven eight nine
Character51: a s/b a
Character52: b s/b b
Character53: y s/b y
Character54: 99 s/b 99
Character55: g s/b g
Character56: true s/b true
Character57: false s/b false
Character58: true s/b true
Character59: false s/b false
Character60: true s/b true
Character61: false s/b false
Character62: true s/b true
Character63: false s/b false
Character64: true s/b true
Character65: true s/b true
Character66: false s/b false
Character67: true s/b true
Character68: true s/b true
Character69: false s/b false
Character70: true s/b true
Character71: false s/b false
Character72: true s/b true
Character73: false s/b false
Character74: true s/b true
Character75: false s/b false
Character76: true s/b true
Character77: false s/b false
Character78: true s/b true
Character79: true s/b true
Character80: false s/b false
Character81: true s/b true
Character82: true s/b true
Character83: false s/b false
Character84: this is a string s/b this is a string
Character85: v s/b v
Character86:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character87: s/b:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character88:
true true true true true true true true true
s/b
true true true true true true true true true
Character89:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Character90:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Booleans
Boolean1: true false s/b true false Boolean2: true s/b true Boolean3: false s/b false Boolean4: 0 s/b 0 Boolean5: 1 s/b 1 Boolean6: true s/b true Boolean7: true s/b true Boolean8: false s/b false Boolean9: true s/b true Boolean10: false s/b false Boolean11: true s/b true Boolean12: false s/b false Boolean13: true s/b true Boolean14: false s/b false Boolean15: true s/b true Boolean16: true s/b true Boolean17: false s/b false Boolean18: true s/b true Boolean19: true s/b true Boolean20: false s/b false Boolean21: false true s/b false true Boolean22: true false s/b true false Boolean23: true s/b true Boolean24: false s/b false Boolean25: true false s/b true false Boolean26: true s/b true Boolean27: false s/b false Boolean28: 0 s/b 0 Boolean29: 1 s/b 1 Boolean30: true s/b true Boolean31: true s/b true Boolean32: false s/b false Boolean33: true s/b true Boolean34: false s/b false Boolean35: true s/b true Boolean36: false s/b false Boolean37: true s/b true Boolean38: false s/b false Boolean39: true s/b true Boolean40: true s/b true Boolean41: false s/b false Boolean42: true s/b true Boolean43: true s/b true Boolean44: false s/b false Boolean45: false false false false false false fals fal fa f Boolean45: s/b: false false false false false false fals fal fa f Boolean46: true true true true true true true tru tr t Boolean46: s/b: true true true true true true true tru tr t
Scalar
Scalar1: true s/b true Scalar2: true s/b true Scalar3: 0 s/b 0 Scalar4: 2 s/b 2 Scalar5: true s/b true Scalar6: true s/b true Scalar7: false s/b false Scalar8: true s/b true Scalar9: false s/b false Scalar10: true s/b true Scalar11: false s/b false Scalar12: true s/b true Scalar13: false s/b false Scalar14: true s/b true Scalar15: true s/b true Scalar16: false s/b false Scalar17: true s/b true Scalar18: true s/b true Scalar19: false s/b false Scalar20: 0 1 2 3 4 5 6 s/b 0 1 2 3 4 5 6 Scalar21: 6 5 4 3 2 1 0 s/b 6 5 4 3 2 1 0 Scalar20: true s/b true Scalar21: true s/b true Scalar22: 2 s/b 2 Scalar23: 6 s/b 6 Scalar24: true s/b true Scalar25: true s/b true Scalar26: false s/b false Scalar27: true s/b true Scalar28: false s/b false Scalar29: true s/b true Scalar30: false s/b false Scalar31: true s/b true Scalar32: false s/b false Scalar33: true s/b true Scalar34: true s/b true Scalar35: false s/b false Scalar36: true s/b true Scalar37: true s/b true Scalar38: false s/b false
*** Reals **
Real1: 1.5540000e+00 s/b 1.554000e+00 Real2: 3.3400000e-03 s/b 3.340000e-03 Real3: 3.3400000e-24 s/b 3.340000e-24 Real4: 4.0000000e-45 s/b 4.000000e-45 Real5: -5.5650000e+00 s/b -5.565000e+00 Real6: -9.4400000e-03 s/b -9.440000e-03 Real7: -6.3640000e+29 s/b -6.364000e+29 Real8: -2.0000000e-14 s/b -2.000000e-14 Real9: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.23e+00 1.235e+00 1.2346e+00 1.23457e+00 1.234568e+00 1.2345679e+00 1.23456789e+00 1.234567890e+00 1.2345678901e+00 1.23456789012e+00 1.234567890123e+00 s/b (note precision dropoff at right): 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.23e+000 1.234e+000 1.2345e+000 1.23456e+000 1.234567e+000 1.2345678e+000 1.23456789e+000 1.234567890e+000 1.2345678901e+000 1.23456789012e+000 1.234567890123e+000 Real10: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2 2.23 3.235 4.2346 5.23457 6.234568 7.2345679 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901235 14.23456789012346 15.234567890123456 16.2345678901234578 17.23456789012345780 18.234567890123457801 19.2345678901234578007 20.23456789012345780066 s/b (note precision dropoff at right): 1.2 2.23 3.234 4.2345 5.23456 6.234567 7.2345678 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901234 14.23456789012345 15.234567890123456 16.2345678901234567 17.23456789012345678 18.234567890123456789 19.2345678901234567890 20.23456789012345678901 Real11: 1.4189000e+03 s/b 1.418900e+03 Rea112: 5.4844000e+02 s/b 5.484399e+02 Real13: 4.2812269e+05 s/b 4.281227e+05 Real14: 2.2601153e+00 s/b 2.260115e+00 Real15: true s/b true Real16: false s/b false Real17: true s/b true Real18: false s/b false Real19: true s/b true Real20: false s/b false Real21: true s/b true Real22: false s/b false Real23: true s/b true Real24: true s/b true Real25: false s/b false Real26: true s/b true Real27: true s/b true Real28: false s/b false Real29: 4.3523000e+02 s/b 4.35230e+02 Real30: 1.8942515e+05 s/b 1.89425e+05 Real31: 3.1363514e+01 s/b 3.13635e+01 Real32: -3.4430594e-01 s/b -3.44290e-01 Real33: 1.5684987e+00 s/b 1.56850e+00 Real34: 1.4110019e+00 s/b 1.41100e+00 Real35: 6.0758746e+00 s/b 6.07587e+00 Real36: 435 s/b 435 Real37: 984 s/b 984 Real38: 435 s/b 435 Real39: 1.2780520e+03 s/b 1.278052e+03 Real40: 2.3894600e+02 s/b 2.389460e+02 Real41: 1.0472018e+05 s/b 1.047202e+05 Real42: 7.2595975e-03 s/b 7.259598e-03 Real43: true s/b true Real44: false s/b false Real45: true s/b true Real46: false s/b false Real47: true s/b true Real48: false s/b false Real49: true s/b true Real50: false s/b false Real51: true s/b true Real52: true s/b true Real53: false s/b false Real54: true s/b true Real55: true s/b true Real56: false s/b false Real57: 3.4930000e+01 s/b 3.493000e+01 Real58: 5.4756000e+00 s/b 5.475600e+00 Real59: 9.7233328e+01 s/b 9.723333e+01 Real60: 3.3114727e-01 s/b 3.311461e-01 Real61: 1.5678826e+00 s/b 1.567883e+00 Real62: 1.3937528e+00 s/b 1.393753e+00 Real63: 4.4214877e+00 s/b 4.421488e+00 Real64: 24 s/b 24 Real65: 75 s/b 75 Real66: 83 s/b 83 Real67: 4.3330000e+01 s/b 4.333000e+01 Real68: 3.0034000e+02 s/b 3.003400e+02 Real69: 3.0034000e+02 s/b 3.003400e+02 Real70: -6.5999800e+03 s/b -6.599980e+03 Real71: -8.3687200e+03 s/b -8.368720e+03 Real72: 1.7687400e+03 s/b 1.768740e+03 Real73: -8.6690600e+03 s/b -8.669061e+03 Real74: -6.9003200e+03 s/b -6.900320e+03 Real75: -7.5955927e+05 s/b -7.595593e+05 Real76: -7.5955927e+05 s/b -7.595593e+05 Real77: 5.6052646e+06 s/b 5.605265e+06 Real78: -1.4090711e+00 s/b -1.409071e+00 Real79: -7.3796277e+00 s/b -7.379627e+00 Real80: 1.0398420e+01 s/b 1.039842e+01 Real81: true s/b true Real82: false s/b false Real83: true s/b true Real84: false s/b false Real85: true s/b true Real86: true s/b true Real87: false s/b false Real88: false s/b false Real89: true s/b true Real90: true s/b true Real91: false s/b false Real92: false s/b false Real93: true s/b true Real94: true s/b true Real95: true s/b true Real96: false s/b false Real97: false s/b false Real98: true s/b true Real99: true s/b true Real100: true s/b true Real101: false s/b false Real102: false s/b false Real103: 7.3420000e+02 s/b 7.34200e+02 Real104: 5.3904964e+05 s/b 5.39050e+05 Real105: -4.3483206e-01 s/b -4.34850e-01 Real106: -1.5694343e+00 s/b -1.56943e+00 Real107: 6.8056632e-01 s/b 6.80566e-01 Real108: -734 s/b -734 Real109: -7635 s/b -7635 Real110: -734 s/b -734 Real111: 1.5100000e+01 s/b 1.510000e+01 Real112: 4.5133000e+01 s/b 4.513300e+01 Real113: -3.8640000e+01 s/b -3.864000e+01 Real114: -3.6581000e+01 s/b -3.658100e+01 Real115: 3.5548000e+01 s/b 3.554800e+01 Real116: -4.9398400e+01 s/b -4.939840e+01 Real117: -4.4001000e+01 s/b -4.400100e+01 Real118: -2.6412232e+01 s/b -2.641223e+01 Real119: -1.4890414e+02 s/b -1.489041e+02 Real120: 5.5856325e+02 s/b 5.585632e+02 Real121: -5.2201566e+00 s/b -5.220157e+00 Real122: -1.7721625e+01 s/b -1.772163e+01 Real123: 4.2745824e+00 s/b 4.274582e+00 Real124: true s/b true Real125: false s/b false Real126: true s/b true Real127: false s/b false Real128: true s/b true Real129: true s/b true Real130: false s/b false Real131: false s/b false Real132: true s/b true Real133: true s/b true Real134: false s/b false Real135: false s/b false Real136: true s/b true Real137: true s/b true Real138: true s/b true Real139: false s/b false Real140: false s/b false Real141: true s/b true Real142: true s/b true Real143: true s/b true Real144: false s/b false Real145: false s/b false Real146: 6.8230000e+00 s/b 6.823000e+00 Real147 1.2125717e+05 s/b 1.212572e+05 Real148: 9.4212450e-01 s/b 9.421146e-01 Real149: -1.5706771e+00 s/b -1.570677e+00 Real150: 4.1715393e-01 s/b 4.171539e-01 Real151: -33 s/b -33 Real152: -843 s/b -843 Real153: -6244 s/b -6244 Real154: -8.4220000e+01 s/b -8.422000e+01 Real155: 8.4220000e+01 s/b 8.422000e+01 Real156: -4.3330000e+01 s/b -4.333000e+01 Real157: 8.4220000e+01 s/b 8.422000e+01
*** sets **
Set1: 10101010101010101010 s/b 10101010101010101010 Set2: 1101110001 s/b 1101110001 Set3: 0100010000 s/b 0100010000 Set4: 0100001000 s/b 0100001000 Set5: false s/b false Set6: true s/b true Set7: true s/b true Set8: false s/b false Set9: true s/b true Set10: true s/b true Set11: false s/b false Set12: true s/b true Set13: true s/b true Set14: false s/b false Set15: 0101010000 s/b 0101010000 Set16: true s/b true Set17: a_c_e_g_i_k_m_o_qs s/b a_c_e_g_i_k_m_o_qs Set18: a_cd_fg_ s/b a_cdfg Set19: a__h s/b a____h Set20: b____j s/b _b____j Set21: false s/b false Set22: true s/b true Set23: true s/b true Set24: false s/b false Set25: true s/b true Set26: true s/b true Set27: false s/b false Set28: true s/b true Set29: true s/b true Set30: false s/b false Set31: ae__ s/b ae_____ Set32: 0101010101 s/b 0101010101 Set33: 1101110001 s/b 1101110001 Set34: 0100010000 s/b 0100010000 Set35: 0100001000 s/b 0100001000 Set36: false s/b false Set37: true s/b true Set38: true s/b true Set39: false s/b false Set40: true s/b true Set41: true s/b true Set42: false s/b false Set43: true s/b true Set44: true s/b true Set45: false s/b false Set46: 0110000000 s/b 0110000000 Set47: 01 s/b 01 Set48: 11 s/b 11 Set49: 10 s/b 10 Set50: 10 s/b 10 Set51: false s/b false Set52: true s/b true Set53: true s/b true Set54: false s/b false Set55: true s/b true Set56: true s/b true Set57: false s/b false Set58: true s/b true Set59: true s/b true Set60: false s/b false Set61: 11 s/b 11 set62: true s/b true set63: 1000000001 s/b 1000000001
*** Pointers **
Pointer1: 4594 s/b 4594
Pointer2: true s/b true
Pointer3: false s/b false
Pointer4: p s/b p
Pointer5: 5 s/b 5
Pointer6: 3 s/b 3
Pointer7: 17 s/b 17
Pointer8: 1234.5678 s/b 1234.5678
Pointer9: my word is s/b my word is
Pointer10: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11
Pointer11: 7234 y s/b 7234 y
Pointer12: __ s/b _b_d____ij
Pointer13: 3732 s/b 3732
Pointer14: true s/b true
Pointer15: false s/b false
Pointer16: true s/b true
Pointer17: false s/b false
Pointer18: false s/b false
Pointer19: true s/b true
Pointer20: done s/b done
Pointer21: Pointer22: done s/b done
Pointer23: done s/b done
Pointer24:
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 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
s/b
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 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
Pointer25:
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 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
s/b
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
*** arrays **
Array1: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array2: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array3: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array4: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array5: false true false true false true false true false true s/b: false true false true false true false true false true Array6: false true false true false true false true false true s/b: false true false true false true false true false true Array7: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 s/b: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 Array8: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 s/b: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 Array9: k j i h g f e d c b s/b k j i h g f e d c b Array10: k j i h g f e d c b s/b k j i h g f e d c b Array11: p o n m l k j i h g s/b p o n m l k j i h g Array12: p o n m l k j i h g s/b p o n m l k j i h g Array13: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array14: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array15: 5 4 3 2 s/b 5 4 3 2 Array16: 5 4 3 2 s/b 5 4 3 2 Array17: s/b k j i h g f e d c b Array18: s/b k j i h g f e d c b Array19: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b s/b: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b Array20: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b s/b: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b Array21: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array22: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array23: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array24: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array25: 11 10 s/b 11 10 Array26: 11 10 s/b 11 10 Array27: j i h g f e d c b a s/b j i h g f e d c b a Array28: j i h g f e d c b a s/b j i h g f e d c b a Array29: j i h g f e d c b a s/b j i h g f e d c b a Array30: j i h g f e d c b a s/b j i h g f e d c b a Array31: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array32: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array33: 5 4 3 2 1 s/b 5 4 3 2 1 Array34: 5 4 3 2 1 s/b 5 4 3 2 1 Array35: 0 10 20 30 40 50 60 70 80 90 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 s/b 0 10 20 30 40 50 60 70 80 90 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 Array36: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 s/b: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Array37: hello, guy s/b hello, guy Array38: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array39: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 s/b: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Array40: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array41: 20 19 18 17 16 15 14 13 12 11 s/b 30 29 28 27 26 25 24 23 22 21 Array42: 0 0 0 0 0 0 106 105 104 103 s/b 40 39 38 37 36 35 34 33 32 31 Array43: 40 39 38 37 36 35 34 33 32 31 s/b 22 21 20 19 18 17 16 15 14 13
*** records **
Record1:
64 false j 1 3 12 4.5451200e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
_bcdei
8454
s/b:
64 false j 1 3 12 4.54512000e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
bcdei_
8454
Record2:
64 false j 1 3 12 4.5451200e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
_bcdei
8454
s/b:
64 false j 1 3 12 4.54512000e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
bcdei_
8454
Record3: 873 0 235 427 s/b 873 0 235 427
Record4: 873 1 true 427 s/b 873 1 true 427
Record5: 873 2 f 427 s/b 873 2 f 427
Record6: 873 3 8 427 s/b 873 3 8 427
Record7: 873 4 3 427 s/b 873 4 3 427
Record8: 873 5 12 427 s/b 873 5 12 427
Record9: 873 6 8734.8389 427 s/b 873 6 8734.8389 427
Record10: 873 7 this one ? 427 s/b 873 7 this one ? 427
Record11: 873 8 20 19 18 17 16 15 14 13 12 11 427
s/b: 873 8 20 19 18 17 16 15 14 13 12 11 427
Record12: 873 9 2387 t 427 s/b: 873 9 2387 t 427
Record13: 873 10 _igfedcb 427
s/b: 873 10 _igfedcb 427
Record14: 873 11 2394 427 s/b 873 11 2394 427
Record15: 10 2343 s/b 10 2343
Record16: 19 true s/b 19 true
Record17: true 2343 s/b true 2343
Record18: false true s/b false true
Record19: 2 2343 s/b 2 2343
Record20: 7 true s/b 7 true
Record21: 3 2343 s/b 3 2343
Record22: 4 true s/b 4 true
Record23: 42 s/b 42
Record24: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Record25: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1
Record26: 10 9 8 7 6 5 4 3 2 76 s/b 10 9 8 7 6 5 4 3 2 76
Record27: 1 g s/b 1 g
Record28: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11
About 300 lines to go (out of 3381)
TEST SUITE FOR ISO 7185 PASCAL
Copyright (C) 1995 S. A. Moore - All rights reserved
The following are implementation defined characteristics
Maxint: 9223372036854775807 Bit length of integer without sign bit appears to be: 63 Integer default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1 Real default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 1.20000000000000e+00 Note that the exponent character 'e' or 'E' is implementation defined as well as the number of exponent digits Boolean default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 false true Note that the upper or lower case state of the characters in 'true' and 'false' are implementation defined Char default output field 1111111111222222222233333333334 1234567890123456789012345678901234567890 a Appears to be ASCII
Control structures tests
Control1: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control2: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1 Control3: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control4: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control5: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10 Control6: yes s/b yes Control7: yes s/b yes Control8: yes stop s/b yes stop Control9: stop s/b stop Control10: one two three four five six seven eight nine-ten nine-ten Control10: s/b one two three four five six seven eight nine-ten nine-ten Control11: start stop s/b start stop Control12: start stop s/b start stop Control13: start 1 2 3 4 5 6 7 8 9 10 s/b start 1 2 3 4 5 6 7 8 9 10 Control14: start 10 9 8 7 6 5 4 3 2 1 s/b start 10 9 8 7 6 5 4 3 2 1 Control15: start 0 1 2 3 4 5 6 7 8 9 s/b start 0 1 2 3 4 5 6 7 8 9 Control16: start 9 8 7 6 5 4 3 2 1 0 s/b start 9 8 7 6 5 4 3 2 1 0 Control17: start good s/b start good Control18: start stop s/b start stop
Integers
Integer1: 121 s/b 121 Integer2: 35 s/b 35 Integer3: 3354 s/b 3354 Integer4: 1 s/b 1 Integer5: 35 s/b 35 Integer6: 44 s/b 44 Integer7: 42 s/b 42 Integer8: 1849 s/b 1849 Integer9: N s/b N Integer10: 43 s/b 43 Integer11: true s/b true Integer12: false s/b false Integer13: true s/b true Integer14: false s/b false Integer15: true s/b true Integer16: false s/b false Integer17: true s/b true Integer18: false s/b false Integer19: true s/b true Integer20: false s/b false Integer21: true s/b true Integer22: true s/b true Integer23: false s/b false Integer24: true s/b true Integer25: true s/b true Integer26: false s/b false Integer27: 546 s/b 546 Integer28: 90 s/b 90 Integer29: 22 s/b 22 Integer30: 1904 s/b 1904 Integer31: 1 s/b 1 Integer32: 22 s/b 22 Integer33: 6 s/b 6 Integer34: 4 s/b 4 Integer35: 49 s/b 49 Integer36: A s/b A Integer37: 65 s/b 65 Integer38: 768 s/b 768 Integer39: true s/b true Integer40: false s/b false Integer41: true s/b true Integer42: false s/b false Integer43: true s/b true Integer44: false s/b false Integer45: true s/b true Integer46: false s/b false Integer47: true s/b true Integer48: false s/b false Integer49: true s/b true Integer50: true s/b true Integer51: false s/b false Integer52: true s/b true Integer53: true s/b true Integer54: false s/b false Integer55: 6 s/b 6 Integer56: 6 s/b 6 Integer57: -12 s/b -12 Integer58: -46 s/b -46 Integer59: 34 s/b 34 Integer60: -52 s/b -52 Integer61: -18 s/b -18 Integer62: -280 s/b -280 Integer63: -280 s/b -280 Integer64: 448 s/b 448 Integer65: -1 s/b -1 Integer66: -1 s/b -1 Integer67: 2 s/b 2 Integer68: -13 s/b -13 Integer69: -33 s/b -33 Integer70: 196 s/b 196 Integer71: false s/b false Integer72: true s/b true Integer73: true s/b true Integer74: false s/b false Integer75: true s/b true Integer76: false s/b false Integer77: true s/b true Integer78: true s/b true Integer79: false s/b false Integer80: false s/b false Integer81: true s/b true Integer82: true s/b true Integer83: false s/b false Integer84: false s/b false Integer85: true s/b true Integer86: true s/b true Integer87: true s/b true Integer88: false s/b false Integer89: false s/b false Integer90: true s/b true Integer91: true s/b true Integer92: true s/b true Integer93: false s/b false Integer94: false s/b false Integer95: 14 s/b 14 Integer96: 0 s/b 0 Integer97: 0 s/b 0 Integer98: 0 s/b 0 Integer99: 15 s/b 15 Integer100: 45 s/b 45 Integer101: -39 s/b -39 Integer102: -35 s/b -35 Integer103: 34 s/b 34 Integer104: -48 s/b -48 Integer105: -44 s/b -44 Integer106: -20 s/b -20 Integer107: -126 s/b -126 Integer108: 520 s/b 520 Integer109: -6 s/b -6 Integer110: -25 s/b -25 Integer111: 5 s/b 5 Integer112: -9 s/b -9 Integer113: 0 s/b 0 Integer114: -2 s/b -2 Integer115: 64 s/b 64 Integer116: -55 s/b -55 Integer117: false s/b false Integer118: true s/b true Integer119: true s/b true Integer120: false s/b false Integer121: true s/b true Integer122: false s/b false Integer123: true s/b true Integer124: true s/b true Integer125: false s/b false Integer126: false s/b false Integer127: true s/b true Integer128: true s/b true Integer129: false s/b false Integer130: false s/b false Integer131: true s/b true Integer132: true s/b true Integer133: true s/b true Integer134: false s/b false Integer135: false s/b false Integer136: true s/b true Integer137: true s/b true Integer138: true s/b true Integer139: false s/b false Integer140: false s/b false Integer141: 6 s/b 6 Integer142: -52 s/b -52 Integer143: 52 s/b 52 Integer144: -768 s/b -768 Integer145: 52 s/b 52 Integer146: 0 s/b 0 Integer147: 42 s/b 42 Integer148: 1 2 3 4 5 6 7 8 9 10 11 12 13 s/b 1 2 3 4 5 6 7 8 9 10 11 12 13
Subranges
Subrange1: 121 s/b 121 Subrange2: 35 s/b 35 Subrange3: 3354 s/b 3354 Subrange4: 1 s/b 1 Subrange5: 35 s/b 35 Subrange6: 44 s/b 44 Subrange7: 42 s/b 42 Subrange8: N s/b N Subrange9: 43 s/b 43 Subrange10: true s/b true Subrange11: false s/b false Subrange12: true s/b true Subrange13: false s/b false Subrange14: true s/b true Subrange15: false s/b false Subrange16: true s/b true Subrange17: false s/b false Subrange18: true s/b true Subrange19: false s/b false Subrange20: true s/b true Subrange21: true s/b true Subrange22: false s/b false Subrange23: true s/b true Subrange24: true s/b true Subrange25: false s/b false Subrange26: 6 s/b 6 Subrange27: 6 s/b 6 Subrange28: -12 s/b -12 Subrange29: -46 s/b -46 Subrange30: 34 s/b 34 Subrange31: -52 s/b -52 Subrange32: -18 s/b -18 Subrange33: -280 s/b -280 Subrange34: -280 s/b -280 Subrange35: 448 s/b 448 Subrange36: -1 s/b -1 Subrange37: -1 s/b -1 Subrange38: 2 s/b 2 Subrange39: -13 s/b -13 Subrange40: -33 s/b -33 Subrange41: false s/b false Subrange42: true s/b true Subrange43: true s/b true Subrange44: false s/b false Subrange45: true s/b true Subrange46: false s/b false Subrange47: true s/b true Subrange48: true s/b true Subrange49: false s/b false Subrange50: false s/b false Subrange51: true s/b true Subrange52: true s/b true Subrange53: false s/b false Subrange54: false s/b false Subrange55: true s/b true Subrange56: true s/b true Subrange57: true s/b true Subrange58: false s/b false Subrange59: false s/b false Subrange60: true s/b true Subrange61: true s/b true Subrange62: true s/b true Subrange63: false s/b false Subrange64: false s/b false Subrange65: 14 s/b 14
Characters
Character1: g g u s/b g g u
Character2: h s/b h
Character3: f s/b f
Character4: 103 s/b 103
Character5: u s/b u
Character6: true s/b true
Character7: false s/b false
Character8: true s/b true
Character9: false s/b false
Character10: true s/b true
Character11: false s/b false
Character12: true s/b true
Character13: false s/b false
Character14: true s/b true
Character15: true s/b true
Character16: false s/b false
Character17: true s/b true
Character18: true s/b true
Character19: false s/b false
Character20: porker porker parker s/b porker porker parker
Character21: true s/b true
Character22: false s/b false
Character23: true s/b true
Character24: false s/b false
Character25: true s/b true
Character26: false s/b false
Character27: true s/b true
Character28: false s/b false
Character29: true s/b true
Character30: true s/b true
Character40: false s/b false
Character41: true s/b true
Character42: true s/b true
Character43: false s/b false
Character44: abcdefghijklmnopqrstuvwxyz s/b abcdefghijklmnopqrstuvwxyz
Character45: zyxwvutsrqponmlkjihgfedcba s/b zyxwvutsrqponmlkjihgfedcba
Character46: 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character46: s/b 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Character47: n s/b n
Character48: junky01234 s/b junky01234
Character49:
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character49: s/b
crapola
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
0123456789
finnork
trash
Character50:
zero one two three four five six seven eight nine
s/b zero one two three four five six seven eight nine
Character51: a s/b a
Character52: b s/b b
Character53: y s/b y
Character54: 99 s/b 99
Character55: g s/b g
Character56: true s/b true
Character57: false s/b false
Character58: true s/b true
Character59: false s/b false
Character60: true s/b true
Character61: false s/b false
Character62: true s/b true
Character63: false s/b false
Character64: true s/b true
Character65: true s/b true
Character66: false s/b false
Character67: true s/b true
Character68: true s/b true
Character69: false s/b false
Character70: true s/b true
Character71: false s/b false
Character72: true s/b true
Character73: false s/b false
Character74: true s/b true
Character75: false s/b false
Character76: true s/b true
Character77: false s/b false
Character78: true s/b true
Character79: true s/b true
Character80: false s/b false
Character81: true s/b true
Character82: true s/b true
Character83: false s/b false
Character84: this is a string s/b this is a string
Character85: v s/b v
Character86:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character87: s/b:
hello, world
hello, world
hello, world
hello, world
hello, worl
hello, wor
hello, wo
hello, w
hello,
hello,
hello
hell
hel
he
h
Character88:
true true true true true true true true true
s/b
true true true true true true true true true
Character89:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Character90:
true true true true true true true true true true
true true true true true true true true true true
true true true true true
s/b
true true true true true true true true true true
true true true true true true true true true true
true true true true true
Booleans
Boolean1: true false s/b true false Boolean2: true s/b true Boolean3: false s/b false Boolean4: 0 s/b 0 Boolean5: 1 s/b 1 Boolean6: true s/b true Boolean7: true s/b true Boolean8: false s/b false Boolean9: true s/b true Boolean10: false s/b false Boolean11: true s/b true Boolean12: false s/b false Boolean13: true s/b true Boolean14: false s/b false Boolean15: true s/b true Boolean16: true s/b true Boolean17: false s/b false Boolean18: true s/b true Boolean19: true s/b true Boolean20: false s/b false Boolean21: false true s/b false true Boolean22: true false s/b true false Boolean23: true s/b true Boolean24: false s/b false Boolean25: true false s/b true false Boolean26: true s/b true Boolean27: false s/b false Boolean28: 0 s/b 0 Boolean29: 1 s/b 1 Boolean30: true s/b true Boolean31: true s/b true Boolean32: false s/b false Boolean33: true s/b true Boolean34: false s/b false Boolean35: true s/b true Boolean36: false s/b false Boolean37: true s/b true Boolean38: false s/b false Boolean39: true s/b true Boolean40: true s/b true Boolean41: false s/b false Boolean42: true s/b true Boolean43: true s/b true Boolean44: false s/b false Boolean45: false false false false false false fals fal fa f Boolean45: s/b: false false false false false false fals fal fa f Boolean46: true true true true true true true tru tr t Boolean46: s/b: true true true true true true true tru tr t
Scalar
Scalar1: true s/b true Scalar2: true s/b true Scalar3: 0 s/b 0 Scalar4: 2 s/b 2 Scalar5: true s/b true Scalar6: true s/b true Scalar7: false s/b false Scalar8: true s/b true Scalar9: false s/b false Scalar10: true s/b true Scalar11: false s/b false Scalar12: true s/b true Scalar13: false s/b false Scalar14: true s/b true Scalar15: true s/b true Scalar16: false s/b false Scalar17: true s/b true Scalar18: true s/b true Scalar19: false s/b false Scalar20: 0 1 2 3 4 5 6 s/b 0 1 2 3 4 5 6 Scalar21: 6 5 4 3 2 1 0 s/b 6 5 4 3 2 1 0 Scalar20: true s/b true Scalar21: true s/b true Scalar22: 2 s/b 2 Scalar23: 6 s/b 6 Scalar24: true s/b true Scalar25: true s/b true Scalar26: false s/b false Scalar27: true s/b true Scalar28: false s/b false Scalar29: true s/b true Scalar30: false s/b false Scalar31: true s/b true Scalar32: false s/b false Scalar33: true s/b true Scalar34: true s/b true Scalar35: false s/b false Scalar36: true s/b true Scalar37: true s/b true Scalar38: false s/b false
*** Reals **
Real1: 1.5540000e+00 s/b 1.554000e+00 Real2: 3.3400000e-03 s/b 3.340000e-03 Real3: 3.3400000e-24 s/b 3.340000e-24 Real4: 4.0000000e-45 s/b 4.000000e-45 Real5: -5.5650000e+00 s/b -5.565000e+00 Real6: -9.4400000e-03 s/b -9.440000e-03 Real7: -6.3640000e+29 s/b -6.364000e+29 Real8: -2.0000000e-14 s/b -2.000000e-14 Real9: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.2e+00 1.23e+00 1.235e+00 1.2346e+00 1.23457e+00 1.234568e+00 1.2345679e+00 1.23456789e+00 1.234567890e+00 1.2345678901e+00 1.23456789012e+00 1.234567890123e+00 s/b (note precision dropoff at right): 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.2e+000 1.23e+000 1.234e+000 1.2345e+000 1.23456e+000 1.234567e+000 1.2345678e+000 1.23456789e+000 1.234567890e+000 1.2345678901e+000 1.23456789012e+000 1.234567890123e+000 Real10: 11111111112222222222333333333344444444445 12345678901234567890123456789012345678901234567890 1.2 2.23 3.235 4.2346 5.23457 6.234568 7.2345679 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901235 14.23456789012346 15.234567890123456 16.2345678901234578 17.23456789012345780 18.234567890123457801 19.2345678901234578007 20.23456789012345780066 s/b (note precision dropoff at right): 1.2 2.23 3.234 4.2345 5.23456 6.234567 7.2345678 8.23456789 9.234567890 10.2345678901 11.23456789012 12.234567890123 13.2345678901234 14.23456789012345 15.234567890123456 16.2345678901234567 17.23456789012345678 18.234567890123456789 19.2345678901234567890 20.23456789012345678901 Real11: 1.4189000e+03 s/b 1.418900e+03 Rea112: 5.4844000e+02 s/b 5.484399e+02 Real13: 4.2812269e+05 s/b 4.281227e+05 Real14: 2.2601153e+00 s/b 2.260115e+00 Real15: true s/b true Real16: false s/b false Real17: true s/b true Real18: false s/b false Real19: true s/b true Real20: false s/b false Real21: true s/b true Real22: false s/b false Real23: true s/b true Real24: true s/b true Real25: false s/b false Real26: true s/b true Real27: true s/b true Real28: false s/b false Real29: 4.3523000e+02 s/b 4.35230e+02 Real30: 1.8942515e+05 s/b 1.89425e+05 Real31: 3.1363514e+01 s/b 3.13635e+01 Real32: -3.4430594e-01 s/b -3.44290e-01 Real33: 1.5684987e+00 s/b 1.56850e+00 Real34: 1.4110019e+00 s/b 1.41100e+00 Real35: 6.0758746e+00 s/b 6.07587e+00 Real36: 435 s/b 435 Real37: 984 s/b 984 Real38: 435 s/b 435 Real39: 1.2780520e+03 s/b 1.278052e+03 Real40: 2.3894600e+02 s/b 2.389460e+02 Real41: 1.0472018e+05 s/b 1.047202e+05 Real42: 7.2595975e-03 s/b 7.259598e-03 Real43: true s/b true Real44: false s/b false Real45: true s/b true Real46: false s/b false Real47: true s/b true Real48: false s/b false Real49: true s/b true Real50: false s/b false Real51: true s/b true Real52: true s/b true Real53: false s/b false Real54: true s/b true Real55: true s/b true Real56: false s/b false Real57: 3.4930000e+01 s/b 3.493000e+01 Real58: 5.4756000e+00 s/b 5.475600e+00 Real59: 9.7233328e+01 s/b 9.723333e+01 Real60: 3.3114727e-01 s/b 3.311461e-01 Real61: 1.5678826e+00 s/b 1.567883e+00 Real62: 1.3937528e+00 s/b 1.393753e+00 Real63: 4.4214877e+00 s/b 4.421488e+00 Real64: 24 s/b 24 Real65: 75 s/b 75 Real66: 83 s/b 83 Real67: 4.3330000e+01 s/b 4.333000e+01 Real68: 3.0034000e+02 s/b 3.003400e+02 Real69: 3.0034000e+02 s/b 3.003400e+02 Real70: -6.5999800e+03 s/b -6.599980e+03 Real71: -8.3687200e+03 s/b -8.368720e+03 Real72: 1.7687400e+03 s/b 1.768740e+03 Real73: -8.6690600e+03 s/b -8.669061e+03 Real74: -6.9003200e+03 s/b -6.900320e+03 Real75: -7.5955927e+05 s/b -7.595593e+05 Real76: -7.5955927e+05 s/b -7.595593e+05 Real77: 5.6052646e+06 s/b 5.605265e+06 Real78: -1.4090711e+00 s/b -1.409071e+00 Real79: -7.3796277e+00 s/b -7.379627e+00 Real80: 1.0398420e+01 s/b 1.039842e+01 Real81: true s/b true Real82: false s/b false Real83: true s/b true Real84: false s/b false Real85: true s/b true Real86: true s/b true Real87: false s/b false Real88: false s/b false Real89: true s/b true Real90: true s/b true Real91: false s/b false Real92: false s/b false Real93: true s/b true Real94: true s/b true Real95: true s/b true Real96: false s/b false Real97: false s/b false Real98: true s/b true Real99: true s/b true Real100: true s/b true Real101: false s/b false Real102: false s/b false Real103: 7.3420000e+02 s/b 7.34200e+02 Real104: 5.3904964e+05 s/b 5.39050e+05 Real105: -4.3483206e-01 s/b -4.34850e-01 Real106: -1.5694343e+00 s/b -1.56943e+00 Real107: 6.8056632e-01 s/b 6.80566e-01 Real108: -734 s/b -734 Real109: -7635 s/b -7635 Real110: -734 s/b -734 Real111: 1.5100000e+01 s/b 1.510000e+01 Real112: 4.5133000e+01 s/b 4.513300e+01 Real113: -3.8640000e+01 s/b -3.864000e+01 Real114: -3.6581000e+01 s/b -3.658100e+01 Real115: 3.5548000e+01 s/b 3.554800e+01 Real116: -4.9398400e+01 s/b -4.939840e+01 Real117: -4.4001000e+01 s/b -4.400100e+01 Real118: -2.6412232e+01 s/b -2.641223e+01 Real119: -1.4890414e+02 s/b -1.489041e+02 Real120: 5.5856325e+02 s/b 5.585632e+02 Real121: -5.2201566e+00 s/b -5.220157e+00 Real122: -1.7721625e+01 s/b -1.772163e+01 Real123: 4.2745824e+00 s/b 4.274582e+00 Real124: true s/b true Real125: false s/b false Real126: true s/b true Real127: false s/b false Real128: true s/b true Real129: true s/b true Real130: false s/b false Real131: false s/b false Real132: true s/b true Real133: true s/b true Real134: false s/b false Real135: false s/b false Real136: true s/b true Real137: true s/b true Real138: true s/b true Real139: false s/b false Real140: false s/b false Real141: true s/b true Real142: true s/b true Real143: true s/b true Real144: false s/b false Real145: false s/b false Real146: 6.8230000e+00 s/b 6.823000e+00 Real147 1.2125717e+05 s/b 1.212572e+05 Real148: 9.4212450e-01 s/b 9.421146e-01 Real149: -1.5706771e+00 s/b -1.570677e+00 Real150: 4.1715393e-01 s/b 4.171539e-01 Real151: -33 s/b -33 Real152: -843 s/b -843 Real153: -6244 s/b -6244 Real154: -8.4220000e+01 s/b -8.422000e+01 Real155: 8.4220000e+01 s/b 8.422000e+01 Real156: -4.3330000e+01 s/b -4.333000e+01 Real157: 8.4220000e+01 s/b 8.422000e+01
*** sets **
Set1: 10101010101010101010 s/b 10101010101010101010 Set2: 1101110001 s/b 1101110001 Set3: 0100010000 s/b 0100010000 Set4: 0100001000 s/b 0100001000 Set5: false s/b false Set6: true s/b true Set7: true s/b true Set8: false s/b false Set9: true s/b true Set10: true s/b true Set11: false s/b false Set12: true s/b true Set13: true s/b true Set14: false s/b false Set15: 0101010000 s/b 0101010000 Set16: true s/b true Set17: a_c_e_g_i_k_m_o_qs s/b a_c_e_g_i_k_m_o_qs Set18: a_cd_fg_ s/b a_cdfg Set19: a__h s/b a____h Set20: b____j s/b _b____j Set21: false s/b false Set22: true s/b true Set23: true s/b true Set24: false s/b false Set25: true s/b true Set26: true s/b true Set27: false s/b false Set28: true s/b true Set29: true s/b true Set30: false s/b false Set31: ae__ s/b ae_____ Set32: 0101010101 s/b 0101010101 Set33: 1101110001 s/b 1101110001 Set34: 0100010000 s/b 0100010000 Set35: 0100001000 s/b 0100001000 Set36: false s/b false Set37: true s/b true Set38: true s/b true Set39: false s/b false Set40: true s/b true Set41: true s/b true Set42: false s/b false Set43: true s/b true Set44: true s/b true Set45: false s/b false Set46: 0110000000 s/b 0110000000 Set47: 01 s/b 01 Set48: 11 s/b 11 Set49: 10 s/b 10 Set50: 10 s/b 10 Set51: false s/b false Set52: true s/b true Set53: true s/b true Set54: false s/b false Set55: true s/b true Set56: true s/b true Set57: false s/b false Set58: true s/b true Set59: true s/b true Set60: false s/b false Set61: 11 s/b 11 set62: true s/b true set63: 1000000001 s/b 1000000001
*** Pointers **
Pointer1: 4594 s/b 4594
Pointer2: true s/b true
Pointer3: false s/b false
Pointer4: p s/b p
Pointer5: 5 s/b 5
Pointer6: 3 s/b 3
Pointer7: 17 s/b 17
Pointer8: 1234.5678 s/b 1234.5678
Pointer9: my word is s/b my word is
Pointer10: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11
Pointer11: 7234 y s/b 7234 y
Pointer12: _b_dij s/b _b_dij
Pointer13: 3732 s/b 3732
Pointer14: true s/b true
Pointer15: false s/b false
Pointer16: true s/b true
Pointer17: false s/b false
Pointer18: false s/b false
Pointer19: true s/b true
Pointer20: done s/b done
Pointer21: Pointer22: done s/b done
Pointer23: done s/b done
Pointer24:
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 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
s/b
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 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
Pointer25:
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 70
71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90
91 92 93 94 95 96 97 98 99 100
s/b
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
*** arrays **
Array1: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array2: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array3: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array4: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array5: false true false true false true false true false true s/b: false true false true false true false true false true Array6: false true false true false true false true false true s/b: false true false true false true false true false true Array7: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 s/b: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 Array8: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 s/b: 20.12 19.12 18.12 17.12 16.12 15.12 14.12 13.12 12.12 11.12 Array9: k j i h g f e d c b s/b k j i h g f e d c b Array10: k j i h g f e d c b s/b k j i h g f e d c b Array11: p o n m l k j i h g s/b p o n m l k j i h g Array12: p o n m l k j i h g s/b p o n m l k j i h g Array13: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array14: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array15: 5 4 3 2 s/b 5 4 3 2 Array16: 5 4 3 2 s/b 5 4 3 2 Array17: k j i h g f e d c b s/b k j i h g f e d c b Array18: k j i h g f e d c b s/b k j i h g f e d c b Array19: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b s/b: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b Array20: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b s/b: 20 k 19 j 18 i 17 h 16 g 15 f 14 e 13 d 12 c 11 b Array21: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array22: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array23: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array24: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array25: 11 10 s/b 11 10 Array26: 11 10 s/b 11 10 Array27: j i h g f e d c b a s/b j i h g f e d c b a Array28: j i h g f e d c b a s/b j i h g f e d c b a Array29: j i h g f e d c b a s/b j i h g f e d c b a Array30: j i h g f e d c b a s/b j i h g f e d c b a Array31: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array32: 9 8 7 6 5 4 3 2 1 0 s/b 9 8 7 6 5 4 3 2 1 0 Array33: 5 4 3 2 1 s/b 5 4 3 2 1 Array34: 5 4 3 2 1 s/b 5 4 3 2 1 Array35: 0 10 20 30 40 50 60 70 80 90 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 s/b 0 10 20 30 40 50 60 70 80 90 1 11 21 31 41 51 61 71 81 91 2 12 22 32 42 52 62 72 82 92 3 13 23 33 43 53 63 73 83 93 4 14 24 34 44 54 64 74 84 94 5 15 25 35 45 55 65 75 85 95 6 16 26 36 46 56 66 76 86 96 7 17 27 37 47 57 67 77 87 97 8 18 28 38 48 58 68 78 88 98 9 19 29 39 49 59 69 79 89 99 Array36: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 s/b: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Array37: hello, guy s/b hello, guy Array38: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array39: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 s/b: 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 Array40: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11 Array41: 30 29 28 27 26 25 24 23 22 21 s/b 30 29 28 27 26 25 24 23 22 21 Array42: 40 39 38 37 36 35 34 33 32 31 s/b 40 39 38 37 36 35 34 33 32 31 Array43: 22 21 20 19 18 17 16 15 14 13 s/b 22 21 20 19 18 17 16 15 14 13
*** records **
Record1:
64 false j 1 3 12 4.5451200e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
_bcdei
8454
s/b:
64 false j 1 3 12 4.54512000e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
bcdei_
8454
Record2:
64 false j 1 3 12 4.5451200e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
_bcdei
8454
s/b:
64 false j 1 3 12 4.54512000e-29 what ? who
21 22 23 24 25 26 27 28 29 30
2324 y
bcdei_
8454
Record3: 873 0 235 427 s/b 873 0 235 427
Record4: 873 1 true 427 s/b 873 1 true 427
Record5: 873 2 f 427 s/b 873 2 f 427
Record6: 873 3 8 427 s/b 873 3 8 427
Record7: 873 4 3 427 s/b 873 4 3 427
Record8: 873 5 12 427 s/b 873 5 12 427
Record9: 873 6 8734.8389 427 s/b 873 6 8734.8389 427
Record10: 873 7 this one ? 427 s/b 873 7 this one ? 427
Record11: 873 8 20 19 18 17 16 15 14 13 12 11 427
s/b: 873 8 20 19 18 17 16 15 14 13 12 11 427
Record12: 873 9 2387 t 427 s/b: 873 9 2387 t 427
Record13: 873 10 _igfedcb 427
s/b: 873 10 _igfedcb 427
Record14: 873 11 2394 427 s/b 873 11 2394 427
Record15: 10 2343 s/b 10 2343
Record16: 19 true s/b 19 true
Record17: true 2343 s/b true 2343
Record18: false true s/b false true
Record19: 2 2343 s/b 2 2343
Record20: 7 true s/b 7 true
Record21: 3 2343 s/b 3 2343
Record22: 4 true s/b 4 true
Record23: 42 s/b 42
Record24: 1 2 3 4 5 6 7 8 9 10 s/b 1 2 3 4 5 6 7 8 9 10
Record25: 10 9 8 7 6 5 4 3 2 1 s/b 10 9 8 7 6 5 4 3 2 1
Record26: 10 9 8 7 6 5 4 3 2 76 s/b 10 9 8 7 6 5 4 3 2 76
Record27: 1 g s/b 1 g
Record28: 20 19 18 17 16 15 14 13 12 11 s/b 20 19 18 17 16 15 14 13 12 11
Record29: 42 false true 1.23400000000000e+01 s/b 42 False True 1.234000000000000e+01
Record30: 185 s/b 185
*** files **
File1: 11 12 13 14 15 16 17 18 19 20 s/b 11 12 13 14 15 16 17 18 19 20
File2: 11 12 13 14 15 16 17 18 19 20 s/b 11 12 13 14 15 16 17 18 19 20
File3: true false true false true false true false true false
s/b: true false true false true false true false true false
File4: true false true false true false true false true false
s/b: true false true false true false true false true false
File5: a b c d e f g h i j s/b a b c d e f g h i j
File6: a b c d e f g h i j s/b a b c d e f g h i j
File7: 0 1 2 3 4 5 6 7 8 9 s/b 0 1 2 3 4 5 6 7 8 9
File8: 0 1 2 3 4 5 6 7 8 9 s/b 0 1 2 3 4 5 6 7 8 9
File9:
s/b:
7384
8342
true
false
m
q
1.2345678000e+00
1.2345678
5.6894321000e+01
0.93837632
hi there !
hi th
hi there !
file10:
7384
8342
m
q
1.2345678e+00
1.2345678e+00
5.6894321e+01
9.3837632e-01
s/b:
7384
8342
m
q
1.2345678000e+00
1.2345678000e+00
5.6894321000e+01
9.3837632000e-01
file11:
'' s/b 'how now
**** Procedures and functions **
ProcedureFunction1: 89 45 s/b 45 89 ProcedureFunction2: 46 s/b 46 ProcedureFunction3: total junk s/b total junk ProcedureFunction4: tota? junk s/b tota? junk total junk s/b total junk ProcedureFunction5: 35 s/b 35 ProcedureFunction6: 8 9 10 6 5 4 3 2 1 78 s/b: 10 9 8 6 5 4 3 2 1 78 ProcedureFunction7:
56 lines to go.
A quick list of loose ends:
19 lines to go.
pgen now passes the PAT test!
Next steps: compile and run the sample programs list.
7 sample_programs/hello.pas PASS
25 sample_programs/roman.pas PASS
42 sample_programs/qsort.pas PASS
101 sample_programs/match.pas FAIL
108 sample_programs/prime.pas PASS
339 sample_programs/fbench.pas FAIL
856 sample_programs/drystone.pas FAIL
973 sample_programs/startrek.pas FAIL
1352 sample_programs/basics.pas FAIL
1939 sample_programs/pascals.pas FAIL
Not bad for a first run. Obviously more work to do.
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ time sample_programs/prime
10 iterations
1899 primes
real 0m0.002s
user 0m0.002s
sys 0m0.000s
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ time p6 sample_programs/prime
Compiling sample_programs/prime...
P6 Pascal compiler vs. 0.2.x
Pascal-P6 complies with the requirements of Pascaline version 0.4
and the following annexes: A,B,C,E.
1 -8 (*$l-
Errors in program: 0
P6 Pascal interpreter vs. 0.2.x
Assembling/loading program
Running program
10 iterations
1899 primes
program complete
real 0m1.051s
user 0m1.041s
sys 0m0.010s
And of course, what you all wanted to see, didn't you?
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ gpc -g --classic-pascal-level-0 --no-warnings sample_programs/prime.pas -L/usr/lib/gcc/x86_64-linux-gnu/9
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ time sample_programs/prime
100000 iterations
1899 primes
real 0m10.795s
user 0m10.789s
sys 0m0.004s
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ pe sample_programs/prime
Compiling sample_programs/prime...
P6 Pascal compiler vs. 0.2.x
Pascal-P6 complies with the requirements of Pascaline version 0.4
and the following annexes: A,B,C,E.
1 -8 (*$l-
Errors in program: 0
P6 Pascal AMD64/gcc 64 bit code generator vs. 0.2.x
Generating program
Program generation complete
/usr/bin/ld: /tmp/ccXBm57u.o: in function `resetfn':
/home/samiam/projects/pascal/pascal-p6/source/AMD64/gcc/psystem.c:1689: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ time sample_programs/prime
100000 iterations
1899 primes
real 0m10.842s
user 0m10.835s
sys 0m0.004s
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$
Ok, ok, before you go running off to report this result, here are the caveats.
Yes, the times are roughly equal. This is an accident. I did nothing to arrange that. I expected GPC to do much better. I reran gpc with -g3 and didn't get much better results.
First, pgen is extremely unoptimized. Besides register allocation, it does virtually no optimizations, no constant folding, no access optimization, no common subexpression elimination, etc. Please don't go reporting the results as "Pascal-P6 is slow blah blah blah". Those things are hard to undo.
Second, my machine is a monster. It literally heats up the room when it is on. Thus these are probably ideal execution times and not common on most computers.
Third, the checks in the code were not turned off (invalid pointers, array overflow, etc.). So this code would execute even slower.
Alright, lets nail this to the wall:
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ fpc -Miso sample_programs/prime.pas
Free Pascal Compiler version 3.2.2 [2021/05/16] for x86_64
Copyright (c) 1993-2021 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling sample_programs/prime.pas
prime.pas(1,3) Warning: Unsupported switch "$L"
Linking sample_programs/prime
109 lines compiled, 0.0 sec
1 warning(s) issued
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6$ time sample_programs/prime
100000 iterations
1899 primes
real 0m8.423s
user 0m8.422s
sys 0m0.000s
So, ok, fun is over, time for real work.
That fpc benchmark score will be easy to beat. But then IP Pascal always beat FPC (ahem), so that is not a surprise to me.
Similarly, the gpc score is not a surprise. It WAS, the first time I saw it, because you woulda thunk that using the gcc backend would score way better than this. The reason for it, which the gpc authors have gone over, is that gpc/pascal was poorly matched to the gcc backend. gcc, the developer group, has always been hostile to Pascal. gcc was in fact, originally programmed in Pascal. The original developers believed C to be an inappropriate language to develop a compiler in (shoulda stuck with that opinion eh?). However, in those and subsequent days Pascal was considered a competitor to C. As C became the dominant language, the hostility to Pascal only increased. Don't believe me? Look at how GNU treats their Fortran, objective C, APL or other compiler front ends for gcc. gpc has always been an ignored stepsister for gcc group. And eventually this killed off gpc.
In any case, I always wanted Pascal-P6 to execute faster than gpc for the simple reason that I wanted nobody to feel that going from gpc to Pascal-P6 would be a step down. And recall that Pascal-P6 is a "medium to low" performing compiler. It does not turn out the performance of a C compiler, or IP Pascal. IP Pascal is at least an order of magnitude bigger in source code size that Pascal-P6.
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6/sample_programs$ gcc prime.c -o prime
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6/sample_programs$ ./prime
100000 iterations:
1899 primes
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6/sample_programs$ time ./prime
100000 iterations:
1899 primes
real 0m6.815s
user 0m6.813s
sys 0m0.000s
This gives you a nice bracket for expectations. You aren't going to beat gcc.
I couldn't find a prime.c program, so I made one just now. Took me all of 15 minutes.
Ya knew I wasn't going to stop with the benchmarks, now didn't ya?
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6/sample_programs$ clang -g3 prime.c -o prime
samiam@samiam-h-pc-2:~/projects/pascal/pascal-p6/sample_programs$ time ./prime
100000 iterations:
1899 primes
real 0m8.043s
user 0m8.041s
sys 0m0.000s
A bit slower than gcc.
Fixed match.pas
7 sample_programs/hello.pas PASS
25 sample_programs/roman.pas PASS
42 sample_programs/qsort.pas PASS
101 sample_programs/match.pas PASS
108 sample_programs/prime.pas PASS
339 sample_programs/fbench.pas FAIL
856 sample_programs/drystone.pas FAIL
973 sample_programs/startrek.pas FAIL
1352 sample_programs/basics.pas FAIL
1939 sample_programs/pascals.pas FAIL
Ok, so for anyone following this, its a reasonable question to ask. Why didn't the PAT find all the bugs in pgen?
The purpose of the PAT, or Pascal Acceptance Test, is to cover all of the features of ISO 7185 Pascal. It doesn't, however, cover combinations of uses of those features, which is an infinite set. No test, in fact, does or can do that. Now having said that, the PAT should make an effort to test combinations, and that is noted in the test. It turns out this is a famous and intractable problem.
There are two approaches, or three if you consider the defacto solution. The first is just to write tests for as many combinations as you can think of. In the case of the PAT, this would be things like repeating all of the integer tests with integers in arrays, integers in records, integers as a result of functions, etc. Then tests for nested control structures, and on and on. It needs doing. The PAT could be better.
The second approach, the "rocket science" approach, is to write a program that generates various constructs in the target language in combination. Ideally, such a program would also write a way to check the results. Because such a program could generate potentially huge checker files, it could far exceed what a human could write.
The defacto solution is the way compilers are actually checked, which is to do the best possible job of creating an acceptance test, followed by a series of actual programs. Programs like, for instance, the compiler itself, or large application programs, etc. This is one reason why languages that self compile are considered better than languages that do not.
Anyways, that is a long winded explanation of why, even after the PAT passes, there is more work to do.
I upgraded the scripts to work with pgen. Now:
pe file
is equivalent to:
compile --pgen file
"run --pgen file" will execute the compiled binary, but it is equivalent to just running the file, but with the exception of taking the input and output from/to a file. See the manual for more information. Plugging pgen into the compile and run scripts is there to enable to testing framework to operate.
Regressions with pgen are a work in progress.
Upgrading the scripts allows pgen to integrate with the existing test framework, and thus I don't have to manually test pgen anymore. However, that system isn't really designed to be a make system. That will happen later with the pc integrator.
The scripts that are now --pgen compliant are:
p6 compile run testprog regress
regress will not execute a pgen regression unless specifically selected. Similarly, package mode remains to be checked.
Note:
One thing I am trying to do here at the same time is bring the package mode up to run a full regression. This has two reasons for it. First, it needs doing. Second, the run parameters of that are similar to pgen, it is a stand alone executable. Thus integrating that to the framework helps pgen integrate as well.
The scripts run and testprog were refactored so that the input to prd is supplied by
This makes more sense, because it is possible, say for pascals.pas, that both the input file and the prd file could be in use, if a program pascals compiles expects input.
This also means that pascals can be tested with testprog itself instead of a specialized script, so the testpascals script will be depreciated.
The package mode now runs a full regression, and has been included in the default regression. It has times similar to cmach mode, which makes sense, because it is based on cmach code.
The pe script is removed. The equivalent script to pe is:
compile --pgen
And it generates an executable.
Based on failures seen when attempting to self host, I reran the --full regression (it takes an overnight run), and observed failures..
Starting off the next project, which is a 80386 (32 bit) code generation facility for P6. This is very preliminary, and the code and the documentation are subject to change. If you would like to help, that would be encouraged. I have committed a preliminary code module, pgen_gcc_i80386.pas. The documentation has also got a new section that discusses the project, so if you want to know more, read that.