aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2021-08-11 23:33:40 +0200
committerHans-Peter Nilsson <hp@axis.com>2021-08-12 14:10:12 +0200
commitfb0cd8f11167600f11034031ce190151a54a5a95 (patch)
tree6740635fab9145eb4550287ce09a86a262d4fbf3
parent04b4f3152593f85b05974528d1607619dd77d702 (diff)
downloadgcc-fb0cd8f11167600f11034031ce190151a54a5a95.zip
gcc-fb0cd8f11167600f11034031ce190151a54a5a95.tar.gz
gcc-fb0cd8f11167600f11034031ce190151a54a5a95.tar.bz2
gfortran.dg/PR82376.f90: Avoid matching a file-path
I had a file-path to sources with the substring "new" in it, and (only) this test regressed compared to results from another build without "new" in the name. The test does ! { dg-final { scan-tree-dump-times "new" 4 "original" } } i.e. the contents of the tree-dump-file .original needs to match the undelimited string "new" exactly four times. Very brittle. In the dump-file, there are three lines with calls to new: D.908 = new ((integer(kind=4) *) data); integer(kind=4) * new (integer(kind=4) & data) static integer(kind=4) * new (integer(kind=4) &); But, there's also a line, which for me and cris-elf looked like: _gfortran_runtime_error_at (&"At line 46 of file /X/xyzzynewfrob/gcc/testsuite/gfortran.dg/PR82376.f90"[1]{lb: 1 sz: 1}, &"Pointer actual argument \'new\' is not associated"[1]{lb: 1 sz: 1}); The fourth match is obviously intended to match this line, but only with *one* match, whereas the path can as above yield another hit. With Tcl, the regexp for matching the " " *and* the "'" *and* the "\" gets a bit unsightly, so I suggest just matching the "new" calls, which according to the comment in the test is the key point. You can't have a file-path with spaces and parentheses in a gcc build. I'm also making use of {} rather than "" needing one level of quoting; the "\(" is needed because the matched string is a regexp. testsuite: * gfortran.dg/PR82376.f90: Robustify match.
-rw-r--r--gcc/testsuite/gfortran.dg/PR82376.f905
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/testsuite/gfortran.dg/PR82376.f90 b/gcc/testsuite/gfortran.dg/PR82376.f90
index 07143ab..b99779c 100644
--- a/gcc/testsuite/gfortran.dg/PR82376.f90
+++ b/gcc/testsuite/gfortran.dg/PR82376.f90
@@ -2,7 +2,8 @@
! { dg-options "-fdump-tree-original -fcheck=pointer" }
!
! Test the fix for PR82376. The pointer check was doubling up the call
-! to new. The fix reduces the count of 'new' from 5 to 4.
+! to new. The fix reduces the count of 'new' from 5 to 4, or to 3, when
+! counting only calls.
!
! Contributed by José Rui Faustino de Sousa <jrfsousa@gmail.com>
!
@@ -56,4 +57,4 @@ contains
end subroutine set
end program main_p
-! { dg-final { scan-tree-dump-times "new" 4 "original" } }
+! { dg-final { scan-tree-dump-times { new \(} 3 "original" } }