Issue |
131655
|
Summary |
[flang][OpenMP]Flang crashes with implicit none and undeclared variables
|
Labels |
flang
|
Assignees |
|
Reporter |
Leporacanthicus
|
```
program omp_examples
implicit none
integer, parameter :: n = 100
real :: values(n)
integer :: i
! real :: sum
call random_number(values)
sum = 0
!$omp parallel do reduction(+:sum)
do i = 1, n
sum = sum + values(i)
end do
print *, values
print *, "sum=", sum
end program omp_examples
```
Uncomment the declaration for `sum` and it compiles fine.
To reproduce, save the sample above and compile with `flang -fc1 -fopenmp sample.f90`
The crash appears in the following code, where `GetLastName(*desg).symbol` is NULL.
```
const Symbol *OmpStructureChecker::GetObjectSymbol(
const parser::OmpObject &object) {
if (auto *name{std::get_if<parser::Name>(&object.u)}) {
return &name->symbol->GetUltimate();
} else if (auto *desg{std::get_if<parser::Designator>(&object.u)}) {
return &GetLastName(*desg).symbol->GetUltimate();
}
return nullptr;
}
```
I'm recording this now, as I found it broken the other day. I may well fix this in the next day or two, but I'd rather report a bug and fix it quickly, than find that someone else found the same bug, and it wasn't fixed for ages... :)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs