Skip to content

Instantly share code, notes, and snippets.

@madgen
Last active February 19, 2016 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madgen/38b166731662eefcc1e3 to your computer and use it in GitHub Desktop.
Save madgen/38b166731662eefcc1e3 to your computer and use it in GitHub Desktop.
c Bug 1:
c Mistakenly initialising unspecified common variable.
program nblock
integer x, y
common /name/x, y
call hello
call mello
print *, x, y
end
subroutine hello
common /name/x, y
integer x, y
c data statement treats y as initialised as well
c so when it is initialised in the other subroutine
c the value remains 0.
data x/2/
return
end
subroutine mello
common /name/x, y
integer x, y
data y/15/
return
end
c Bug 2:
c Missing error message.
program nblock
integer x, y
common /name/x, y
print *, x, y
end
block data hello
common /name/x, y
integer x, y
data x/2/
end
c Here the common block with /name/ should throw an error
c as it has been used in a different block data subprogram
c the specification prohibits this use case.
block data mello
common /name/x, y
integer x, y
data y/15/
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment