Skip to content

Conversation

@yaoliu-hnc
Copy link
Collaborator

Fix error of processing entry statement:

  • Compiling error when return type of entry is complex/pointer/array.

  • Inconsistent with Fortran 2008 standard, ISO/IEC JTC 1/SC 22/WG 5/N1830
    section-12.6.2.6 (If the characteristics of the result of the function
    named in the ENTRY statement are the same as the characteristics of the
    result of the function named in the FUNCTION statement, their result
    variables identify the same variable, although their names need not be
    the same).

@SouraVX
Copy link
Collaborator

SouraVX commented May 19, 2021

Thanks for the patch @yaoliu-hnc and describing the problem also.
To put things in context, to what was going wrong in flang, Is it possible summarize the changes too ?

Copy link
Collaborator

@SouraVX SouraVX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to update/document the changes wherever needed ?

Copy link
Collaborator

@pawosm-arm pawosm-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding some more rationale in the commit message would be helpful, otherwise it looks OK.

@kiranchandramohan
Copy link
Collaborator

ping @SouraVX

* Compiling error when return type of entry is complex/pointer.

  Main cause of this problem is that flang2 checks whether the return
  variable is used as a dummy argument only at the first entry point,
  so this patch fixes the problem by going through all entry points.
  In addition, because flang1 changes the storage class of a pointer
  dummy argument from `SC_DUMMY` to `SC_BASED`, this patch modifies the
  check for dummy argument in flang2 accordingly.

* Inconsistent with Fortran 2008 standard, ISO/IEC JTC 1/SC 22/WG 5/N1830
  section-12.6.2.6 (If the characteristics of the result of the function
  named in the ENTRY statement are the same as the characteristics of the
  result of the function named in the FUNCTION statement, their result
  variables identify the same variable, although their names need not be
  the same).

  Flang1 currently doesn’t handle functions that are converted to
  subroutines as the standard specifies, and all entry points simply use
  the same symbol for the return variable in the field `FVAL`. This patch
  takes into account all the symbols associated with the return variable,
  and performs symbol replacement in both the dummy argument list and the
  AST table.
Copy link
Collaborator

@bryanpkc bryanpkc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@bryanpkc
Copy link
Collaborator

@shivaramaarao If you are okay with this PR, please merge.

Copy link
Collaborator

@shivaramaarao shivaramaarao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shivaramaarao shivaramaarao merged commit 1fbbb03 into flang-compiler:master Aug 17, 2021
@pawosm-arm
Copy link
Collaborator

pawosm-arm commented Sep 16, 2021

This commit causes 3 of the NAG suite test cases to fail: sc7a sr3 sr3e
More details. All of the three failing test cases are about testing ENTRY statement. Note that no other test for ENTRY statement (e.g. sr3c) is failing.

shivaramaarao added a commit that referenced this pull request Sep 17, 2021
xinliu-hnc pushed a commit to compiler-dev/flang that referenced this pull request Sep 18, 2021
…compiler#1137).

When the entry returns adjustable length character without POINTER attribute,
the field NEWARG of the return variable is not set which causes that the return
variable in dummy arguments is not replaced. This commit adds the check for
the field NEWARG to fix the regression.
kiranchandramohan pushed a commit that referenced this pull request Sep 22, 2021
xinliu-hnc pushed a commit to compiler-dev/flang that referenced this pull request Sep 26, 2021
xinliu-hnc pushed a commit to compiler-dev/flang that referenced this pull request Sep 26, 2021
…compiler#1137).

   When the entry returns adjustable length character without POINTER attribute,
   the field NEWARG of the return variable is not set which causes that
   the return variable in dummy arguments is not replaced, and it was forgetten to
   replace the symbol referred in the field CVLEN.
   This commit fixes the previous two problems and adds the corresponding test cases.
xinliu-hnc pushed a commit to compiler-dev/flang that referenced this pull request Sep 26, 2021
…compiler#1137).

   When the entry returns adjustable length character without POINTER attribute,
   the field NEWARG of the return variable is not set which causes that
   the return variable in dummy arguments is not replaced,
   and the field CVLEN of the return variable also needs to be replaced.
xinliu-hnc pushed a commit to compiler-dev/flang that referenced this pull request Oct 8, 2021
…compiler#1137).

   When the entry returns adjustable length character without POINTER attribute,
   the field NEWARG of the return variable is not set which causes that
   the return variable in dummy arguments is not replaced,
   and the field CVLEN of the return variable also needs to be replaced.
bryanpkc pushed a commit that referenced this pull request Oct 8, 2021
bryanpkc pushed a commit that referenced this pull request Oct 8, 2021
   When the entry returns adjustable length character without POINTER attribute,
   the field NEWARG of the return variable is not set which causes that
   the return variable in dummy arguments is not replaced,
   and the field CVLEN of the return variable also needs to be replaced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants