[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-16 22:50:47 CET

> > It's possible these warnings are false alarms, but if they are not
> > then the code is broken, and it may get miscompiled by compilers other
> > than gcc. If we hide the warnings in the normal development
> > environment there is less incentive to fix the code, or even
> > investigate if we really have a problem.
> >
> > On the other hand if gcc really is going to produce invalid object
> > code from our invalid source code then it seems sensible to enable
> > this for production. Perhaps this flag should only be added if
> > enable-maintainer-mode is not used?
>
> Has anyone actually tried to fix these warnings yet? As opposed to just
> hiding them?
>

Since the code is automatically generated by SWIG, the proper way of fixing
it is probably to change the SWIG implementation accordingly.

If talking about quick fixes, all these dirty casts could be changed into
using
(char *) instead of (void *) since the compiler can't assume that char
pointers
don't overlap other pointers and therefore can't perform these potentially
dangerous optimizations.

The above solution provides the same functionality as adding
-fno-strict-aliasing,
but with less security, since some cases most certainly will be missed.

Another solution would be to not use an optimization lever >= 2 for gcc3,
but
that is also a "go around the problem" solution.

As someone suggested, a possible solution would be to have to separate
variables
and assign back and forth, this would also disable the compiler from doing
the
incorrect optimizations, but this will most certainly have to be done by
hand,
which somewhat defeats the point of using swig in the first place.

Since it's really a problem with gcc3 trying to apply inapplicable
optimizations,
I think it should be dealt as such and therefore the best option available
would
be to actually use -fno-strict-aliasing.

But that's only my opinion, and I'm not really in a position to decide here.

!g

-- 
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 16 22:51:03 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.