robertwb / issues-import-test

0 stars 0 forks source link

Conversion error from __PYX_VERIFY_RETURN_INT on 32bit systems #110

Closed robertwb closed 7 years ago

robertwb commented 7 years ago

Reported by nikratio on 1 Feb 2016 17:14 UTC It seems __PYX_VERIFY_RETURN_INT may fail on 32 bit systems, it produces a conversion warning:

src/llfuse.c:49266:64: error: conversion to 'sdigit' from 'int' may alter its value [                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) digits[0](-Werror=conversion]
))

I don't have a 32-bit system myself, this was originally reported at https://bitbucket.org/nikratio/python-llfuse/issues/76.

The Cython generated code and the .pyx source can be downloaded from https://bitbucket.org/nikratio/python-llfuse/downloads. The C code in the tarball was generated with Cython 0.24.0a0 (from Git).

Migrated-From: http://trac.cython.org/ticket/877

robertwb commented 7 years ago

Modified by nikratio on 2 Feb 2016 17:13 UTC

robertwb commented 7 years ago

Comment by nikratio on 16 Feb 2016 20:29 UTC I believe this is just precedence gone wrong, the generated code should be:

case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) -digits[0])

Otherwise the minus promotes to integer after the cast to sdigit.

robertwb commented 7 years ago

Comment by nikratio on 16 Feb 2016 20:33 UTC ...and here's a patch against git head. Thanks to Christian Neukirchen for investigating!

diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c
--- a/Cython/Utility/TypeConversion.c
+++ b/Cython/Utility/TypeConversion.c
@@ -685,7 +685,7 @@
             const digit* digits = ((PyLongObject*)x)->ob_digit;
             switch (Py_SIZE(x)) {
                 case  0: return ({{TYPE}}) 0;
-                case -1: __PYX_VERIFY_RETURN_INT({{TYPE}}, sdigit, -(sdigit) digits[               case -1: __PYX_VERIFY_RETURN_INT({{TYPE}}, sdigit, (sdigit) -digits[0](0])
+))
                 case  1: __PYX_VERIFY_RETURN_INT({{TYPE}},  digit, +digits[0])
                 {{for _size in (2, 3, 4)}}
robertwb commented 7 years ago

Modified by nikratio on 16 Feb 2016 20:33 UTC

robertwb commented 7 years ago

Modified by scoder on 24 Mar 2016 17:51 UTC

robertwb commented 7 years ago

Modified by scoder on 24 Mar 2016 17:51 UTC