Files
binutils-gdb/gdb/testsuite/gdb.fortran/short-circuit-argument-list.f90
Andrew Burgess 1d506c26d9 Update copyright year range in header of all files managed by GDB
This commit is the result of the following actions:

  - Running gdb/copyright.py to update all of the copyright headers to
    include 2024,

  - Manually updating a few files the copyright.py script told me to
    update, these files had copyright headers embedded within the
    file,

  - Regenerating gdbsupport/Makefile.in to refresh it's copyright
    date,

  - Using grep to find other files that still mentioned 2023.  If
    these files were updated last year from 2022 to 2023 then I've
    updated them this year to 2024.

I'm sure I've probably missed some dates.  Feel free to fix them up as
you spot them.
2024-01-12 15:49:57 +00:00

102 lines
3.3 KiB
Fortran

! Copyright 2018-2024 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/> .
! Source code for short-circuit-argument-list.exp.
module called_state
implicit none
type called_counts
integer :: function_no_arg_called = 0
integer :: function_no_arg_false_called = 0
integer :: function_one_arg_called = 0
integer :: function_two_arg_called = 0
integer :: function_array_called = 0
end type
type(called_counts) :: calls
end module called_state
logical function function_no_arg()
use called_state
implicit none
calls%function_no_arg_called = calls%function_no_arg_called + 1
function_no_arg = .TRUE.
end function function_no_arg
logical function function_no_arg_false()
use called_state
implicit none
calls%function_no_arg_false_called = calls%function_no_arg_false_called + 1
function_no_arg_false = .FALSE.
end function function_no_arg_false
logical function function_one_arg(x)
use called_state
implicit none
logical, intent(in) :: x
calls%function_one_arg_called = calls%function_one_arg_called + 1
function_one_arg = .TRUE.
end function function_one_arg
logical function function_two_arg(x, y)
use called_state
implicit none
logical, intent(in) :: x, y
calls%function_two_arg_called = calls%function_two_arg_called + 1
function_two_arg = .TRUE.
end function function_two_arg
logical function function_array(logical_array)
use called_state
implicit none
logical, dimension(4,2), target, intent(in) :: logical_array
logical, dimension(:,:), pointer :: p
calls%function_array_called = calls%function_array_called + 1
function_array = .TRUE.
end function function_array
program generate_truth_table
use called_state
implicit none
interface
logical function function_no_arg()
end function function_no_arg
logical function function_no_arg_false()
end function
logical function function_one_arg(x)
logical, intent(in) :: x
end function
logical function function_two_arg(x, y)
logical, intent(in) :: x, y
end function
logical function function_array(logical_array)
logical, dimension(4,2), target, intent(in) :: logical_array
end function function_array
end interface
logical, dimension (4,2) :: truth_table
logical :: a, b, c, d, e
character(2) :: binary_string
binary_string = char(0) // char(1)
truth_table = .FALSE.
truth_table(3:4,1) = .TRUE.
truth_table(2::2,2) = .TRUE.
a = function_no_arg() ! post_truth_table_init
b = function_no_arg_false()
c = function_one_arg(b)
d = function_two_arg(a, b)
e = function_array(truth_table)
print *, truth_table(:, 1), a, b, e
print *, truth_table(:, 2), c, d
end program generate_truth_table