File gpc-fix_tests.patch of Package gpc-test

--- gcc-3.4.6/gcc/p/test/awindtes.pas	2007-09-04 07:22:54.000000000 +0100
+++ gcc-3.4.6/gcc/p/test/awindtes.pas.new	2018-09-16 13:42:50.260105045 +0100
@@ -10,6 +10,9 @@
   dt2 : TDateTime = (1999, 11, 29, 2, 36, 20);
   t : LongInt = 0;
   t2 : LongInt = $277d148a;
+  s1 : String(1024);
+  parent_found : Boolean = false;
+  self_dir_found : Boolean = false;
 
 procedure Error (const Msg : String);
 begin
@@ -20,9 +23,16 @@
 begin
   if DosError <> 0 then Error ('DosError <> 0');
   FindFirst ('*.*', faDirectory, s);
-  if (DosError <> 0) or (CString2String (s.Name) <> DirSelf) then Error ('`' + DirSelf + ''' not found');
-  FindNext (s);
-  if (DosError <> 0) or (CString2String (s.Name) <> DirParent) then Error ('`' + DirParent + ''' not found');
+  while (DosError = 0) and
+        (not(self_dir_found) or (not(parent_found))) do begin
+      s1 := CString2String (s.Name);
+      if s1 = DirSelf then self_dir_found := true;
+      if s1 = DirParent then parent_found := true;
+      FindNext(s);
+  end;
+  if DosError <> 0 then Error ('DosError <> 0');
+  if not(self_dir_found) then Error ('`' + DirSelf + ''' not found');
+  if not(parent_found) then Error ('`' + DirParent + ''' not found');
   PackTime (dt2, t);
   if t <> t then Error ('Error in PackTime');
   UnpackTime (t2, dt);
--- gcc-3.4.6/gcc/p/test/dostest.pas	2007-09-04 07:22:54.000000000 +0100
+++ gcc-3.4.6/gcc/p/test/dostest.pas.new	2018-09-16 13:47:02.830342925 +0100
@@ -12,6 +12,9 @@
   dt2 : DateTime = (1999, 11, 29, 2, 36, 20);
   t : LongInt = 0;
   t2 : LongInt = $277d148a;
+  s1 : String(1024);
+  parent_found : Boolean = false;
+  self_dir_found : Boolean = false;
 
 procedure Error (const Msg : String);
 begin
@@ -22,9 +25,16 @@
 begin
   if DosError <> 0 then Error ('DosError <> 0');
   FindFirst ('*.*', Directory, s);
-  if (DosError <> 0) or (s.Name <> DirSelf) then Error ('`' + DirSelf + ''' not found');
-  FindNext (s);
-  if (DosError <> 0) or (s.Name <> DirParent) then Error ('`' + DirParent + ''' not found');
+  while (DosError = 0) and
+        (not(self_dir_found) or (not(parent_found))) do begin
+      s1 := CString2String (s.Name);
+      if s1 = DirSelf then self_dir_found := true;
+      if s1 = DirParent then parent_found := true;
+      FindNext(s);
+  end;
+  if DosError <> 0 then Error ('DosError <> 0');
+  if not(self_dir_found) then Error ('`' + DirSelf + ''' not found');
+  if not(parent_found) then Error ('`' + DirParent + ''' not found');
   PackTime (dt2, t);
   if t <> t2 then Error ('Error in PackTime');
   UnpackTime (t2, dt);
--- gcc-3.4.6/gcc/p/test/fieldw.pas	2007-09-04 07:22:54.000000000 +0100
+++ gcc-3.4.6/gcc/p/test/fieldw.pas.new	2018-09-16 13:48:38.824713756 +0100
@@ -1,22 +1,27 @@
 Program FieldWidths;
 
-{ FLAG --field-widths=1:2:3:41:42 }
+{ FLAG --field-widths=35:37:33:41:42 }
 
 Var
   Foo: LongInt = 1000000000000000;
   Bar: LongReal = 3.14159265358979323846264338;
   S: String ( 42 );
+  long_foo : Boolean = sizeof(Foo) > sizeof(Integer);
+  long_bar : Boolean = sizeof(Bar) > sizeof(Real);
+  ok : Boolean = true;
 
 begin
-  WriteStr ( S, Foo );
-  if length ( S ) <> 41 then
-    writeln ( 'failed (Foo)' )
-  else
-    begin
-      WriteStr ( S, Bar );
-      if length ( S ) <> 42 then
-        writeln ( 'failed (Bar)' )
-      else
-        writeln ( 'OK' );
-    end { else };
+  WriteStr(S, Foo);
+  if (long_foo and (length(S) <> 41))
+     or (not(long_foo) and (length(S) <> 35))  then begin
+       writeln( 'failed (Foo)' );
+       ok := false;
+  end;
+  WriteStr(S, Bar);
+  if (long_bar and (length(S) <> 42))
+     or (not(long_bar) and (length(S) <> 37)) then begin
+        writeln( 'failed (Bar)' );
+        ok := false;
+  end;
+  if ok then writeln ( 'OK' );
 end.
--- gcc-3.4.6/gcc/p/test/fjf23.pas	2007-09-04 07:22:54.000000000 +0100
+++ gcc-3.4.6/gcc/p/test/fjf23.pas.new	2018-09-16 13:49:50.974496187 +0100
@@ -1,13 +1,14 @@
 Program fjf23;

+type MyLong = Cardinal attribute (Size = 32);
 Var
   a: Integer value -$80000000;
   S1, S2: String ( 20 );

 begin
-  WriteStr ( S1, ShortWord ( ( {$local R-} LongWord ( a ) {$endlocal} * 4 ) div $100000000 ) );
+  WriteStr ( S1, ShortWord ( ( {$local R-} MyLong ( a ) {$endlocal} * 4 ) div $100000000 ) );
            { 65534, should be 2 }
-  WriteStr ( S2, Word ( ( {$local R-} LongWord ( a ) {$endlocal} * 4 ) div $100000000 ) );
+  WriteStr ( S2, Word ( ( {$local R-} MyLong ( a ) {$endlocal} * 4 ) div $100000000 ) );
            { -2, should be 2 }
   if ( S1 = '2' ) and ( S2 = '2' ) then
     writeln ( 'OK' )
--- gcc-3.4.6/gcc/p/test/write2.inc	2007-09-04 07:22:55.000000000 +0100
+++ gcc-3.4.6/gcc/p/test/write2.inc.new	2018-09-16 13:50:43.671798060 +0100
@@ -168,7 +168,7 @@
   str(s);
   sti('1234567899', SizeOf (MedInt) > SizeOf (Integer));
   str(s);
-  sti('-7890123456789012345',True);
+  sti('-7890123456789012345', SizeOf (Integer) < 8);
   l;
   sti('234',False);
   str(s);
@@ -178,7 +178,7 @@
   str(s);
   sti('2345678902',SizeOf (MedCard) > SizeOf (Cardinal));
   str(s);
-  sti('12345678901234567890',True);
+  sti('12345678901234567890', SizeOf (Integer) < 8);
   l;
 end;
 
openSUSE Build Service is sponsored by