543b15bca4
A symbol for a common block has `CommonBlockDetails` which contains a list of the symbols that are in the common block. The name of the symbol for the blank common block is the empty string. That preserves the property that every symbol name is a substring of the cooked source. We use the 0-length substring starting at the COMMON statement so that when symbols are sorted by the location of the start of the name it ends up in the right place. Some of the checks on members of common blocks don't happen until the end of the scope. They can't happen earlier because we don't necessarily know the type and attributes. Enhance `test_errors.sh` so that multiple errors can be expected for a single line. Original-commit: flang-compiler/f18@2c4ca6b5d3 Reviewed-on: https://github.com/flang-compiler/f18/pull/286
41 lines
1,017 B
Fortran
41 lines
1,017 B
Fortran
! Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
|
|
!
|
|
! Licensed under the Apache License, Version 2.0 (the "License");
|
|
! you may not use this file except in compliance with the License.
|
|
! You may obtain a copy of the License at
|
|
!
|
|
! http://www.apache.org/licenses/LICENSE-2.0
|
|
!
|
|
! Unless required by applicable law or agreed to in writing, software
|
|
! distributed under the License is distributed on an "AS IS" BASIS,
|
|
! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
! See the License for the specific language governing permissions and
|
|
! limitations under the License.
|
|
|
|
module m
|
|
logical b
|
|
common //t
|
|
common /cb/ x(2:10) /cb2/a,b,c
|
|
common /cb/ y,z
|
|
common w
|
|
common u,v
|
|
complex w
|
|
dimension b(4,4)
|
|
end
|
|
|
|
!Expect: m.mod
|
|
!module m
|
|
! logical(4)::b(1_8:4_8,1_8:4_8)
|
|
! common//t,w,u,v
|
|
! real(4)::t
|
|
! common/cb/x,y,z
|
|
! real(4)::x(2_8:10_8)
|
|
! common/cb2/a,b,c
|
|
! real(4)::a
|
|
! real(4)::c
|
|
! real(4)::y
|
|
! real(4)::z
|
|
! complex(4)::w
|
|
! real(4)::u
|
|
! real(4)::v
|
|
!end
|