[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: findings on swig-java-bindings

From: Gustav Munkby <grddev_at_gmx.net>
Date: 2004-03-13 11:02:14 CET

Philip Martin wrote:
> Ben Reser <ben@reser.org> writes:
>
>
>>>Gustav and I investigated these warnings via the gcc man page's doc for its
>>>-fstrict-aliasing flag.
>
>
>>I'd rather figure out how to fix the code than to turn off warnings. If
>>you want to grab me sometime I'll be happy to work with you to see if we
>>can't come up with a way to fix the warnings.
>
>
> The code in question is something like
>
> svn_txdelta_window_t *arg1 = (svn_txdelta_window_t *) 0 ;
> if ((SWIG_ConvertPtr(obj0,(void **) &arg1, ...
>
> One way to make it warning free would be
>
> svn_txdelta_window_t *arg1 = (svn_txdelta_window_t *) 0 ;
> void *tmp = arg1;
> if ((SWIG_ConvertPtr(obj0, &tmp, ....
> arg1 = tmp;
>
> I think gcc is warning that an optimizing compiler could assume that
> SWIG_ConvertPtr will not change arg1.
>
> http://www.gnu.org/software/gcc/bugs.html#nonbugs_c
> http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html
>

And as far as I can tell this "could" result in problems, which would be
very difficult to understand and very hard to find.

Adding -fno-strict-aliasing would be a solution, as it will not disable
the warnings, but rather disable the optmizations.

The best thing, would probably be to avoid these situations, but since
the code is generated by swig, it's a little hard for the swig-java
bindings to do anything about it.

I also get the same warnings if I try to compile the swig-python bindings.

Looking at the Makefile, the swig-perl bindings already has the
specified flag.

!g

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 13 11:02:27 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.