Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
klausler committed Feb 27, 2019
1 parent 794e6a4 commit 6f4af0f
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 5 deletions.
2 changes: 1 addition & 1 deletion documentation/f2018-grammar.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.

R0001 digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
R0002 letter ->
Expand Down
2 changes: 1 addition & 1 deletion lib/common/enum-set.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2018-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.
Expand Down
2 changes: 1 addition & 1 deletion lib/common/indirection.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2018-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.
Expand Down
3 changes: 1 addition & 2 deletions lib/semantics/resolve-names.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3052,8 +3052,7 @@ bool DeclarationVisitor::Pre(const parser::ProcPointerInit &x) {
}
bool DeclarationVisitor::Pre(const parser::ProcInterface &x) {
if (auto *name{std::get_if<parser::Name>(&x.u)}) {
if (!FindSymbol(*name) &&
!HandleUnrestrictedSpecificIntrinsicFunction(*name)) {
if (!NameIsKnownOrIntrinsic(*name)) {
// Simple names (lacking parameters and size) of intrinsic types re
// ambiguous in Fortran when used as instances of proc-interface.
// The parser recognizes them as interface-names since they can be
Expand Down
76 changes: 76 additions & 0 deletions test/semantics/resolve45.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
! 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.

function f1(x, y)
integer x
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
!ERROR: SAVE attribute may not be applied to dummy argument 'y'
save x,y
integer y
!ERROR: SAVE attribute may not be applied to function result 'f1'
save f1
end

function f2(x, y)
!ERROR: SAVE attribute may not be applied to function result 'f2'
real, save :: f2
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
complex, save :: x
allocatable :: y
!ERROR: SAVE attribute may not be applied to dummy argument 'y'
integer, save :: y
end

subroutine s3(x)
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
procedure(integer), pointer, save :: x
!ERROR: Procedure 'y' with SAVE attribute must also have POINTER attribute
procedure(integer), save :: y
end

subroutine s4
!ERROR: Explicit SAVE of 'z' is redundant due to global SAVE statement
save z
save
procedure(integer), pointer :: x
!ERROR: Explicit SAVE of 'x' is redundant due to global SAVE statement
save :: x
!ERROR: Explicit SAVE of 'y' is redundant due to global SAVE statement
integer, save :: y
end

subroutine s5
implicit none
integer x
block
!ERROR: No explicit type declared for 'x'
save x
end block
end

subroutine s6
save x
save y
!ERROR: SAVE attribute was already specified on 'y'
integer, save :: y
integer, save :: z
!ERROR: SAVE attribute was already specified on 'x'
!ERROR: SAVE attribute was already specified on 'z'
save x,z
end

subroutine s7
!ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement
save /x/
end
3 changes: 3 additions & 0 deletions test/semantics/resolve46.f90
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ program main
intrinsic :: cos ! a specific & generic intrinsic name
intrinsic :: alog10 ! a specific intrinsic name, not generic
intrinsic :: null ! a weird special case
intrinsic :: bessel_j0 ! generic intrinsic, not specific
!ERROR: 'haltandcatchfire' is not a known intrinsic procedure
intrinsic :: haltandcatchfire
procedure(sin), pointer :: p
Expand All @@ -25,4 +26,6 @@ program main
p => tan ! a generic & an unrestricted specific, not already declared
!TODO ERROR: a restricted specific, to be caught in ass't semantics
p => amin1
!TODO ERROR: a generic, to be caught in ass't semantics
p => bessel_j0
end program main

0 comments on commit 6f4af0f

Please sign in to comment.