Skip to content

hipcc exits 0 when the compiler is killed by a signal #1948

Open

Description

@pvelesko

hipcc exits 0 when the compiler it runs is killed by a signal, so a crashed compile looks successful and no object file is written. Seen on macOS: clang hit an assertion (SIGABRT), hipcc returned 0, no .o.

HipBinUtil::exec in HIPCC/src/hipBin_util.h decodes the pclose status with WEXITSTATUS only:

int closeStatus = pclose(pipe);
sysOut.exitCode =  WEXITSTATUS(closeStatus);

When /bin/sh execs the single compile command (bash does this, and macOS /bin/sh is bash), clang is the direct child, its status is WIFSIGNALED, and WEXITSTATUS of that is 0. Dash on Linux does not exec, so it reports 134 and hides the bug. Forcing the exec reproduces it on Linux:

printf '#!/bin/sh\nkill -ABRT $$\n' > abrt-clang; chmod +x abrt-clang
echo '__global__ void k(){}' > t.hip
HIP_COMPILER_BIN="exec $PWD/abrt-clang" hipcc -c t.hip -o t.o; echo $?   # 0, no t.o
HIP_COMPILER_BIN="$PWD/abrt-clang" hipcc -c t.hip -o t.o; echo $?        # 134

The same code is in upstream ROCm/llvm-project amd/hipcc/src/hipBin_util.h; no upstream report found.

This issue was generated using AI

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:compilationConfiguration, compilation or linking failurescategory:correctnessIncorrect results, crashes and behavioral bugs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions