Files
clang-p2996/openmp/libomptarget/test/offloading/bug74582.c
Johannes Doerfert 0ace6ee73a [OpenMP][FIX] Ensure we do not read outside the device image (#74669)
Before we expected all symbols in the device image to be backed up with
data that we could read. However, uninitialized values are not. We now
check for this case and avoid reading random memory.

This also replaces the correct readGlobalFromImage call with a
isSymbolInImage check after
https://github.com/llvm/llvm-project/pull/74550 picked the wrong one.

Fixes: https://github.com/llvm/llvm-project/issues/74582
2023-12-06 14:57:57 -08:00

14 lines
401 B
C

// RUN: %libomptarget-compile-generic && %libomptarget-run-generic
// RUN: %libomptarget-compileopt-generic && %libomptarget-run-generic
// Verify we do not read bits in the image that are not there (nobits section).
#pragma omp begin declare target
char BigUninitializedBuffer[4096 * 64] __attribute__((loader_uninitialized));
#pragma omp end declare target
int main() {
#pragma omp target
{}
}