* [patch] Testsuite: Fortran: 6.8 regression + gfortran updates
@ 2008-12-08 18:16 Jan Kratochvil
2008-12-29 3:49 ` Joel Brobecker
0 siblings, 1 reply; 8+ messages in thread
From: Jan Kratochvil @ 2008-12-08 18:16 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 683 bytes --]
Hi,
there is a regression against gdb-6.8 for:
gdb.fortran/derived-type.exp: print p
due to the change
http://sourceware.org/ml/gdb-patches/2008-04/msg00383.html
http://sourceware.org/ml/gdb-cvs/2008-04/msg00135.html
as now Fortran struct is `( xxx )' instead of former `{ xxx}'.
But made there other updates to make it all PASS on Fedora
gcc-gfortran-4.3.2-7 (which AFAIK behaves more like gfortran-4.4 for these
types). Particularly gfortran now generates DW_TAG_string_type for character
arrays and also produces type names like `integer(kind=4)' while the testcase
expected `int4'.
Requesting approval (such as whether this dual acceptance is the right way).
Thanks,
Jan
[-- Attachment #2: gdbfortran-tests.patch --]
[-- Type: text/plain, Size: 2902 bytes --]
2008-12-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.fortran/subarray.exp: Expect also the strings type output.
* gdb.fortran/derived-type.exp: Likewise. Expect also the kind=X types.
Update for the f-valprint.c modification from 2008-04-22.
--- gdb/testsuite/gdb.fortran/derived-type.exp 1 Jan 2008 22:53:19 -0000 1.6
+++ gdb/testsuite/gdb.fortran/derived-type.exp 8 Dec 2008 18:04:34 -0000
@@ -42,23 +42,22 @@ if ![runto MAIN__] then {
}
gdb_test "ptype p" \
- "type = Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar" \
+ "type = Type bar.*int.*\:\: c.*real.*\:\: d.*End Type bar" \
"ptype p"
gdb_test "ptype q" \
- "type = Type foo.*real.*\:\: a.*Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar \:\: x.*character.*\\(7\\) \:\: b.*End Type foo" \
+ "type = Type foo.*real.*\:\: *a.*Type bar.*int.*\:\: *c.*real.*\:\: *d.*End Type bar \:\: *x.*character.*7.* \:\: *b.*End Type foo" \
"type-printing for derived type"
gdb_breakpoint [gdb_get_line_number "print"]
gdb_continue_to_breakpoint "print"
-gdb_test "print p" "\\$\[0-9\]+ = \\{ 1, 2.375\\}"
+gdb_test "print p" "\\$\[0-9\]+ = \\( 1, 2.375 \\)"
gdb_test "print p%c" "\\$\[0-9\]+ = 1"
gdb_test "print p%d" "\\$\[0-9\]+ = 2.375"
gdb_test "print q%a" "\\$\[0-9\]+ = 3.125"
-gdb_test "print q%b" "\\$\[0-9\]+ = \\(.*a.*b.*c.*d.*e.*f.*g.*\\)"
+gdb_test "print q%b" "\\$\[0-9\]+ = (\\(.*a.*b.*c.*d.*e.*f.*g.*\\)|'abcdefg')"
gdb_test "print q%x%c" "\\$\[0-9\]+ = 1"
gdb_test "print q%x%d" "\\$\[0-9\]+ = 2.375"
gdb_test "print q" \
- "\\$\[0-9\]+ = \\{ 3.125, \\{ 1, 2.375\\}, \\(.*a.*b.*c.*d.*e.*f.*g.*\\)\\}" \
+ "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2.375 \\), (\\(.*a.*b.*c.*d.*e.*f.*g.*\\)|'abcdefg') \\)" \
"print q"
-
--- gdb/testsuite/gdb.fortran/subarray.exp 1 Jan 2008 22:53:19 -0000 1.6
+++ gdb/testsuite/gdb.fortran/subarray.exp 8 Dec 2008 18:04:34 -0000
@@ -53,10 +53,10 @@ gdb_test "continue" \
# Test four different kinds of subarray expression evaluation.
-gdb_test "print str(2:4)" ".*1 = \\(98 'b', 99 'c', 100 'd'\\).*" "print str(2:4)"
-gdb_test "print str(:3)" ".*2 = \\(97 'a', 98 'b', 99 'c'\\).*" "print str(:3)"
-gdb_test "print str(5:)" ".*3 = \\(101 'e', 102 'f', 103 'g'\\).*" "print str(5:)"
-gdb_test "print str(:)" ".*4 = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\).*" "print str(:)"
+gdb_test "print str(2:4)" ".*1 = (\\(98 'b', 99 'c', 100 'd'\\)|'bcd').*" "print str(2:4)"
+gdb_test "print str(:3)" ".*2 = (\\(97 'a', 98 'b', 99 'c'\\)|'abc').*" "print str(:3)"
+gdb_test "print str(5:)" ".*3 = (\\(101 'e', 102 'f', 103 'g'\\)|'efg').*" "print str(5:)"
+gdb_test "print str(:)" ".*4 = (\\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)|'abcdefg').*" "print str(:)"
gdb_test "print array(2:4)" ".*5 = \\(2, 3, 4\\).*" "print array(2:4)"
gdb_test "print array(:3)" ".*6 = \\(1, 2, 3\\).*" "print array(:3)"
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2008-12-08 18:16 [patch] Testsuite: Fortran: 6.8 regression + gfortran updates Jan Kratochvil @ 2008-12-29 3:49 ` Joel Brobecker 2009-01-06 14:05 ` Jan Kratochvil 0 siblings, 1 reply; 8+ messages in thread From: Joel Brobecker @ 2008-12-29 3:49 UTC (permalink / raw) To: Jan Kratochvil; +Cc: gdb-patches > 2008-12-08 Jan Kratochvil <jan.kratochvil@redhat.com> > > * gdb.fortran/subarray.exp: Expect also the strings type output. > * gdb.fortran/derived-type.exp: Likewise. Expect also the kind=X types. > Update for the f-valprint.c modification from 2008-04-22. Looks OK to me. Just a few questions, out of curiosity. > - "type = Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar" \ > + "type = Type bar.*int.*\:\: c.*real.*\:\: d.*End Type bar" \ ^^^^^^ What does the debugger print in your case? int8 or integer, or...? > -gdb_test "print q%b" "\\$\[0-9\]+ = \\(.*a.*b.*c.*d.*e.*f.*g.*\\)" > +gdb_test "print q%b" "\\$\[0-9\]+ = (\\(.*a.*b.*c.*d.*e.*f.*g.*\\)|'abcdefg')" Under what circumstances will the debugger print the string as an array of characters as opposed to a string? -- Joel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2008-12-29 3:49 ` Joel Brobecker @ 2009-01-06 14:05 ` Jan Kratochvil 2009-01-06 14:14 ` Jan Kratochvil 2009-01-07 5:14 ` Joel Brobecker 0 siblings, 2 replies; 8+ messages in thread From: Jan Kratochvil @ 2009-01-06 14:05 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches, Markus Deuling On Mon, 29 Dec 2008 04:48:45 +0100, Joel Brobecker wrote: > > - "type = Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar" \ > > + "type = Type bar.*int.*\:\: c.*real.*\:\: d.*End Type bar" \ > ^^^^^^ > > What does the debugger print in your case? int8 or integer, or...? I did not know before (as the former pattern had too many wildcards). Found out now gfortran-4.1 had the types really named like `int4'. The excessive spacing from f-typeprint.c is a regression by: http://sourceware.org/ml/gdb-patches/2008-04/msg00383.html http://sourceware.org/ml/gdb-cvs/2008-04/msg00135.html http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/f-typeprint.c.diff?cvsroot=src&r1=1.22&r2=1.23 This patch fixes it back: (gdb) ptype q type = Type foo real(kind=4) :: a Type bar integer(kind=4) :: c real(kind=4) :: d -> (gdb) ptype q type = Type foo real(kind=4) :: a Type bar integer(kind=4) :: c real(kind=4) :: d > > -gdb_test "print q%b" "\\$\[0-9\]+ = \\(.*a.*b.*c.*d.*e.*f.*g.*\\)" > > +gdb_test "print q%b" "\\$\[0-9\]+ = (\\(.*a.*b.*c.*d.*e.*f.*g.*\\)|'abcdefg')" > > Under what circumstances will the debugger print the string as an array > of characters as opposed to a string? Fedora gcc-gfortran-4.1.2-33.x86_64. Did not test upstream gfortran-4.1. No regressions on gcc-4.3.2-7.x86_64 and no regressions for gdb.fortran/ on gcc-4.1.2-33.x86_64. OK to commit? Thanks, Jan gdb/ 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output spacing, a regression from 2008-04-22. gdb/testsuite/ 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.fortran/derived-type.exp: New variables int4 and real4. Match now the output exactly, using less wildcards. Expect also the output of gfortran-4.3. Update for the f-valprint.c modification from 2008-04-22. --- gdb/f-typeprint.c 3 Jan 2009 05:57:51 -0000 1.25 +++ gdb/f-typeprint.c 6 Jan 2009 13:09:12 -0000 @@ -359,8 +359,7 @@ f_type_print_base (struct type *type, st f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show, level + 4); fputs_filtered (" :: ", stream); - fprintfi_filtered (level, stream, "%s", - TYPE_FIELD_NAME (type, index)); + fputs_filtered (TYPE_FIELD_NAME (type, index), stream); f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), stream, 0, 0, 0); fputs_filtered ("\n", stream); --- gdb/testsuite/gdb.fortran/derived-type.exp 3 Jan 2009 05:58:04 -0000 1.7 +++ gdb/testsuite/gdb.fortran/derived-type.exp 6 Jan 2009 13:09:14 -0000 @@ -41,24 +41,54 @@ if ![runto MAIN__] then { continue } -gdb_test "ptype p" \ - "type = Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar" \ - "ptype p" -gdb_test "ptype q" \ - "type = Type foo.*real.*\:\: a.*Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar \:\: x.*character.*\\(7\\) \:\: b.*End Type foo" \ - "type-printing for derived type" +set int4 "(int4|integer\\(kind=4\\))" +set real4 "(real4|real\\(kind=4\\))" + +gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar" + +set test "type-printing for derived type" +gdb_test_multiple "ptype q" $test { + -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" { + pass $test + } + -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} gdb_breakpoint [gdb_get_line_number "print"] gdb_continue_to_breakpoint "print" -gdb_test "print p" "\\$\[0-9\]+ = \\{ 1, 2.375\\}" +gdb_test "print p" "\\$\[0-9\]+ = \\( 1, 2\\.375 \\)" gdb_test "print p%c" "\\$\[0-9\]+ = 1" -gdb_test "print p%d" "\\$\[0-9\]+ = 2.375" -gdb_test "print q%a" "\\$\[0-9\]+ = 3.125" -gdb_test "print q%b" "\\$\[0-9\]+ = \\(.*a.*b.*c.*d.*e.*f.*g.*\\)" +gdb_test "print p%d" "\\$\[0-9\]+ = 2\\.375" +gdb_test "print q%a" "\\$\[0-9\]+ = 3\\.125" + +set test "print q%b" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + gdb_test "print q%x%c" "\\$\[0-9\]+ = 1" -gdb_test "print q%x%d" "\\$\[0-9\]+ = 2.375" -gdb_test "print q" \ - "\\$\[0-9\]+ = \\{ 3.125, \\{ 1, 2.375\\}, \\(.*a.*b.*c.*d.*e.*f.*g.*\\)\\}" \ - "print q" +gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375" +set test "print q" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), 'abcdefg' \\)\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\) \\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} --- gdb/testsuite/gdb.fortran/subarray.exp 3 Jan 2009 05:58:04 -0000 1.7 +++ gdb/testsuite/gdb.fortran/subarray.exp 6 Jan 2009 13:09:14 -0000 @@ -53,13 +53,56 @@ gdb_test "continue" \ # Test four different kinds of subarray expression evaluation. -gdb_test "print str(2:4)" ".*1 = \\(98 'b', 99 'c', 100 'd'\\).*" "print str(2:4)" -gdb_test "print str(:3)" ".*2 = \\(97 'a', 98 'b', 99 'c'\\).*" "print str(:3)" -gdb_test "print str(5:)" ".*3 = \\(101 'e', 102 'f', 103 'g'\\).*" "print str(5:)" -gdb_test "print str(:)" ".*4 = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\).*" "print str(:)" +set test "print str(2:4)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'bcd'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} -gdb_test "print array(2:4)" ".*5 = \\(2, 3, 4\\).*" "print array(2:4)" -gdb_test "print array(:3)" ".*6 = \\(1, 2, 3\\).*" "print array(:3)" -gdb_test "print array(5:)" ".*7 = \\(5, 6, 7\\).*" "print array(5:)" -gdb_test "print array(:)" ".*8 = \\(1, 2, 3, 4, 5, 6, 7\\).*" "print array(:)" +set test "print str(:3)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'abc'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + +set test "print str(5:)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'efg'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + +set test "print str(:)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + +gdb_test "print array(2:4)" "\\$\[0-9\]+ = \\(2, 3, 4\\)" +gdb_test "print array(:3)" "\\$\[0-9\]+ = \\(1, 2, 3\\)" +gdb_test "print array(5:)" "\\$\[0-9\]+ = \\(5, 6, 7\\)" +gdb_test "print array(:)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7\\)" ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2009-01-06 14:05 ` Jan Kratochvil @ 2009-01-06 14:14 ` Jan Kratochvil 2009-01-07 5:14 ` Joel Brobecker 1 sibling, 0 replies; 8+ messages in thread From: Jan Kratochvil @ 2009-01-06 14:14 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches, Markus Deuling Hi, there was an incomplete ChangeLog: gdb/ 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output spacing, a regression from 2008-04-22. gdb/testsuite/ 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.fortran/derived-type.exp: New variables int4 and real4. Match now the output exactly, using less wildcards. Expect also the output of gfortran-4.3. Update for the f-valprint.c modification from 2008-04-22. * gdb.fortran/subarray.exp: Expect also the output of gfortran-4.3. Remove gdb_test test names where matching the command. For the patch: http://sourceware.org/ml/gdb-patches/2009-01/msg00047.html Sorry, Jan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2009-01-06 14:05 ` Jan Kratochvil 2009-01-06 14:14 ` Jan Kratochvil @ 2009-01-07 5:14 ` Joel Brobecker 2009-01-07 7:38 ` Jan Kratochvil 1 sibling, 1 reply; 8+ messages in thread From: Joel Brobecker @ 2009-01-07 5:14 UTC (permalink / raw) To: Jan Kratochvil; +Cc: gdb-patches, Markus Deuling > gdb/ > 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> > > * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output > spacing, a regression from 2008-04-22. I am not sure about this part - the use of the "indented" printf seems to be pretty deliberate, and we find this use elsewhere for the other kinds of types. Looks like Fortran developers like indented type names? I think it'd be interesting to get Markus' opinion. This, in turn, conditions the changes to the testsuite, but it should only be minimal. > gdb/testsuite/ > 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> > > * gdb.fortran/derived-type.exp: New variables int4 and real4. Match > now the output exactly, using less wildcards. Expect also the output > of gfortran-4.3. Update for the f-valprint.c modification from > 2008-04-22. > * gdb.fortran/subarray.exp: Expect also the output of gfortran-4.3. > Remove gdb_test test names where matching the command. Overall, the changes look OK to me. The only adjustment that might be needed is if we keep (f_type_print_base <TYPE_CODE_STRUCT>) as is. -- Joel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2009-01-07 5:14 ` Joel Brobecker @ 2009-01-07 7:38 ` Jan Kratochvil 2009-01-07 8:46 ` Joel Brobecker 0 siblings, 1 reply; 8+ messages in thread From: Jan Kratochvil @ 2009-01-07 7:38 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches, Markus Deuling On Wed, 07 Jan 2009 06:14:04 +0100, Joel Brobecker wrote: > > gdb/ > > 2009-01-06 Jan Kratochvil <jan.kratochvil@redhat.com> > > > > * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output > > spacing, a regression from 2008-04-22. > > I am not sure about this part - the use of the "indented" printf seems > to be pretty deliberate, and we find this use elsewhere for the other > kinds of types. Looks like Fortran developers like indented type names? I agree the indentation in general is correct. But it is done there twice now - both before and after the `::' delimiter. Indentation should happen only at the column 1. For `a' variable level == 0 but for `c' and `d' level == 4: (gdb) ptype q type = Type foo real(kind=4) :: a ^^^^ is right. ^ is not seen as it got indented by 0 characters. Type bar integer(kind=4) :: c ^^^^^^^^ is right. ^^^^ is excessive. real(kind=4) :: d case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: if (TYPE_CODE (type) == TYPE_CODE_UNION) fprintfi_filtered (level, stream, "Type, C_Union :: "); else fprintfi_filtered (level, stream, "Type "); fputs_filtered (TYPE_TAG_NAME (type), stream); fputs_filtered ("\n", stream); for (index = 0; index < TYPE_NFIELDS (type); index++) { f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show, level + 4); ^^^ This indentation is correct. fputs_filtered (" :: ", stream); fprintfi_filtered (level, stream, "%s", TYPE_FIELD_NAME (type, index)); ^^^ But this indentation is excessive. f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), stream, 0, 0, 0); fputs_filtered ("\n", stream); } The secondary indentation can be seen introduced by the Markus D.'s change: http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/f-typeprint.c.diff?cvsroot=src&r1=1.22&r2=1.23 > This, in turn, conditions the changes to the testsuite, but it should > only be minimal. It affects only: FAIL: gdb.fortran/derived-type.exp: type-printing for derived type Otherwise added there a comment above `set int4'. Thanks, Jan gdb/ 2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com> * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output spacing, a regression from 2008-04-22. gdb/testsuite/ 2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.fortran/derived-type.exp: New variables int4 and real4. Match now the output exactly, using less wildcards. Expect also the output of gfortran-4.3. Update for the f-valprint.c modification from 2008-04-22. * gdb.fortran/subarray.exp: Expect also the output of gfortran-4.3. Remove gdb_test test names where matching the command. --- gdb/f-typeprint.c 3 Jan 2009 05:57:51 -0000 1.25 +++ gdb/f-typeprint.c 7 Jan 2009 07:34:04 -0000 @@ -359,8 +359,7 @@ f_type_print_base (struct type *type, st f_type_print_base (TYPE_FIELD_TYPE (type, index), stream, show, level + 4); fputs_filtered (" :: ", stream); - fprintfi_filtered (level, stream, "%s", - TYPE_FIELD_NAME (type, index)); + fputs_filtered (TYPE_FIELD_NAME (type, index), stream); f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), stream, 0, 0, 0); fputs_filtered ("\n", stream); --- gdb/testsuite/gdb.fortran/derived-type.exp 3 Jan 2009 05:58:04 -0000 1.7 +++ gdb/testsuite/gdb.fortran/derived-type.exp 7 Jan 2009 07:34:06 -0000 @@ -41,24 +41,56 @@ if ![runto MAIN__] then { continue } -gdb_test "ptype p" \ - "type = Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar" \ - "ptype p" -gdb_test "ptype q" \ - "type = Type foo.*real.*\:\: a.*Type bar.*int4.*\:\: c.*real.*\:\: d.*End Type bar \:\: x.*character.*\\(7\\) \:\: b.*End Type foo" \ - "type-printing for derived type" +# (gfortran-4.1|gfortran-4.3). Other Fortran compilers would need other +# expect-strings. +set int4 "(int4|integer\\(kind=4\\))" +set real4 "(real4|real\\(kind=4\\))" + +gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar" + +set test "type-printing for derived type" +gdb_test_multiple "ptype q" $test { + -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" { + pass $test + } + -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} gdb_breakpoint [gdb_get_line_number "print"] gdb_continue_to_breakpoint "print" -gdb_test "print p" "\\$\[0-9\]+ = \\{ 1, 2.375\\}" +gdb_test "print p" "\\$\[0-9\]+ = \\( 1, 2\\.375 \\)" gdb_test "print p%c" "\\$\[0-9\]+ = 1" -gdb_test "print p%d" "\\$\[0-9\]+ = 2.375" -gdb_test "print q%a" "\\$\[0-9\]+ = 3.125" -gdb_test "print q%b" "\\$\[0-9\]+ = \\(.*a.*b.*c.*d.*e.*f.*g.*\\)" +gdb_test "print p%d" "\\$\[0-9\]+ = 2\\.375" +gdb_test "print q%a" "\\$\[0-9\]+ = 3\\.125" + +set test "print q%b" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + gdb_test "print q%x%c" "\\$\[0-9\]+ = 1" -gdb_test "print q%x%d" "\\$\[0-9\]+ = 2.375" -gdb_test "print q" \ - "\\$\[0-9\]+ = \\{ 3.125, \\{ 1, 2.375\\}, \\(.*a.*b.*c.*d.*e.*f.*g.*\\)\\}" \ - "print q" +gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375" +set test "print q" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), 'abcdefg' \\)\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\( 3.125, \\( 1, 2\\.375 \\), \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\) \\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} --- gdb/testsuite/gdb.fortran/subarray.exp 3 Jan 2009 05:58:04 -0000 1.7 +++ gdb/testsuite/gdb.fortran/subarray.exp 7 Jan 2009 07:34:06 -0000 @@ -53,13 +53,56 @@ gdb_test "continue" \ # Test four different kinds of subarray expression evaluation. -gdb_test "print str(2:4)" ".*1 = \\(98 'b', 99 'c', 100 'd'\\).*" "print str(2:4)" -gdb_test "print str(:3)" ".*2 = \\(97 'a', 98 'b', 99 'c'\\).*" "print str(:3)" -gdb_test "print str(5:)" ".*3 = \\(101 'e', 102 'f', 103 'g'\\).*" "print str(5:)" -gdb_test "print str(:)" ".*4 = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\).*" "print str(:)" +set test "print str(2:4)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'bcd'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(98 'b', 99 'c', 100 'd'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} -gdb_test "print array(2:4)" ".*5 = \\(2, 3, 4\\).*" "print array(2:4)" -gdb_test "print array(:3)" ".*6 = \\(1, 2, 3\\).*" "print array(:3)" -gdb_test "print array(5:)" ".*7 = \\(5, 6, 7\\).*" "print array(5:)" -gdb_test "print array(:)" ".*8 = \\(1, 2, 3, 4, 5, 6, 7\\).*" "print array(:)" +set test "print str(:3)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'abc'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + +set test "print str(5:)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'efg'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + +set test "print str(:)" +gdb_test_multiple $test $test { + -re "\\$\[0-9\]+ = 'abcdefg'\r\n$gdb_prompt $" { + pass $test + } + -re "\\$\[0-9\]+ = \\(97 'a', 98 'b', 99 'c', 100 'd', 101 'e', 102 'f', 103 'g'\\)\r\n$gdb_prompt $" { + # Compiler should produce string, not an array of characters. + setup_xfail "*-*-*" + fail $test + } +} + +gdb_test "print array(2:4)" "\\$\[0-9\]+ = \\(2, 3, 4\\)" +gdb_test "print array(:3)" "\\$\[0-9\]+ = \\(1, 2, 3\\)" +gdb_test "print array(5:)" "\\$\[0-9\]+ = \\(5, 6, 7\\)" +gdb_test "print array(:)" "\\$\[0-9\]+ = \\(1, 2, 3, 4, 5, 6, 7\\)" ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2009-01-07 7:38 ` Jan Kratochvil @ 2009-01-07 8:46 ` Joel Brobecker 2009-01-07 12:44 ` Jan Kratochvil 0 siblings, 1 reply; 8+ messages in thread From: Joel Brobecker @ 2009-01-07 8:46 UTC (permalink / raw) To: Jan Kratochvil; +Cc: gdb-patches, Markus Deuling > I agree the indentation in general is correct. But it is done there twice now > - both before and after the `::' delimiter. Indentation should happen only at > the column 1. For `a' variable level == 0 but for `c' and `d' level == 4: Aha, I see. Thanks for explaining. > gdb/ > 2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com> > > * f-typeprint.c (f_type_print_base <TYPE_CODE_STRUCT>): Fix output > spacing, a regression from 2008-04-22. > > gdb/testsuite/ > 2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com> > > * gdb.fortran/derived-type.exp: New variables int4 and real4. Match > now the output exactly, using less wildcards. Expect also the output > of gfortran-4.3. Update for the f-valprint.c modification from > 2008-04-22. > * gdb.fortran/subarray.exp: Expect also the output of gfortran-4.3. > Remove gdb_test test names where matching the command. Both OK, just one tiny comment. > +# (gfortran-4.1|gfortran-4.3). Other Fortran compilers would need other > +# expect-strings. Normally, we try to use full sentences in comments. The comment above takes a little longer than it should to understand because you need to read the code below to know what it's about. In GDB, and I suspect in the majority of GNU projects, the comments are place before the code which can force us to repeat the code a bit sometimes... I tried to make a suggestion but I don't know Fortran enough to help. Perhaps: /* Depending on the compiler version being used, the name of the 4-byte integer and real types can be printed differently. For instance, gfortran-4.1 uses "int4" whereas gfortran-4.3 uses "int(kind=4)". */ Dependending on how the information is encoded, the comment can probably be improved further. No need to re-request approval after the comment is expanded a bit. Thanks, -- Joel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch] Testsuite: Fortran: 6.8 regression + gfortran updates 2009-01-07 8:46 ` Joel Brobecker @ 2009-01-07 12:44 ` Jan Kratochvil 0 siblings, 0 replies; 8+ messages in thread From: Jan Kratochvil @ 2009-01-07 12:44 UTC (permalink / raw) To: Joel Brobecker; +Cc: gdb-patches, Markus Deuling On Wed, 07 Jan 2009 09:46:40 +0100, Joel Brobecker wrote: > > +# (gfortran-4.1|gfortran-4.3). Other Fortran compilers would need other > > +# expect-strings. > > Normally, we try to use full sentences in comments. For some reason I mistakenly considered this case as an exception; understood. > /* Depending on the compiler version being used, the name of the 4-byte > integer and real types can be printed differently. For instance, > gfortran-4.1 uses "int4" whereas gfortran-4.3 uses "int(kind=4)". */ Checked in with this comment. Thanks, Jan ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-01-07 12:44 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2008-12-08 18:16 [patch] Testsuite: Fortran: 6.8 regression + gfortran updates Jan Kratochvil 2008-12-29 3:49 ` Joel Brobecker 2009-01-06 14:05 ` Jan Kratochvil 2009-01-06 14:14 ` Jan Kratochvil 2009-01-07 5:14 ` Joel Brobecker 2009-01-07 7:38 ` Jan Kratochvil 2009-01-07 8:46 ` Joel Brobecker 2009-01-07 12:44 ` Jan Kratochvil
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox