gdb/fortran/testsuite: add complex from integers test
authorNils-Christian Kempke <nils-christian.kempke@intel.com>
Mon, 11 Apr 2022 12:06:56 +0000 (14:06 +0200)
committerNils-Christian Kempke <nils-christian.kempke@intel.com>
Mon, 11 Apr 2022 12:06:56 +0000 (14:06 +0200)
When working on the files I noted that there was no actual test for a
COMPLEX built from two INTEGERS.  I added that now for completion.

gdb/testsuite/gdb.fortran/complex.exp
gdb/testsuite/gdb.fortran/complex.f90

index f4a80fbf783c8f93f32144b8cd43f212b4ca7213..ca41c812364ffa2064010610a9f8106e5c11855d 100644 (file)
@@ -41,6 +41,7 @@ gdb_test "print c8" " = \\(321,-22\\)"
 gdb_test "print dc" " = \\(321,-22\\)"
 
 gdb_test "print c16" " = \\(-874,19\\)"
+gdb_test "print ci" " = \\(-4,12\\)"
 
 gdb_test "whatis c" "type = $complex4"
 gdb_test "print \$_creal (c)" " = 1000"
@@ -70,3 +71,8 @@ with_test_prefix "c16" {
     gdb_test "whatis \$" " = real\\*16"
 }
 
+gdb_test "whatis ci" "type = $complex4"
+gdb_test "print \$_creal (ci)" " = -4"
+with_test_prefix "ci" {
+    gdb_test "whatis \$" " = real\\*4"
+}
index 5c9491df0239bfb195317f2bcee400e174f35f16..cd1acecad54091a5e13e68eb69c97ec6a1ec2af4 100644 (file)
@@ -17,8 +17,9 @@ program test_complex
   real*4 r4a, r4b
   real*8 r8a, r8b
   real*16 r16a, r16b
+  integer ia, ib
 
-  complex c
+  complex c, ci
   complex(kind=4) c4
   complex(kind=8) c8
   double complex dc
@@ -30,15 +31,19 @@ program test_complex
   r8b = -22
   r16a = -874
   r16b = 19
+  ia = -4
+  ib = 12
 
   c = cmplx(r4a,r4b)
   c4 = cmplx(r4a,r4b)
   c8 = cmplx(r8a, r8b)
   dc = cmplx(r8a, r8b)
   c16 = cmplx(r16a, r16b)
+  ci = cmplx(ia, ib)
 
   print *, c, c4, c8, dc, c16  ! stop
   print *, r4a, r4b
   print *, r8a, r8b
   print *, r16a, r16b
+  print *, ia, ib
 end program test_complex