Huge number of warnings "local variable '...' referenced before assignment in sage 5.1.beta6

69 views
Skip to first unread message

Julien Puydt

unread,
Jun 25, 2012, 6:04:32 PM6/25/12
to Sage Devel
Hi,

I compiled 5.1.beta6 this evening (first version since long to compile
with gcc 4.7, yeah!), and noticed a huge number of warnings "local
variable '...' referenced before assignment ; in fact :

$ grep install.log -e "referenced before assignment" | wc -l
698

$ grep spkg/logs/*log -e "referenced before assignment" -l
spkg/logs/sage-5.1.beta6.log

so it's only in the sage spkg that those occur.

Is that a known issue?

Snark on #sagemath

David Roe

unread,
Jun 25, 2012, 6:36:40 PM6/25/12
to sage-...@googlegroups.com
It's due to a change in Cython.  Cython now emits warnings for things like

cdef mpz_t a
mpz_init(a)

since a hasn't been initialized.

I don't know if anyone's working on getting rid of the warnings; I agree that they're annoying.
David



--
To post to this group, send an email to sage-...@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

François Bissey

unread,
Jun 25, 2012, 6:42:04 PM6/25/12
to sage-...@googlegroups.com
On Mon, 25 Jun 2012 18:36:40 David Roe wrote:
> It's due to a change in Cython. Cython now emits warnings for things like
>
> cdef mpz_t a
> mpz_init(a)
>
> since a hasn't been initialized.
>
> I don't know if anyone's working on getting rid of the warnings; I agree
> that they're annoying.
> David
>
Robert Bradshaw opened a ticket about it after the cython upgrade that caused
this but there is nothing workable so far.

Francois

Robert Bradshaw

unread,
Jun 26, 2012, 1:12:15 AM6/26/12
to sage-...@googlegroups.com
The solution is to fix the definition in

http://hg.sagemath.org/sage-main/file/01e0779db321/sage/libs/gmp/types.pxd#l1

to be

ctypedef __mpz_struct[1] mpz_t

but due to several miss-uses of mpz_t in the sources, this is easier
said than done.

- Robert

Robert Bradshaw

unread,
Jun 26, 2012, 2:33:33 AM6/26/12
to sage-...@googlegroups.com
On Mon, Jun 25, 2012 at 10:12 PM, Robert Bradshaw
<robe...@math.washington.edu> wrote:
> On Mon, Jun 25, 2012 at 3:42 PM, François Bissey
> <francoi...@canterbury.ac.nz> wrote:
>> On Mon, 25 Jun 2012 18:36:40 David Roe wrote:
>>> It's due to a change in Cython.  Cython now emits warnings for things like
>>>
>>> cdef mpz_t a
>>> mpz_init(a)
>>>
>>> since a hasn't been initialized.
>>>
>>> I don't know if anyone's working on getting rid of the warnings; I agree
>>> that they're annoying.
>>> David
>>>
>> Robert Bradshaw opened a ticket about it after the cython upgrade that caused
>> this but there is nothing workable so far.
>
> The solution is to fix the definition in
>
> http://hg.sagemath.org/sage-main/file/01e0779db321/sage/libs/gmp/types.pxd#l1
>
> to be
>
>    ctypedef __mpz_struct mpz_t[1]
>
> but due to several miss-uses of mpz_t in the sources, this is easier
> said than done.

And this needs Cython 0.16+ to handle taking the address of a
so-declared typedef.

- Robert
Reply all
Reply to author
Forward
0 new messages