Browse Source

+ several files for bugs that should fail

pierre 27 years ago
parent
commit
b39d738e62

+ 5 - 1
tests/README

@@ -27,7 +27,11 @@ ts010015.pp       tests typed files.
 ts010016.pp       tests conversion of smallsets in normsets in consts 
 ts010017.pp       tests the problem of iocheck inside iocheck routines
 ts010018.pp       tests the problem of enums inside objects
-
+ts010019.pp	  tests problems of name mangling
+ts010020.pp	  tests for const strings problems if const is a single char.
+ts010021.pp	  test for long mangled names (they are strings, ie no longer then
+		  255 chars (but they have to be allways shorten the same way !!)
+ts010022.pp       tests a problem of writing pchar in files
 ts10100.pp        tests for delphi object model
 -
 ts101xx.pp

+ 1 - 1
tests/readme.txt

@@ -4,7 +4,7 @@
   with compilation and execution tests.
 
   Standard way :
-  'make all' will try to compile all the sources
+  'make tests' will try to compile all the sources
    will printout a list of errors
   - programs that do not compile but should
   - programs that do compile when they should create an error !

+ 9 - 0
tests/tbf0036.pp

@@ -0,0 +1,9 @@
+program bug0036;
+
+{Discovered by Daniel Mantione.}
+
+var	a:array[0..31] of char;
+
+begin
+   a:=' ';	{Incorrect Pascal statement, but why a protection error?}
+end.

+ 21 - 0
tests/tbf0060.pp

@@ -0,0 +1,21 @@
+Program Test;
+
+{ No errors -- problems is due to the fact that the rules for type 
+compatibility (p.47 language guide) -- are not respected, in other words 
+in case statements there is no type checking whatsoever in fpc!!
+ I think that these are separate cases:
+   1st case) s32bit,u32bit,u8bit,s8bit,s16bit,u16bit
+   2nd case) uchar
+   3rd case) bool8bit
+These are not /should not be compatible with each other in a case 
+statement imho - CEC 
+}
+
+var
+ myvar:char;
+Begin
+ case myvar of
+ 1: ;
+ #2: ;
+ end;
+end.

+ 3 - 0
tests/tbf0061.pp

@@ -0,0 +1,3 @@
+Begin
+ 55ms;
+end.

+ 3 - 0
tests/tbf0085.pp

@@ -0,0 +1,3 @@
+Begin
+ writeln(l);
+end.

+ 15 - 0
tests/tbf0086.pp

@@ -0,0 +1,15 @@
+
+var
+ v: word;
+ w: shortint;
+ z: byte;
+ y: integer;
+
+type
+ zz: shortint = 255;  
+Begin
+ y:=64000;
+ z:=32767;
+ w:=64000;
+ v:=-1;
+end.

+ 15 - 0
tests/tbf0087.pp

@@ -0,0 +1,15 @@
+{
+  BP Error message is 'Pointer variable Expected'
+}
+type
+  tobj=object
+    l : longint;
+    constructor init;
+  end;
+var
+  o : tobj;
+begin
+  new(o);            {This will create a internal error 9999}
+  new(o,init);       {This will create a Segfault and Core Dump under linux}
+end.
+    

+ 3 - 0
tests/tbf0088.pp

@@ -0,0 +1,3 @@
+Begin
+ typeof(x1);    { Gives out an internal error -- better then 9999 though }
+end.

+ 3 - 0
tests/tbf0089.pp

@@ -0,0 +1,3 @@
+Begin
+ sizeof(x);
+end.

+ 20 - 0
tests/tbf0148.pp

@@ -0,0 +1,20 @@
+unit test;
+
+interface
+
+Function t(a: Byte): byte;
+Function DoT(b: byte): Byte;
+
+implementation
+
+Function t(a: Byte): Byte;
+var f: byte;
+Begin
+  DoT := f;
+End;
+
+Function DoT(b: byte): Byte;
+Begin
+End;
+
+end.

+ 17 - 0
tests/tbf0153.pp

@@ -0,0 +1,17 @@
+{$asmmode att}
+
+procedure asmfunc(p:pointer);assembler;
+asm
+{
+  this is changed into movl %eax,(%ebx+8) which is not correct, and tp7
+  also doesn't allow 'mov p[bx],ax' or 'mov p+bx,ax'
+
+  Solution: for parameters and locals the index must be turned off
+
+  Don't forget to check the intel assembler also
+}
+        movl    %eax,p(%ebx)
+end;
+
+begin
+end.

+ 8 - 0
tests/tbf0158.pp

@@ -0,0 +1,8 @@
+program tmp;
+
+var
+   Molo  :Boolean;
+
+begin
+   Molo := 1;     { This should give out a Type mismatch error ! }
+end.

+ 14 - 0
tests/tbf0164.pp

@@ -0,0 +1,14 @@
+type t1r = record
+             a, b: Byte;
+           end;
+     t2r = record
+             l1, l2: Array[1..4] Of t1r;
+           end;
+           
+           
+Var r: t2r;
+
+begin
+  with r.l1[counter] Do
+    Inc(a)
+end.

+ 10 - 0
tests/tbf0166.pp

@@ -0,0 +1,10 @@
+type
+  punknown=^unknown;
+  
+  t=object
+    procedure p(i:unknown);
+  end;
+
+begin
+end.
+  

+ 9 - 0
tests/tbf0167.pp

@@ -0,0 +1,9 @@
+type ObjTest = Object
+     End;
+
+Procedure ObjTest;
+Begin
+end;
+
+Begin
+end.

+ 6 - 0
tests/tbf0168.pp

@@ -0,0 +1,6 @@
+var bset: set of 0..31;
+    b: byte;
+
+Begin
+  bset := bset + b;
+End.

+ 11 - 0
tests/tbf0172.pp

@@ -0,0 +1,11 @@
+type
+  rec=record
+    a : longint;
+  end;
+    
+var
+  r1 : rec absolute $40:$49;
+begin
+  with r1 do
+   a:=1;
+end.     

+ 9 - 0
tests/tbf0173.pp

@@ -0,0 +1,9 @@
+var
+  secondbug : word;
+procedure p;assembler;
+begin
+  if secondbug=0 then;
+end;
+
+begin
+end.

+ 3 - 0
tests/ts010019.pp

@@ -1,3 +1,6 @@
+
+{ this program shows a possible problem 
+  of name mangling in FPC  (PM) }
   procedure test;
 
     function a : longint;