[PATCH, Fortran] TS 29113 testsuite

2021-07-06 Thread Sandra Loosemore

On 6/30/21 11:53 PM, Sandra Loosemore wrote:
For the past several months I've been working on developing a set of 
tests for the Fortran/C interoperability features added to Fortran via 
TS 29113, "Further Interoperability of Fortran with C":


https://wg5-fortran.org/N1901-N1950/N1942.pdf

The goal here is to exercise gfortran's implementation in a more 
systematic and complete way, including conformance with error detection 
requirements and the like as well as making sure correct programs run 
correctly.


I'm posting this as work-in-progress at this time because, well, there 
are a lot of bugs in the implementation causing lots of the tests to 
fail.  :-(  I know maintainers don't like patches that deliberately add 
FAILs to the test results and the normal practice seems to be to XFAIL 
known bugs with references to a PR.  Some of the bugs already have PRs 
open, but others don't.  What I plan to work on next is filing or 
updating the PRs with reference to the testcases that demonstrate the 
bugs, add the XFAILs, and then resubmit the patch for approval.  A few 
of these tests also still have some excessively verbose debugging output 
enabled which I'll also try to clean up before resubmitting.


I have a trivial patch for one set of failures (incorrect initialization 
of version fields) that I'll be posting shortly.  A couple of José's 
recent not-yet-committed patches also fix some of the bugs I've run 
into; I will note those in the corresponding PRs as I work through the 
list.


Here's the patch for the cleaned-up testsuite with xfails added. 
Besides disabling the more verbose output, I fixed some issues with 
comments and whitespace.


This is the list of issues I've tagged for the failing tests:

PR 54753
  assumed-rank dummies: Reject assumed-size actuals in in some cases
  (C535c; in F2018: C839)

PR 92482
  BIND(C) with array-descriptor mishandled for type character

PR 92621
  Problems with memory handling with allocatable intent(out) arrays
  with bind(c)

PR 93308
  bind(c) subroutine changes lower bound of array argument in caller

PR 94070
  Assumed-rank arrays – bounds mishandled, SIZE/SHAPE/UBOUND/LBOUND

PR 101304
  Bind(C): CONTIGUOUS attribute not handled correctly in Fortran routines
  called from C with discontiguous argument

PR 101305
  Bind(C): Problems with incorrect kinds/sizes in ISO_Fortran_binding.h
  and CFI_establish

PR 101308
  Bind(C): gfortran does not create C descriptors for scalar
  pointer/allocatable arguments

PR 101309
  Bind(C): gfortran creates invalid C descriptor for result of TRANSPOSE
  intrinsic

PR 101310
  Bind(C): CFI_section seems confused by pointer arrays

PR 101317
  Bind(C): improve error checking in CFI_* functions declared in
  ISO_Fortran_binding.h

PR 101319
  Missing diagnostic for argument with type parameters for assumed-type 
dummy


PR 101320
  Bind(C): Missing diagnostic for constraint C1557 on allocatable/pointer
  arguments

PR 101333
  gfortran fails to enforce C711 on assumed-type actual arguments

PR 101334
  gfortran fails to enforce C838 on disallowed uses of assumed-rank
  variable names + bogus errors

PR 101337
  gfortran doesn't diagnose all operands with constraint violations

There was a question in one of the issues about why this testsuite 
references TS29113 instead of the 2018 standard.  Well, that is what our 
customer is interested in: finding out what parts of the TS29113 
functionality remain unimplemented or broken, and fixing them, so that 
gfortran can say that it implements that specification.


I tested on both x86_64-linux-gnu and i686-pc-linux-gnu (32-bit), and 
verified that there are no FAILing tests left, just ~300 new XFAILs.


OK to check in?

-Sandra


ts29113-jul6.patch.gz
Description: application/gzip


Re: [patch, fortran] Fix PR 100227, write with implied DO loop

2021-07-06 Thread Thomas Koenig via Fortran



Hi Jerry,


Looks OK Thomas,

Good for backport as well.


Thanks.  Committed to trunk so far, will add a git worktree for
gcc11 next :-)

Best regards

Thomas