summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tbf/tb0274.pp8
-rw-r--r--tests/webtbf/tw38771.pp22
-rw-r--r--tests/webtbs/tw38353.pp42
-rw-r--r--tests/webtbs/tw38631.pp23
-rw-r--r--tests/webtbs/tw38766.pp28
-rw-r--r--tests/webtbs/tw38802.pp24
6 files changed, 147 insertions, 0 deletions
diff --git a/tests/tbf/tb0274.pp b/tests/tbf/tb0274.pp
new file mode 100644
index 0000000000..4749726510
--- /dev/null
+++ b/tests/tbf/tb0274.pp
@@ -0,0 +1,8 @@
+{ %fail }
+{ %opt=-Sew }
+var
+ c : comp;
+
+begin
+ c:=123.123;
+end.
diff --git a/tests/webtbf/tw38771.pp b/tests/webtbf/tw38771.pp
new file mode 100644
index 0000000000..1d041847a2
--- /dev/null
+++ b/tests/webtbf/tw38771.pp
@@ -0,0 +1,22 @@
+{ %FAIL }
+{$mode objfpc}
+
+program tw38771;
+
+type
+ TMyClass = class
+ generic procedure DoThis<T>(msg: T);
+ generic procedure DoThat<T>(msg: T); virtual;
+ end;
+
+generic procedure TMyClass.DoThis<T>(msg:T);
+begin
+ specialize DoThat<T>(msg);
+end;
+
+generic procedure TMyClass.DoThat<T>(msg: T);
+begin
+end;
+
+begin
+end.
diff --git a/tests/webtbs/tw38353.pp b/tests/webtbs/tw38353.pp
new file mode 100644
index 0000000000..2d57fbe30a
--- /dev/null
+++ b/tests/webtbs/tw38353.pp
@@ -0,0 +1,42 @@
+{ %OPT=-Cg -O2 }
+{ %CPU=x86_64 }
+
+{ -Cg and -O2 options together lead to
+ the generation of instruction:
+ testq $15,U_$P$VECTORCALL_HVA_TEST1_$$_HVA@GOTPCREL(%rip)
+ for which the relocation was not correctly generated
+ in the internal assembler }
+
+program tw38353;
+
+{$IFNDEF CPUX86_64}
+ {$FATAL This test program can only be compiled on Windows or Linux 64-bit with an Intel processor }
+{$ENDIF}
+
+{$ASMMODE Intel}
+{$PUSH}
+{$CODEALIGN RECORDMIN=16}
+{$PACKRECORDS C}
+type
+ TM128 = record
+ case Byte of
+ 0: (M128_F32: array[0..3] of Single);
+ 1: (M128_F64: array[0..1] of Double);
+ end;
+{$POP}
+
+var
+ HVA: TM128;
+
+begin
+{$ifdef verbose}
+ writeln('@HVA=',hexstr(ptruint(@HVA),2*sizeof(ptruint)));
+{$endif verbose}
+ if (PtrUInt(@HVA) and $F) <> 0 then
+ begin
+{$ifdef verbose}
+ WriteLn('FAIL: HVA is not correctly aligned.');
+{$endif verbose}
+ Halt(1);
+ end;
+end.
diff --git a/tests/webtbs/tw38631.pp b/tests/webtbs/tw38631.pp
new file mode 100644
index 0000000000..76448e4516
--- /dev/null
+++ b/tests/webtbs/tw38631.pp
@@ -0,0 +1,23 @@
+{$mode objfpc}
+program msec_test1;
+uses sysutils;
+
+var
+ D: TDateTime;
+ T, T1, T2: TTimeStamp;
+ MS: Comp;
+begin
+ D:=EncodeDate(2021, 03, 16) + EncodeTime(14, 02, 15, 1);
+ WriteLn('DATE: ', DateTimeToStr(D));
+
+ T:=DateTimeToTimeStamp(D);
+ WriteLn(' T.Date=',T.Date,' T.Time=', T.Time);
+ MS:=TimeStampToMSecs(T);
+ T1:=MSecsToTimeStamp(MS);
+ WriteLn('T1.Date=',T1.Date,' T1.Time=', T1.Time);
+
+ WriteLn('DATE1: ', DateTimeToStr(TimeStampToDateTime(T1)));
+ if TimeStampToDateTime(T1)<>D then
+ halt(1);
+ writeln('ok')
+end.
diff --git a/tests/webtbs/tw38766.pp b/tests/webtbs/tw38766.pp
new file mode 100644
index 0000000000..7393d00f91
--- /dev/null
+++ b/tests/webtbs/tw38766.pp
@@ -0,0 +1,28 @@
+{$mode objfpc}
+
+type
+ trec = record
+ x, y: longint;
+ end;
+
+function max(x,y: longint): longint;
+begin
+ if x>y then
+ result:=x
+ else
+ result:=y;
+end;
+
+function test: trec; inline;
+begin
+ result.x:=1;
+ result.y:=2;
+ result.x:=max(result.x,result.y);
+end;
+
+begin
+ if test.x<>2 then
+ halt(1);
+ if test.y<>2 then
+ halt(2);
+end.
diff --git a/tests/webtbs/tw38802.pp b/tests/webtbs/tw38802.pp
new file mode 100644
index 0000000000..87237eb77b
--- /dev/null
+++ b/tests/webtbs/tw38802.pp
@@ -0,0 +1,24 @@
+{$mode objfpc} {$h+} {$macro on}
+
+begin
+ // Warning: Expanding of macros exceeds a depth of 16.
+ // If macros contain any source code (barring comments and directives) — even 'begin end;', this will compile.
+ {$define do_A :=}
+ {$define do_B :=}
+ {$define do_C :=}
+ {$define do_D :=}
+ {$define do_E :=}
+ {$define do_F :=}
+ {$define do_G :=}
+ {$define do_H :=}
+ {$define do_I :=}
+ {$define do_J :=}
+ {$define do_K :=}
+ {$define do_L :=}
+ {$define do_M :=}
+ {$define do_N :=}
+ {$define do_O :=}
+ {$define do_P :=}
+ {$define do_Q :=}
+ do_A do_B do_C do_D do_E do_F do_G do_H do_I do_J do_K do_L do_M do_N do_O do_P do_Q
+end.