Commit 87ca51a
authored
[Flang][OpenMP] Fix crash on invalid atomic variable expressions (#173068)
Fixes #169484
The compiler crashed with an assertion failure when processing OpenMP
ATOMIC constructs containing invalid variable expressions like function
references or undeclared variables.
## Root Cause:
`CheckAtomicVariable()` assumed `GetAllDesignators()` always returns
exactly one designator, but it returns an empty vector for function
references.
## Fix:
Replaced the assertion with proper validation that emits diagnostic
errors instead of crashing.
## Testing:
Added regression test [atomic-invalid-variable.f90]1 parent d22d2e3 commit 87ca51a
File tree
2 files changed
+43
-1
lines changed- flang
- lib/Semantics
- test/Semantics/OpenMP
2 files changed
+43
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
590 | | - | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
591 | 598 | | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
592 | 602 | | |
593 | 603 | | |
594 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments