Skip to content

[Flang] No error checking when nested structure statement has no field name #99288

@ohno-fj

Description

@ohno-fj
Version of flang-new : 19.0.0(73447a3302541c343525570222b318e7f94f9402)/AArch64

structure statement is an extension, but Flang-new supports it.
A nested structure statement must have at least one field name, but attached program does not specify a field name.
However, Flang-new does not detect error during compilation and does not output error message.
Gfortran and ifort output compilation error message.

The following are the test program, Flang-new, Gfortran and ifort compilation/execution result.

3-P-405-structure-inner01_2.f90:

  structure /tp1/
    integer(kind=4) :: ma0 = 10
    integer(kind=4) :: ma1
    real(kind=8) :: mb0
    real(kind=8) :: mb1 = 2.0
    structure /tp2/
      integer(kind=8) :: za0 = 50
    end structure
  end structure

  record /tp1/ a
  record /tp2/ b

  print *, a
  print *, b
end
$ flang-new 3-P-405-structure-inner01_2.f90
$
$ gfortran 3-P-405-structure-inner01_2.f90 -fdec-structure
3-P-405-structure-inner01_2.f90:6:19:

    6 |     structure /tp2/
      |                   1
Error: Invalid character in name at (1)
3-P-405-structure-inner01_2.f90:9:5:

    9 |   end structure
      |     1
Error: Expecting END PROGRAM statement at (1)
3-P-405-structure-inner01_2.f90:12:15:

   12 |   record /tp2/ b
      |               1
Error: Derived type ‘tp2’ at (1) is being used before it is defined
$
$ ifort -diag-disable=10448 3-P-405-structure-inner01_2.f90
3-P-405-structure-inner01_2.f90(6): error #7038: A nested structure declaration must have at least one field name in the field list.
    structure /tp2/
---------------^
compilation aborted for 3-P-405-structure-inner01_2.f90 (code 1)
$

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontend

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions