This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] Fortran: Handle associated property of pointer types.
- From: Bernhard Heckel <bernhard dot heckel at intel dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>
- Cc: eliz at gnu dot org, gdb-patches at sourceware dot org
- Date: Fri, 24 Jun 2016 07:38:35 +0200
- Subject: Re: [PATCH 1/3] Fortran: Handle associated property of pointer types.
- Authentication-results: sourceware.org; auth=none
- References: <1465220233-32286-1-git-send-email-bernhard dot heckel at intel dot com> <1465220233-32286-2-git-send-email-bernhard dot heckel at intel dot com> <86wplorr4w dot fsf at gmail dot com> <57690636 dot 3040807 at intel dot com> <86r3bqrh8o dot fsf at gmail dot com>
On 21/06/2016 12:03, Yao Qi wrote:
Bernhard Heckel <bernhard.heckel@intel.com> writes:
+gdb_test "print intp" "= <not associated>" "print intp, not associated"
+
+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
+gdb_continue_to_breakpoint "Before pointer assignment"
+gdb_test "print logp" "= <not associated>" "print logp, not associated"
+gdb_test "print comp" "= <not associated>" "print comp, not associated"
+gdb_test "print charp" "= <not associated>" "print charp, not associated"
+gdb_test "print charap" "= <not associated>" "print charap, not associated"
+gdb_test "print intp" "= <not associated>" "print intp, not associated"
+gdb_test "print intap" "= <not associated>" "print intap, not associated"
+gdb_test "print realp" "= <not associated>" "print realp, not associated"
+gdb_test "print \$my_var = intp" "= <not associated>"
What is the output without your fix? IMO, "print POINTER" prints the
value of the pointer. It doesn't matter whether the pointer is
associated with a target or not.
For compilers creating the property, the output is like above.
For missing property, it is:
gdb_test "print logp" "= (PTR TO -> ( $logical )) 0x0"
Based on your input I would like to propose:
gdb_test "print logp" "= (PTR TO -> ( $logical )) <not associated>"
I don't want GDB to carry some knowledge to guess the pointer is not
associated. If compiler creates the property, gdb uses it, otherwise,
simply prints 0x0, which is right to me. I don't understand the point
of changing the output "0x0" -> "<not associated>".
You are right, it is not necessarily needed to add this property in case
it is not generated by the compiler.
Nevertheless, I did it for two reasons:
- My intention was to reflect the associated status to the user like
described in the fortran standard.
The standard says: A nullified pointer is disassociated.
- Keep existing and future test cases simple, as there is no switch case
needed for different compiler releases.
From my point both behavior are fine, it's up to you to decide
BR
Bernhard
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928