[Mesa-dev] [PATCH] gallivm: init MM = NULL to silence warning

Jose Fonseca jfonseca at vmware.com
Wed Mar 4 06:08:55 PST 2015


On 04/03/15 12:58, Jose Fonseca wrote:
> On 04/03/15 04:20, Matt Turner wrote:
>> On Tue, Mar 3, 2015 at 8:07 PM, Brian Paul <brianp at vmware.com> wrote:
>>> ---
>>>   src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> index 5210acc..e2578cf 100644
>>> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
>>> @@ -493,7 +493,7 @@
>>> lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>>>      builder.setMCPU(MCPU);
>>>   #endif
>>>
>>> -   ShaderMemoryManager *MM;
>>> +   ShaderMemoryManager *MM = NULL;
>>>      if (useMCJIT) {
>>>   #if HAVE_LLVM > 0x0303
>>>          BaseMemoryManager* JMM =
>>> reinterpret_cast<BaseMemoryManager*>(CMM);
>>> --
>>> 1.9.1
>>
>> I'm guessing it's the 'delete MM;' that generates the warning? If so,
>> shouldn't you just wrap it in #if HAVE_LLVM > ...?
>>
>> I think MCJIT is the only option in llvm >= 3.6? The code could
>> probably be trivially refactored to avoid the assert(0) as well.
>>
>>  From what I can tell, it seems like adding initializers is nearly
>> always the wrong thing to do.
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=eFrgqffTZg-fVfsgBecewE76PU07pVGCehKDjd2rc2Q&s=NmdJuPH44mfwP-iaquREc8ZPTboVxNFpMQhNXlMv2FY&e=
>>
>>
>
> Yes, this is probably related to
> https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.freedesktop.org_show-5Fbug.cgi-3Fid-3D89387&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=QY0p_bDuP-f3LPn9v8UCnsJc9MFPxmK5yIA_AQLYfpk&s=QtRiKhT6OE4Vfm-MYI7OR5SNu_iqhBPIOUnOp_5tmTc&e=
>
> But unfortunately I haven't found time to catch up with it.

On closer look, this is a different issue.  As Matt said, the issue is 
the delete for older LLVM.

That said, `delete NULL` is safe, hence Brian's patch is good.

Jose



More information about the mesa-dev mailing list