From: Mikael Morin <mikael@gcc.gnu.org>
To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [PATCH 3/3] testsuite: Use distinct explicit error codes in value_9.f90
Date: Wed, 9 Aug 2023 22:21:22 +0200 [thread overview]
Message-ID: <20230809202122.695376-4-mikael@gcc.gnu.org> (raw)
In-Reply-To: <20230809202122.695376-1-mikael@gcc.gnu.org>
Use distinct error codes, so that we can spot directly from the
testsuite log which case is failing.
gcc/testsuite/ChangeLog:
* gfortran.dg/value_9.f90 (val, val4, sub, sub4): Take the error
codes from the arguments.
(p): Update calls: pass explicit distinct error codes.
---
gcc/testsuite/gfortran.dg/value_9.f90 | 108 +++++++++++++-------------
1 file changed, 56 insertions(+), 52 deletions(-)
diff --git a/gcc/testsuite/gfortran.dg/value_9.f90 b/gcc/testsuite/gfortran.dg/value_9.f90
index 1a2fa80ed0d..4813250ebaa 100644
--- a/gcc/testsuite/gfortran.dg/value_9.f90
+++ b/gcc/testsuite/gfortran.dg/value_9.f90
@@ -20,78 +20,82 @@ program p
! Check len=1 actual argument cases first
ca = "a"; cp = "b"; cd = "c"
ca4 = 4_"d"; cp4 = 4_"e"; cd4 = 4_"f"
- call val ("B","B")
- call val ("A",char(65))
- call val ("A",char(a))
- call val ("A",mychar(65))
- call val ("A",mychar(a))
- call val ("1",c)
- call val ("1",(c))
- call val4 (4_"C",4_"C")
- call val4 (4_"A",char(65,kind=4))
- call val4 (4_"A",char(a, kind=4))
- call val4 (4_"4",c4)
- call val4 (4_"4",(c4))
- call val (ca,ca)
- call val (cp,cp)
- call val (cd,cd)
- call val (ca,(ca))
- call val4 (ca4,ca4)
- call val4 (cp4,cp4)
- call val4 (cd4,cd4)
- call val4 (cd4,(cd4))
- call sub ("S")
- call sub4 (4_"T")
+ call val ("B","B", 1, 2)
+ call val ("A",char(65), 3, 4)
+ call val ("A",char(a), 5, 6)
+ call val ("A",mychar(65), 7, 8)
+ call val ("A",mychar(a), 9, 10)
+ call val ("1",c, 11, 12)
+ call val ("1",(c), 13, 14)
+ call val4 (4_"C",4_"C", 15, 16)
+ call val4 (4_"A",char(65,kind=4), 17, 18)
+ call val4 (4_"A",char(a, kind=4), 19, 20)
+ call val4 (4_"4",c4, 21, 22)
+ call val4 (4_"4",(c4), 23, 24)
+ call val (ca,ca, 25, 26)
+ call val (cp,cp, 27, 28)
+ call val (cd,cd, 29, 30)
+ call val (ca,(ca), 31, 32)
+ call val4 (ca4,ca4, 33, 34)
+ call val4 (cp4,cp4, 35, 36)
+ call val4 (cd4,cd4, 37, 38)
+ call val4 (cd4,(cd4), 39, 40)
+ call sub ("S", 41, 42)
+ call sub4 (4_"T", 43, 44)
! Check that always the first character of the string is finally used
- call val ( "U++", "U--")
- call val4 (4_"V**",4_"V//")
- call sub ( "WTY")
- call sub4 (4_"ZXV")
- call val ( "234", d )
- call val4 (4_"345", d4 )
- call val ( "234", (d) )
- call val4 (4_"345", (d4) )
- call val ( "234", d (1:2))
- call val4 (4_"345", d4(1:2))
- call val ( "234", d (1:l))
- call val4 (4_"345", d4(1:l))
- call val ("1",c // d)
- call val ("1",trim (c // d))
- call val4 (4_"4",c4 // d4)
- call val4 (4_"4",trim (c4 // d4))
+ call val ( "U++", "U--", 45, 46)
+ call val4 (4_"V**",4_"V//", 47, 48)
+ call sub ( "WTY", 49, 50)
+ call sub4 (4_"ZXV", 51, 52)
+ call val ( "234", d , 53, 54)
+ call val4 (4_"345", d4 , 55, 56)
+ call val ( "234", (d) , 57, 58)
+ call val4 (4_"345", (d4) , 59, 60)
+ call val ( "234", d (1:2), 61, 62)
+ call val4 (4_"345", d4(1:2), 63, 64)
+ call val ( "234", d (1:l), 65, 66)
+ call val4 (4_"345", d4(1:l), 67, 68)
+ call val ("1",c // d, 69, 70)
+ call val ("1",trim (c // d), 71, 72)
+ call val4 (4_"4",c4 // d4, 73, 74)
+ call val4 (4_"4",trim (c4 // d4), 75, 76)
cd = "gkl"; cd4 = 4_"hmn"
- call val (cd,cd)
- call val4 (cd4,cd4)
- call sub (cd)
- call sub4 (cd4)
+ call val (cd,cd, 77, 78)
+ call val4 (cd4,cd4, 79, 80)
+ call sub (cd, 81, 82)
+ call sub4 (cd4, 83, 84)
deallocate (ca, cp, ca4, cp4, cd, cd4)
contains
- subroutine val (x, c)
+ subroutine val (x, c, err1, err2)
character(kind=1), intent(in) :: x ! control: pass by reference
character(kind=1), value :: c
+ integer, intent(in) :: err1, err2
print *, "by value(kind=1): ", c
- if (c /= x) stop 1
+ if (c /= x) stop err1
c = "*"
- if (c /= "*") stop 2
+ if (c /= "*") stop err2
end
- subroutine val4 (x, c)
+ subroutine val4 (x, c, err1, err2)
character(kind=4), intent(in) :: x ! control: pass by reference
character(kind=4), value :: c
+ integer, intent(in) :: err1, err2
print *, "by value(kind=4): ", c
- if (c /= x) stop 3
+ if (c /= x) stop err1
c = 4_"#"
- if (c /= 4_"#") stop 4
+ if (c /= 4_"#") stop err2
end
- subroutine sub (s)
+ subroutine sub (s, err1, err2)
character(*), intent(in) :: s
- call val (s, s)
+ integer, intent(in) :: err1, err2
+ call val (s, s, err1, err2)
end
- subroutine sub4 (s)
+ subroutine sub4 (s, err1, err2)
character(kind=4,len=*), intent(in) :: s
- call val4 (s, s)
+ integer, intent(in) :: err1, err2
+ call val4 (s, s, err1, err2)
end
character function mychar (i)
--
2.40.1
next prev parent reply other threads:[~2023-08-09 20:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 20:21 [PATCH 0/3] fortran: fix length one character dummy args [PR110419] Mikael Morin
2023-08-09 20:21 ` [PATCH 1/3] fortran: New predicate gfc_length_one_character_type_p Mikael Morin
2023-08-09 20:21 ` [PATCH 2/3] fortran: Fix length one character dummy arg type [PR110419] Mikael Morin
2023-08-09 20:21 ` Mikael Morin [this message]
2023-08-13 21:16 ` [PATCH 0/3] fortran: fix length one character dummy args [PR110419] Harald Anlauf
2023-08-14 19:47 ` Mikael Morin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230809202122.695376-4-mikael@gcc.gnu.org \
--to=mikael@gcc.gnu.org \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).