watchpoint on Fortran array elements

Wadud Miah
Mon Jan 6 17:44:00 GMT 2020

Hi again,

I found out that GDB sets three watchpoints on an adjustable array element only - local arrays are not affected:

  subroutine sub1( array, n )
    integer :: n
    integer, dimension(n) :: array

    print *, array
  end subroutine sub1

(gdb) watch array(1)
Watchpoint 3: array(1)
(gdb) info watchpoints 
Num     Type           Disp Enb Address            What
3       watchpoint     keep y                      array(1)
3.1                         y                      array(1)
3.2                         y                      array(1)

And, this is for the Intel compiler. If I use GNU Fortran, I don’t see three watchpoints for watching an adjustable array element:

(gdb) watch array(1)
Hardware watchpoint 2: array(1)
(gdb) info watchpoints 
Num     Type           Disp Enb Address            What
2       hw watchpoint  keep y                      array(1)


-----Original Message-----
From: <> On Behalf Of Wadud Miah
Sent: 06 January 2020 16:55
Subject: watchpoint on Fortran array elements


I have set a watchpoint on a Fortran array element using GDB (version 8.3-7.fc30):

(gdb) watch vec(19)

But listing the watchpoints lists three watchpoints:

(gdb) info watchpoints
Num     Type           Disp Enb Address            What
12      watchpoint     keep y                      vec(19)
12.1                                       y                      vec(19)
12.2                                       y                      vec(19)

I don't understand why there are three watchpoints for a single array element. Any help will be greatly appreciated.


Dr. Wadud Miah
Numerical Algorithms Group


The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. 

More information about the Gdb mailing list