Lisandro Dalcin | 2 Mar 15:00
Picon
Gravatar

Re: [Cython] PATCH: use function pointer arguments in import/export api functions

Stefan, is this the only warning you get related to strict aliasing?
No warnings at all on those lines where  __Pyx_ExportFunction is
called??

If that is the only warning, they I can write a better patch.

On Fri, Feb 27, 2009 at 7:21 PM, Stefan Behnel <stefan_ml@...> wrote:
> Hi,
>
> Lisandro Dalcin wrote:
>> Just to prevent this:
>> warning: ISO C forbids conversion of function pointer to object pointer type
>
> with this patch applied, I now get a warning on this line:
>
>    p = *(void **)&f;
>
> src/lxml/lxml.etree.c: In function '__Pyx_ExportFunction':
>
>
> src/lxml/lxml.etree.c:148416: warning: dereferencing type-punned pointer
> will break strict-aliasing rules
>
>
> This needs fixing, I guess. That said, I'm more in favour of enabling clean
> strict-aliasing than to be strictly C89 compliant, unless we can have both. :)
>
> Stefan
>
> _______________________________________________
(Continue reading)

Stefan Behnel | 2 Mar 15:08
Picon
Favicon

Re: [Cython] PATCH: use function pointer arguments in import/export api functions

Lisandro Dalcin wrote:
> Stefan, is this the only warning you get related to strict aliasing?
> No warnings at all on those lines where  __Pyx_ExportFunction is
> called??

Yes, the only one that is left under Py3.

> If that is the only warning, they I can write a better patch.

Please do.

Stefan

Lisandro Dalcin | 2 Mar 22:21
Picon
Gravatar

Re: [Cython] PATCH: use function pointer arguments in import/export api functions

Stefan, here you have the new patch... Check GCC manpages about
-fstrict-aliasing, this should work. Moreover, this pattern is used on
Open MPI codebase, likely for the same issues.

On Mon, Mar 2, 2009 at 12:08 PM, Stefan Behnel <stefan_ml@...> wrote:
> Lisandro Dalcin wrote:
>> Stefan, is this the only warning you get related to strict aliasing?
>> No warnings at all on those lines where  __Pyx_ExportFunction is
>> called??
>
> Yes, the only one that is left under Py3.
>
>
>> If that is the only warning, they I can write a better patch.
>
> Please do.
>
> Stefan
>
> _______________________________________________
> Cython-dev mailing list
> Cython-dev@...
> 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)
(Continue reading)

Stefan Behnel | 7 Mar 21:31
Picon
Favicon

Re: [Cython] PATCH: use function pointer arguments in import/export api functions

Hi Lisandro,

sorry for the late reply, I didn't see your e-mail until now.

Lisandro Dalcin wrote:
> Stefan, here you have the new patch...

This looks totally hackish, but ...

> Check GCC manpages about -fstrict-aliasing, this should work.

I did, they are actually presenting exactly this as an example that works.
I guess that's the way to do it, then.

Anyway, lxml compiles without aliasing warnings with your patch, so I'm ok
with applying it.

Stefan

Lisandro Dalcin | 8 Mar 00:15
Picon
Gravatar

Re: [Cython] PATCH: use function pointer arguments in import/export api functions

Yes, it seems hackish, but I do not know of any other way, and other
codes do also use this hackery...

Please, could you push the fixes?

On Sat, Mar 7, 2009 at 5:31 PM, Stefan Behnel <stefan_ml@...> wrote:
> Hi Lisandro,
>
> sorry for the late reply, I didn't see your e-mail until now.
>
> Lisandro Dalcin wrote:
>> Stefan, here you have the new patch...
>
> This looks totally hackish, but ...
>
>> Check GCC manpages about -fstrict-aliasing, this should work.
>
> I did, they are actually presenting exactly this as an example that works.
> I guess that's the way to do it, then.
>
> Anyway, lxml compiles without aliasing warnings with your patch, so I'm ok
> with applying it.
> - Show quoted text -
> Stefan
>
> _______________________________________________
> Cython-dev mailing list
> Cython-dev@...
> http://codespeak.net/mailman/listinfo/cython-dev
>
(Continue reading)

Stefan Behnel | 8 Mar 08:37
Picon
Favicon

Re: [Cython] PATCH: use function pointer arguments in import/export api functions


Lisandro Dalcin wrote:
> Yes, it seems hackish, but I do not know of any other way, and other
> codes do also use this hackery...
> 
> Please, could you push the fixes?

It's up.

Stefan


Gmane