[Pkg-dia-team] Bug#364544: dia: implicit pointer conversion

dann frazier dannf at debian.org
Mon Apr 24 21:04:54 UTC 2006

On Mon, Apr 24, 2006 at 10:15:56PM +0200, Roland Stigge wrote:
> dann frazier wrote:
> > My patch removes the --std=c89 CFLAG.
> >  * --std=c89 is the same as -ansi (according to gcc manpage)
> >  * -ansi causes __STRICT_ANSI__ to be defined
> >  * in features.h, __STRICT_ANSI__ prevents __USE_POSIX from being defined
> >  * features.h is included by stdio.h
> >  * stdio.h defines popen and fdopen only if __USE_POSIX is defined
> > 
> > So, this isn't just a warning suppression.
> And how is popen and fdopen related to implicit pointer conversions?

dia is using these functions without having the prototypes defined (as
I explained above).

Therefore, the compiler doesn't know what the return value should be,
so it is implicitly converting it to an integer.

This happens to be harmless on archs where ints and pointers are the
same size.  But on archs where pointers are greater than integers, the
pointer will be truncated.

What this means is that anywhere you use the return value from popen
or fdopen you will currently segfault on certain architectures,
including ia64 and amd64.

dann frazier

More information about the Pkg-dia-team mailing list