https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104780
Bug ID: 104780 Summary: [nvptx, sm_30] FAIL: gcc.dg/loop-unswitch-4.c execution test Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: vries at gcc dot gnu.org Target Milestone: --- [ Quadro K2000 with sm_30, driver 470.103.01 ] With the tentative patch for PR104758 ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104758#c6 ) on top of commit 5b5e456f0187 ("[nvptx] Build libraries with mptx=3.1"), I run into: ... FAIL: gcc.dg/loop-unswitch-4.c execution test ... That's with --target_board=nvptx-none-run/-misa=sm_30: ... PASS: gcc.dg/loop-unswitch-4.c (test for excess errors) spawn nvptx-none-run ./loop-unswitch-4.exe^M nvptx-run: error getting kernel result: unspecified launch failure (CUDA_ERROR_LAUNCH_FAILED, 719)^M FAIL: gcc.dg/loop-unswitch-4.c execution test ... We run into an abort in the test-case. At first the problem was hard to reproduce, and mainly seemed to happen when running at the same time as another test (I'm testing standalone nvptx tests and offloading tests at the same time). But I've characterized the problem as calloc not zero-ing out the entire allocated array. And since calloc returns the same pointer every time you run it, I've added code to set it to non-zero (after reading the result of the calloc), and that makes the problem reproducible, at least after two runs. So I've got: ... $ cat ./gcc/testsuite/gcc.dg/loop-unswitch-4.c #include <stdlib.h> int main (void) { const int N = 16; unsigned int *res; int i; res = (unsigned int *)calloc(N * sizeof (unsigned int), 1); int ret = 0; for (i = 0; i < N; ++i) ret += res[i]; for (i = 0; i < N; ++i) res[i] = 1; return ret; } ... and: ... $ gcc ./gcc/testsuite/gcc.dg/loop-unswitch-4.c $ ./install/bin/nvptx-none-run a.out; echo $? 15 $ ./install/bin/nvptx-none-run -O0 a.out; echo $? 15 ... On x86_64: ... $ gcc ./gcc/testsuite/gcc.dg/loop-unswitch-4.c $ ./a.out ; echo $? 0 ...