This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Fortran: Handle associated property of pointer types.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]