[4/4] gdb/fortran: Fix sizeof intrinsic for Fortran

Message ID 20220920072629.2736207-5-nils-christian.kempke@intel.com
State Superseded
Headers
Series Dynamic properties of pointers |

Commit Message

Kempke, Nils-Christian Sept. 20, 2022, 7:26 a.m. UTC
  The sizeof operator in Fortran behaves differently from e.g. C/Cpp in
that it can be applied to pointers.  We thus dereference pointers before
evaluating their size.  A test has been added for the Fortran sizeof
operator.
---
 gdb/eval.c                           |   3 +
 gdb/testsuite/gdb.fortran/sizeof.exp | 110 +++++++++++++++++++++++++++
 gdb/testsuite/gdb.fortran/sizeof.f90 | 108 ++++++++++++++++++++++++++
 3 files changed, 221 insertions(+)
 create mode 100644 gdb/testsuite/gdb.fortran/sizeof.exp
 create mode 100644 gdb/testsuite/gdb.fortran/sizeof.f90
  

Comments

Simon Marchi Sept. 26, 2022, 5:06 p.m. UTC | #1
On 2022-09-20 03:26, Nils-Christian Kempke via Gdb-patches wrote:
> The sizeof operator in Fortran behaves differently from e.g. C/Cpp in
> that it can be applied to pointers.  We thus dereference pointers before
> evaluating their size.  A test has been added for the Fortran sizeof
> operator.
> ---
>  gdb/eval.c                           |   3 +
>  gdb/testsuite/gdb.fortran/sizeof.exp | 110 +++++++++++++++++++++++++++
>  gdb/testsuite/gdb.fortran/sizeof.f90 | 108 ++++++++++++++++++++++++++
>  3 files changed, 221 insertions(+)
>  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.exp
>  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.f90
> 
> diff --git a/gdb/eval.c b/gdb/eval.c
> index ce1d883aa86..bb6b757d452 100644
> --- a/gdb/eval.c
> +++ b/gdb/eval.c
> @@ -2730,6 +2730,9 @@ evaluate_subexp_for_sizeof_base (struct expression *exp, struct type *type)
>    if (exp->language_defn->la_language == language_cplus
>        && (TYPE_IS_REFERENCE (type)))
>      type = check_typedef (TYPE_TARGET_TYPE (type));
> +  else if (exp->language_defn->la_language == language_fortran
> +	   && type->code () == TYPE_CODE_PTR)
> +    type = check_typedef (TYPE_TARGET_TYPE (type));

Do you need yo handle TYPE_CODE_REF for fortran too?

>    return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
>  }
>  
> diff --git a/gdb/testsuite/gdb.fortran/sizeof.exp b/gdb/testsuite/gdb.fortran/sizeof.exp
> new file mode 100644
> index 00000000000..f353e8c4dd9
> --- /dev/null
> +++ b/gdb/testsuite/gdb.fortran/sizeof.exp
> @@ -0,0 +1,110 @@
> +# Copyright 2022 Free Software Foundation, Inc.
> +
> +# This program is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 3 of the License, or
> +# (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program.  If not, see <http://www.gnu.org/licenses/> .
> +
> +# Testing GDB's implementation of SIZE keyword.
> +
> +if {[skip_fortran_tests]} { return -1 }
> +
> +standard_testfile ".f90"
> +load_lib fortran.exp
> +
> +if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
> +	 {debug f90}]} {
> +    return -1
> +}
> +
> +if ![fortran_runto_main] {
> +    return -1
> +}
> +
> +gdb_breakpoint [gdb_get_line_number "Test breakpoint"]
> +gdb_breakpoint [gdb_get_line_number "Past unassigned pointers"]
> +gdb_breakpoint [gdb_get_line_number "Final breakpoint"]
> +
> +set done_unassigned 0
> +set found_final_breakpoint 0
> +set test_count 0
> +while { $test_count < 200 } {
> +    with_test_prefix "test $test_count" {
> +	incr test_count
> +
> +	gdb_test_multiple "continue" "continue" {
> +	    -re -wrap "! Test breakpoint" {
> +		# We can run a test from here.
> +	    }
> +	    -re -wrap "! Past unassigned pointers" {
> +		# Done with testing unassigned pointers.
> +		set done_unassigned 1
> +		continue
> +	    }
> +	    -re -wrap "! Final breakpoint" {
> +		# We're done with the tests.
> +		set found_final_breakpoint 1
> +	    }
> +	}
> +
> +	if ($found_final_breakpoint) {
> +	    break
> +	}
> +
> +	# First grab the expected answer.
> +	set answer [get_valueof "" "answer" "**unknown**"]
> +
> +	# Now move up a frame and figure out a command for us to run
> +	# as a test.
> +	set command ""
> +	gdb_test_multiple "up" "up" {
> +	    -re -wrap "\r\n\[0-9\]+\[ \t\]+call test_sizeof \\((\[^\r\n\]+)\\)" {
> +		set command $expect_out(1,string)
> +	    }
> +	}
> +
> +	gdb_assert { ![string equal $command ""] } "found a command to run"
> +
> +	set is_pointer_to_array [string match "sizeof (*a_p)*" $command]
> +
> +	if {$done_unassigned || !$is_pointer_to_array} {
> +	    gdb_test "p $command" " = $answer"
> +	} else {
> +	    # Gfortran, ifx and ifort have slightly differnt behavior for
> +	    # unassigned pointers to arrays.  While ifx and ifort will print 0
> +	    # as the sizeof result, gfortran will print the size of the base
> +	    # type of the pointer/array.  Since the default behavior in GDB was
> +	    # to print 0 we keep this and make an exception for gfortran here.
> +	    gdb_test_multiple "p $command" "p $command" {
> +		-re -wrap " = $answer" {
> +		    pass $gdb_test_name
> +		}
> +		-re -wrap " = 0" {
> +		    pass $gdb_test_name
> +		}
> +	    }
> +	}
> +    }
> +}

Can you add some comments to explain what is going on here with the big
loop?  It's a bit of an unusual structure, so it would help to explain
it.

Simon
  
Terekhov, Mikhail via Gdb-patches Sept. 26, 2022, 5:22 p.m. UTC | #2
> -----Original Message-----
> From: Simon Marchi <simark@simark.ca>
> Sent: Monday, September 26, 2022 7:07 PM
> To: Kempke, Nils-Christian <nils-christian.kempke@intel.com>; gdb-
> patches@sourceware.org
> Cc: tom@tromey.com
> Subject: Re: [PATCH 4/4] gdb/fortran: Fix sizeof intrinsic for Fortran
> 
> 
> 
> On 2022-09-20 03:26, Nils-Christian Kempke via Gdb-patches wrote:
> > The sizeof operator in Fortran behaves differently from e.g. C/Cpp in
> > that it can be applied to pointers.  We thus dereference pointers before
> > evaluating their size.  A test has been added for the Fortran sizeof
> > operator.
> > ---
> >  gdb/eval.c                           |   3 +
> >  gdb/testsuite/gdb.fortran/sizeof.exp | 110
> +++++++++++++++++++++++++++
> >  gdb/testsuite/gdb.fortran/sizeof.f90 | 108
> ++++++++++++++++++++++++++
> >  3 files changed, 221 insertions(+)
> >  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.exp
> >  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.f90
> >
> > diff --git a/gdb/eval.c b/gdb/eval.c
> > index ce1d883aa86..bb6b757d452 100644
> > --- a/gdb/eval.c
> > +++ b/gdb/eval.c
> > @@ -2730,6 +2730,9 @@ evaluate_subexp_for_sizeof_base (struct
> expression *exp, struct type *type)
> >    if (exp->language_defn->la_language == language_cplus
> >        && (TYPE_IS_REFERENCE (type)))
> >      type = check_typedef (TYPE_TARGET_TYPE (type));
> > +  else if (exp->language_defn->la_language == language_fortran
> > +	   && type->code () == TYPE_CODE_PTR)
> > +    type = check_typedef (TYPE_TARGET_TYPE (type));
> 
> Do you need yo handle TYPE_CODE_REF for fortran too?
> 
> >    return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
> >  }
> >
> > diff --git a/gdb/testsuite/gdb.fortran/sizeof.exp
> b/gdb/testsuite/gdb.fortran/sizeof.exp
> > new file mode 100644
> > index 00000000000..f353e8c4dd9
> > --- /dev/null
> > +++ b/gdb/testsuite/gdb.fortran/sizeof.exp
> > @@ -0,0 +1,110 @@
> > +# Copyright 2022 Free Software Foundation, Inc.
> > +
> > +# This program is free software; you can redistribute it and/or modify
> > +# it under the terms of the GNU General Public License as published by
> > +# the Free Software Foundation; either version 3 of the License, or
> > +# (at your option) any later version.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License
> > +# along with this program.  If not, see <http://www.gnu.org/licenses/> .
> > +
> > +# Testing GDB's implementation of SIZE keyword.
> > +
> > +if {[skip_fortran_tests]} { return -1 }
> > +
> > +standard_testfile ".f90"
> > +load_lib fortran.exp
> > +
> > +if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
> > +	 {debug f90}]} {
> > +    return -1
> > +}
> > +
> > +if ![fortran_runto_main] {
> > +    return -1
> > +}
> > +
> > +gdb_breakpoint [gdb_get_line_number "Test breakpoint"]
> > +gdb_breakpoint [gdb_get_line_number "Past unassigned pointers"]
> > +gdb_breakpoint [gdb_get_line_number "Final breakpoint"]
> > +
> > +set done_unassigned 0
> > +set found_final_breakpoint 0
> > +set test_count 0
> > +while { $test_count < 200 } {
> > +    with_test_prefix "test $test_count" {
> > +	incr test_count
> > +
> > +	gdb_test_multiple "continue" "continue" {
> > +	    -re -wrap "! Test breakpoint" {
> > +		# We can run a test from here.
> > +	    }
> > +	    -re -wrap "! Past unassigned pointers" {
> > +		# Done with testing unassigned pointers.
> > +		set done_unassigned 1
> > +		continue
> > +	    }
> > +	    -re -wrap "! Final breakpoint" {
> > +		# We're done with the tests.
> > +		set found_final_breakpoint 1
> > +	    }
> > +	}
> > +
> > +	if ($found_final_breakpoint) {
> > +	    break
> > +	}
> > +
> > +	# First grab the expected answer.
> > +	set answer [get_valueof "" "answer" "**unknown**"]
> > +
> > +	# Now move up a frame and figure out a command for us to run
> > +	# as a test.
> > +	set command ""
> > +	gdb_test_multiple "up" "up" {
> > +	    -re -wrap "\r\n\[0-9\]+\[ \t\]+call test_sizeof \\((\[^\r\n\]+)\\)" {
> > +		set command $expect_out(1,string)
> > +	    }
> > +	}
> > +
> > +	gdb_assert { ![string equal $command ""] } "found a command to
> run"
> > +
> > +	set is_pointer_to_array [string match "sizeof (*a_p)*" $command]
> > +
> > +	if {$done_unassigned || !$is_pointer_to_array} {
> > +	    gdb_test "p $command" " = $answer"
> > +	} else {
> > +	    # Gfortran, ifx and ifort have slightly differnt behavior for
> > +	    # unassigned pointers to arrays.  While ifx and ifort will print 0
> > +	    # as the sizeof result, gfortran will print the size of the base
> > +	    # type of the pointer/array.  Since the default behavior in GDB was
> > +	    # to print 0 we keep this and make an exception for gfortran here.
> > +	    gdb_test_multiple "p $command" "p $command" {
> > +		-re -wrap " = $answer" {
> > +		    pass $gdb_test_name
> > +		}
> > +		-re -wrap " = 0" {
> > +		    pass $gdb_test_name
> > +		}
> > +	    }
> > +	}
> > +    }
> > +}
> 
> Can you add some comments to explain what is going on here with the big
> loop?  It's a bit of an unusual structure, so it would help to explain
> it.
> 
> Simon

Sure, will be done in V2!

Thanks for the review!
Nils

Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
  
Terekhov, Mikhail via Gdb-patches Sept. 26, 2022, 5:24 p.m. UTC | #3
> -----Original Message-----
> From: Simon Marchi <simark@simark.ca>
> Sent: Monday, September 26, 2022 7:07 PM
> To: Kempke, Nils-Christian <nils-christian.kempke@intel.com>; gdb-
> patches@sourceware.org
> Cc: tom@tromey.com
> Subject: Re: [PATCH 4/4] gdb/fortran: Fix sizeof intrinsic for Fortran
> 
> 
> 
> On 2022-09-20 03:26, Nils-Christian Kempke via Gdb-patches wrote:
> > The sizeof operator in Fortran behaves differently from e.g. C/Cpp in
> > that it can be applied to pointers.  We thus dereference pointers before
> > evaluating their size.  A test has been added for the Fortran sizeof
> > operator.
> > ---
> >  gdb/eval.c                           |   3 +
> >  gdb/testsuite/gdb.fortran/sizeof.exp | 110
> +++++++++++++++++++++++++++
> >  gdb/testsuite/gdb.fortran/sizeof.f90 | 108
> ++++++++++++++++++++++++++
> >  3 files changed, 221 insertions(+)
> >  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.exp
> >  create mode 100644 gdb/testsuite/gdb.fortran/sizeof.f90
> >
> > diff --git a/gdb/eval.c b/gdb/eval.c
> > index ce1d883aa86..bb6b757d452 100644
> > --- a/gdb/eval.c
> > +++ b/gdb/eval.c
> > @@ -2730,6 +2730,9 @@ evaluate_subexp_for_sizeof_base (struct
> expression *exp, struct type *type)
> >    if (exp->language_defn->la_language == language_cplus
> >        && (TYPE_IS_REFERENCE (type)))
> >      type = check_typedef (TYPE_TARGET_TYPE (type));
> > +  else if (exp->language_defn->la_language == language_fortran
> > +	   && type->code () == TYPE_CODE_PTR)
> > +    type = check_typedef (TYPE_TARGET_TYPE (type));
> 
> Do you need yo handle TYPE_CODE_REF for fortran too?

I believe no - there is not concept for references in Fortran and such
a type having a TYPE_CODE_REF in Fortran would seem quite unexpected.

Nils
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
  

Patch

diff --git a/gdb/eval.c b/gdb/eval.c
index ce1d883aa86..bb6b757d452 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2730,6 +2730,9 @@  evaluate_subexp_for_sizeof_base (struct expression *exp, struct type *type)
   if (exp->language_defn->la_language == language_cplus
       && (TYPE_IS_REFERENCE (type)))
     type = check_typedef (TYPE_TARGET_TYPE (type));
+  else if (exp->language_defn->la_language == language_fortran
+	   && type->code () == TYPE_CODE_PTR)
+    type = check_typedef (TYPE_TARGET_TYPE (type));
   return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
 }
 
diff --git a/gdb/testsuite/gdb.fortran/sizeof.exp b/gdb/testsuite/gdb.fortran/sizeof.exp
new file mode 100644
index 00000000000..f353e8c4dd9
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/sizeof.exp
@@ -0,0 +1,110 @@ 
+# Copyright 2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/> .
+
+# Testing GDB's implementation of SIZE keyword.
+
+if {[skip_fortran_tests]} { return -1 }
+
+standard_testfile ".f90"
+load_lib fortran.exp
+
+if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+	 {debug f90}]} {
+    return -1
+}
+
+if ![fortran_runto_main] {
+    return -1
+}
+
+gdb_breakpoint [gdb_get_line_number "Test breakpoint"]
+gdb_breakpoint [gdb_get_line_number "Past unassigned pointers"]
+gdb_breakpoint [gdb_get_line_number "Final breakpoint"]
+
+set done_unassigned 0
+set found_final_breakpoint 0
+set test_count 0
+while { $test_count < 200 } {
+    with_test_prefix "test $test_count" {
+	incr test_count
+
+	gdb_test_multiple "continue" "continue" {
+	    -re -wrap "! Test breakpoint" {
+		# We can run a test from here.
+	    }
+	    -re -wrap "! Past unassigned pointers" {
+		# Done with testing unassigned pointers.
+		set done_unassigned 1
+		continue
+	    }
+	    -re -wrap "! Final breakpoint" {
+		# We're done with the tests.
+		set found_final_breakpoint 1
+	    }
+	}
+
+	if ($found_final_breakpoint) {
+	    break
+	}
+
+	# First grab the expected answer.
+	set answer [get_valueof "" "answer" "**unknown**"]
+
+	# Now move up a frame and figure out a command for us to run
+	# as a test.
+	set command ""
+	gdb_test_multiple "up" "up" {
+	    -re -wrap "\r\n\[0-9\]+\[ \t\]+call test_sizeof \\((\[^\r\n\]+)\\)" {
+		set command $expect_out(1,string)
+	    }
+	}
+
+	gdb_assert { ![string equal $command ""] } "found a command to run"
+
+	set is_pointer_to_array [string match "sizeof (*a_p)*" $command]
+
+	if {$done_unassigned || !$is_pointer_to_array} {
+	    gdb_test "p $command" " = $answer"
+	} else {
+	    # Gfortran, ifx and ifort have slightly differnt behavior for
+	    # unassigned pointers to arrays.  While ifx and ifort will print 0
+	    # as the sizeof result, gfortran will print the size of the base
+	    # type of the pointer/array.  Since the default behavior in GDB was
+	    # to print 0 we keep this and make an exception for gfortran here.
+	    gdb_test_multiple "p $command" "p $command" {
+		-re -wrap " = $answer" {
+		    pass $gdb_test_name
+		}
+		-re -wrap " = 0" {
+		    pass $gdb_test_name
+		}
+	    }
+	}
+    }
+}
+
+gdb_assert {$found_final_breakpoint} "ran all compiled in tests"
+
+# Here some more GDB specific tests that might fail with compilers.
+# GDB will print sizeof(1.4) = 8 while gfortran will probably print 4 but
+# GDB says ptype 1.4 is real*8 so the output is expected.
+
+gdb_test "ptype 1" "type = int"
+gdb_test "p sizeof(1)" "= 4"
+
+gdb_test "ptype 1.3" "type = real\\*8"
+gdb_test "p sizeof(1.3)" "= 8"
+
+gdb_test  "p sizeof ('asdsasd')" "= 7"
diff --git a/gdb/testsuite/gdb.fortran/sizeof.f90 b/gdb/testsuite/gdb.fortran/sizeof.f90
new file mode 100644
index 00000000000..60107e958e8
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/sizeof.f90
@@ -0,0 +1,108 @@ 
+! Copyright 2022 Free Software Foundation, Inc.
+
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3 of the License, or
+! (at your option) any later version.
+!
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+!
+! You should have received a copy of the GNU General Public License
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+module data
+  use, intrinsic :: iso_c_binding, only : C_SIZE_T
+  implicit none
+
+  character, target :: char_v
+  character (len=3), target :: char_a
+  integer, target :: int_v
+  integer, target, dimension(:,:) :: int_2da (3,2)
+  real*4, target :: real_v
+  real*4, target :: real_a(4)
+  real*4, target, dimension (:), allocatable :: real_a_alloc
+
+  character, pointer :: char_v_p
+  character (len=3), pointer :: char_a_p
+  integer, pointer :: int_v_p
+  integer, pointer, dimension (:,:) :: int_2da_p
+  real*4, pointer :: real_v_p
+  real*4, pointer, dimension(:) :: real_a_p
+  real*4, dimension(:), pointer :: real_alloc_a_p
+
+contains
+subroutine test_sizeof (answer)
+  integer(C_SIZE_T) :: answer
+
+  print *, answer ! Test breakpoint
+end subroutine test_sizeof
+
+subroutine run_tests ()
+  call test_sizeof (sizeof (char_v))
+  call test_sizeof (sizeof (char_a))
+  call test_sizeof (sizeof (int_v))
+  call test_sizeof (sizeof (int_2da))
+  call test_sizeof (sizeof (real_v))
+  call test_sizeof (sizeof (real_a))
+  call test_sizeof (sizeof (real_a_alloc))
+
+  call test_sizeof (sizeof (char_v_p))
+  call test_sizeof (sizeof (char_a_p))
+  call test_sizeof (sizeof (int_v_p))
+  call test_sizeof (sizeof (int_2da_p))
+  call test_sizeof (sizeof (real_v_p))
+  call test_sizeof (sizeof (real_a_p))
+  call test_sizeof (sizeof (real_alloc_a_p))
+end subroutine run_tests
+
+end module data
+
+program sizeof_tests
+  use iso_c_binding
+  use data
+
+  implicit none
+
+  allocate (real_a_alloc(5))
+
+  nullify (char_v_p)
+  nullify (char_a_p)
+  nullify (int_v_p)
+  nullify (int_2da_p)
+  nullify (real_v_p)
+  nullify (real_a_p)
+  nullify (real_alloc_a_p)
+
+  ! Test nullified
+  call run_tests ()
+
+  char_v_p => char_v ! Past unassigned pointers
+  char_a_p => char_a
+  int_v_p => int_v
+  int_2da_p => int_2da
+  real_v_p => real_v
+  real_a_p => real_a
+  real_alloc_a_p => real_a_alloc
+
+  ! Test pointer assignment
+  call run_tests ()
+
+  char_v = 'a'
+  char_a = "aaa"
+  int_v = 10
+  int_2da = reshape((/1, 2, 3, 4, 5, 6/), shape(int_2da))
+  real_v = 123.123
+  real_a_p = (/-1.1, -1.2, -1.3, -1.4/)
+  real_a_alloc = (/1.1, 2.2, 3.3, 4.4, 5.5/)
+
+  ! After allocate/value assignment
+  call run_tests ()
+
+  deallocate (real_a_alloc)
+
+  print *, "done" ! Final breakpoint
+
+end program sizeof_tests