|
if ((IsDeviceOffloadAction && |
|
!JA.isDeviceOffloading(Action::OFK_OpenMP) && !Triple.isAMDGPU() && |
|
!IsUsingOffloadNewDriver) || |
|
(JA.isDeviceOffloading(Action::OFK_SYCL) && !IsSYCLLTOSupported)) { |
|
D.Diag(diag::err_drv_unsupported_opt_for_target) |
|
<< Args.getLastArg(options::OPT_foffload_lto, |
|
options::OPT_foffload_lto_EQ) |
|
->getAsString(Args) |
|
<< Triple.getTriple(); |
|
} else if (Triple.isNVPTX() && !IsRDCMode && |
|
JA.isDeviceOffloading(Action::OFK_Cuda)) { |
|
D.Diag(diag::err_drv_unsupported_opt_for_language_mode) |
|
<< Args.getLastArg(options::OPT_foffload_lto, |
|
options::OPT_foffload_lto_EQ) |
|
->getAsString(Args) |
|
<< "-fno-gpu-rdc"; |
|
} else if (JA.isDeviceOffloading(Action::OFK_SYCL) && |
|
IsDeviceCodeSplitDisabled && LTOMode == LTOK_Thin) { |
|
D.Diag(diag::err_drv_sycl_thinlto_split_off) |
|
<< SYCLSplitMode->getAsString(Args) |
|
<< Args.getLastArg(options::OPT_foffload_lto, |
|
options::OPT_foffload_lto_EQ) |
|
->getAsString(Args); |
|
} else { |
The pattern used in this code doesn't the pointer returned by Args.getLastArg(options::OPT_foffload_lto, options::OPT_foffload_lto_EQ) before dereferencing. This can be source of UB.
llvm/clang/lib/Driver/ToolChains/Clang.cpp
Lines 6000 to 6023 in 2705b67
The pattern used in this code doesn't the pointer returned by
Args.getLastArg(options::OPT_foffload_lto, options::OPT_foffload_lto_EQ)before dereferencing. This can be source of UB.