`SymbolicMath` corrupts a structure reference inside an `IntrinsicCall` in an `IfBlock` condition.

Aperta
#3,667 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
fortran, python
Ambito
compilers

Direzione di ricerca

Start by tracing how SymbolicMath handles the IfBlock condition in the reproducer, especially the IntrinsicCall containing the structure reference x%member(lbound(x%member)). Run the provided PSyclone script with the Fortran input and inspect the generated PSyIR or symbols when x_member appears. Done means inlining completes without the undeclared-symbol VisitorError for this case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hi @hiker, here is a minimal reproducer of the issue that I mentioned in the telco.

Fortran input:

module m
  type :: my_type
    integer :: member(10)
  end type
contains
subroutine sub(x, i)
  type(my_type), intent(in) :: x
  integer, intent(out) :: i
  integer :: arr(10)
  if (x%member(lbound(x%member)) > 0) then
    i = 1
  end if
end subroutine
subroutine main()
  type(my_type) :: x
  integer :: i
  call sub(x, i)
end subroutine
end module

PSyclone script:

from psyclone.psyir.nodes import Call, Routine, Container
from psyclone.psyir.transformations import InlineTrans

def trans(psyir):
  for call in psyir.walk(Call):
    if call.routine.name == "sub":
      inline_trans = InlineTrans()
      inline_trans.apply(call)

When I run the script on the input I get:

raise VisitorError(
psyclone.psyir.backend.visitor.VisitorError: Visitor Error: The following symbols are not explicitly declared or imported from a module and there are no wildcard imports, generic interfaces or CodeBlocks which could be bringing them into scope: 'x_member'

Notice the reference to x_member in the error message. Do you think this is sympy related?

Probably there is a smaller reproducer, I will take a look tomorrow.

Lingua principale
Python
Stelle
141
Fork
39
Merge medio
2g 16h
PR unite (30g)
9

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stfc/PSyclone

Tutte le issue di stfc/PSyclone

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.