4

I have a really simple Fortran program in a file test.f90:

program test
   real :: x
   x=12
   write(*,*) x
end program test

I compile it with

gfortran -g test.f90

Then I try with gdb:

gdb a.out
break 4 if a == 12

but I get

A syntax error in expression, near `= 12'.

I found several docs and forums saying this should work, but it doesn't... What is the correct syntax for this simple condition? I use gdb 7.6.1.

1 Answer 1

8

The documentation for gdb has the following to say about Fortran support:

GDB can be used to debug programs written in Fortran, but it currently supports only the features of Fortran 77 language.

As the logical conditional x == 12 is Fortran 90 pedigree you can instead write

break 4 if x.eq.12
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.