On Fri, Jan 26, 2024 at 03:04:11PM +0100, Richard Biener wrote:
> > > Otherwise it looks reasoanble to me, but let's see what Andrew thinks.
> >
> > 'n' before 'a', please. ;-)
>
> ?!
I've misspelled a word.
> @@ -1443,6 +1445,16 @@ suitable_hsa_agent_p (hsa_agent_t agent)
> switch (device_type)
> {
> case HSA_DEVICE_TYPE_GPU:
> + {
> + char name[64] = "nil";
> + if ((hsa_fns.hsa_agent_get_info_fn (agent, HSA_AGENT_INFO_NAME, name)
> + != HSA_STATUS_SUCCESS)
> + || isa_code (name) == EF_AMDGPU_MACH_UNSUPPORTED)
> + {
> + GCN_DEBUG ("Ignoring unsupported agent '%s'\n", name);
> + return false;
> + }
I must say I know nothing about HSA libraries, but generally if a function
that is supposed to fill some buffer fails the content of the buffer is
undefined/unpredictable.
So might be better not to not initialize name before calling the function
(unless it has to be initialized) and strcpy it to nil or something similar
if it fails.
Jakub