From 2a07e5163347f771ae97e8d0533648d6bda8c346 Mon Sep 17 00:00:00 2001 From: Valentin Clement Date: Mon, 4 Nov 2024 09:59:05 -0800 Subject: [PATCH] [flang][cuda] Crash if mode is not recognized --- flang/runtime/CUDA/memory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flang/runtime/CUDA/memory.cpp b/flang/runtime/CUDA/memory.cpp index daf1db684a3d2..5aa7ac5c3cccd 100644 --- a/flang/runtime/CUDA/memory.cpp +++ b/flang/runtime/CUDA/memory.cpp @@ -111,7 +111,6 @@ void RTDEF(CUFDataTransferPtrDesc)(void *addr, Descriptor *desc, void RTDECL(CUFDataTransferDescDesc)(Descriptor *dstDesc, Descriptor *srcDesc, unsigned mode, const char *sourceFile, int sourceLine) { - Terminator terminator{sourceFile, sourceLine}; MemmoveFct memmoveFct; if (mode == kHostToDevice) { memmoveFct = &MemmoveHostToDevice; @@ -119,6 +118,9 @@ void RTDECL(CUFDataTransferDescDesc)(Descriptor *dstDesc, Descriptor *srcDesc, memmoveFct = &MemmoveDeviceToHost; } else if (mode == kDeviceToDevice) { memmoveFct = &MemmoveDeviceToDevice; + } else { + Terminator terminator{sourceFile, sourceLine}; + terminator.Crash("host to host copy not supported"); } Fortran::runtime::Assign( *dstDesc, *srcDesc, terminator, MaybeReallocate, memmoveFct);