Commit 91c72e8
authored
[flang] Add a warning for CDEFINED declarations that have initializers (#159456)
CDEFINED declarations are similar to "extern" declarations in C. If they
have initializers, this could lead to linker errors. clang warns about
"extern" declarations with initializers. Add similar warning to flang:
```
$ flang -c cdefined.f90 -pedantic
./cdefined.f90:3:57: warning: CDEFINED variable should not have an initializer [-Wcdefined-init]
integer(c_int), bind(C, name='c_global', CDEFINED) :: c = 4
^
```1 parent 44b7abc commit 91c72e8
File tree
3 files changed
+10
-1
lines changed- flang
- include/flang/Support
- lib/Semantics
- test/Semantics
3 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9118 | 9118 | | |
9119 | 9119 | | |
9120 | 9120 | | |
| 9121 | + | |
| 9122 | + | |
| 9123 | + | |
9121 | 9124 | | |
9122 | 9125 | | |
9123 | 9126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
0 commit comments