Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull 2018-02-09T14-19 Recent NVIDIA Changes #396

Merged
merged 1 commit into from
Feb 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions test/f90_correct/inc/oop719.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) 2018, 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.

########## Make rule for test oop719 ########


oop719: run


build: $(SRC)/oop719.f90
-$(RM) oop719.$(EXESUFFIX) core *.d *.mod FOR*.DAT FTN* ftn* fort.*
@echo ------------------------------------ building test $@
-$(CC) -c $(CFLAGS) $(SRC)/check.c -o check.$(OBJX)
-$(FC) -c $(FFLAGS) $(LDFLAGS) $(SRC)/oop719.f90 -o oop719.$(OBJX)
-$(FC) $(FFLAGS) $(LDFLAGS) oop719.$(OBJX) check.$(OBJX) $(LIBS) -o oop719.$(EXESUFFIX)


run:
@echo ------------------------------------ executing test oop719
oop719.$(EXESUFFIX)

verify: ;

19 changes: 19 additions & 0 deletions test/f90_correct/lit/oop719.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2017, 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.

# Shared lit script for each tests. Run bash commands that run tests with make.

# RUN: KEEP_FILES=%keep FLAGS=%flags TEST_SRC=%s MAKE_FILE_DIR=%S/.. bash %S/runmake | tee %t
# RUN: cat %t | FileCheck %S/runmake
59 changes: 59 additions & 0 deletions test/f90_correct/src/oop719.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
! Copyright (c) 2018, 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.

! Compile with -Mallocatable=03 to exercise the bug fix (disregard if
! -Mallocatable=03 is now the default behavior in the compiler).

module mod
integer count
type base
integer :: x
end type base

type comp
class(base), allocatable :: b
contains
final :: dtor
end type comp

contains

subroutine dtor(this)
type(comp) :: this
count = count + 1
end subroutine dtor

subroutine foo()
type(comp) :: x, y

allocate(y%b)
y%b%x = 99

! final subroutine, dtor, gets called 3 times (called for x,y, and
! the temp used in the x = y assignment below).

x = y
end subroutine foo

end module mod

use mod
logical rslt(1), expect(1)
count = 0
call foo()

expect = .true.
rslt(1) = count .eq. 3
call check(rslt, expect, 1)
end
7 changes: 1 addition & 6 deletions tools/flang1/flang1exe/transfrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3698,12 +3698,7 @@ rewrite_allocatable_assignment(int astasgn, const int std, LOGICAL non_conformab
if (DTYG(dtypedest) == TY_DERIVED && !HCCSYMG(sptrdest) && !XBIT(54, 0x4) &&
allocatable_member(sptrdest)) {
handle_allocatable_members(astdest, astsrc, std, 0);
if (!XBIT(54, 0x1) || !is_or_has_poly(sptrdest) || HCCSYMG(sptrsrc)) {
/* pFUnit - must preserve assign if destination is not
* allocatable, but it has polymorphic allocatable members
*/
ast_to_comment(astasgn);
}
ast_to_comment(astasgn);
return;
}
if (STYPEG(sptrdest) == ST_MEMBER && !XBIT(54, 0x4) && XBIT(54, 0x1)) {
Expand Down