source:
CIVL/mods/dev.civl.abc/examples/fortran/commonblock/bug_common_read_uninitialized.f
| Last change on this file was aad342c, checked in by , 3 years ago | |
|---|---|
|
|
| File size: 433 bytes | |
| Line | |
|---|---|
| 1 | ! This program accidentally uses the "wrong" common |
| 2 | ! block in SUB, resulting in uninitialized variables |
| 3 | ! being used. |
| 4 | PROGRAM MAIN |
| 5 | INTEGER A |
| 6 | REAL F,R,X,Y |
| 7 | COMMON /MC/ R,A,F |
| 8 | COMMON /MCD/ RD,AD,FD |
| 9 | A = 5 |
| 10 | R = 3.5 |
| 11 | CALL SUB(X,Y) |
| 12 | WRITE(*,*) F |
| 13 | END |
| 14 | |
| 15 | SUBROUTINE SUB(P,Q) |
| 16 | INTEGER I |
| 17 | REAL A,B,P,Q |
| 18 | COMMON /MCD/ A,I,B |
| 19 | B = I + 2*A |
| 20 | END |
Note:
See TracBrowser
for help on using the repository browser.
