Well, the following snippet generates the warning (GCC 4.1.1). I
believe the warning is superfluous, but the generated C code is rather
contrived, it seems my GCC cannot "unroll" such pieces of code with
'goto' and 'switch' all around.

def dowork(): pass
def cleanup(): pass

def test():
    try:
        dowork()
    finally:
        cleanup()



On Fri, Aug 22, 2008 at 3:03 AM, Robert Bradshaw
<[EMAIL PROTECTED]> wrote:
> On Aug 21, 2008, at 2:35 PM, Lisandro Dalcin wrote:
>
>> I'm getting warnings about uninitialised variables in try/finally
>> blocks. As far as I can follow the flow in the generated C code, the
>> warning is actually superfluous. Any chance for this being pushed?
>>
>> diff -r 6488f2d89e72 Cython/Compiler/Nodes.py
>> --- a/Cython/Compiler/Nodes.py        Tue Aug 19 04:13:56 2008 -0700
>> +++ b/Cython/Compiler/Nodes.py        Thu Aug 21 18:24:40 2008 -0300
>> @@ -3667,6 +3667,9 @@ class TryFinallyStatNode(StatNode):
>>                  code.putln(
>>                      "int %s;" % Naming.exc_lineno_name)
>>              code.use_label(catch_label)
>> +            if error_label_used and self.preserve_exception:
>> +                code.put(
>> +                    "%s = 0; " % Naming.exc_lineno_name)
>>              code.putln(
>>                      "__pyx_why = 0; goto %s;" % catch_label)
>>              for i in cases_used:
>>
>>
>
>
> Yes, I would very much like to reduce warnings. Could you give me an
> example of some code that this fixes?
>
> - Robert
>
>
> _______________________________________________
> Cython-dev mailing list
> [email protected]
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to