Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[flang][OpenMP]Flang crashes with implicit none and undeclared variables #131655

Copy link
Copy link
Closed
@Leporacanthicus

Description

@Leporacanthicus
Issue body actions
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... :)

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.