[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: heap corruption in du

From: Mikulas Patocka
Subject: Re: heap corruption in du
Date: Wed, 19 Oct 2005 14:05:29 +0200 (CEST)

On Mon, 10 Oct 2005, Paul Eggert wrote:

Mikulas Patocka <address@hidden> writes:

I mean if there's some probability that these experimental versions
will break system, possibly even breaking make install and preventing
reinstallation of old versions?

I doubt that would happen.  But if you're worried about it, save the
old versions before installing the new ones.

Just a bug report --- I got a failed build on intel C compiler 9.0. The problem is in autoconf. autoconf creates conftest.c files like this:

char pstat_getdynamic();
char (*f)()=pstat_getdynamic;
int main()
return f != pstat_getdynamic;

Intel compiler's interprocedural optimizations (-ipo) optimizes this out even though the symbol is unknown. Linking succeeds and ./a.out executable returning 0 is generated.

Coreutils than attempt to use the function and fail.

With this optimization, the compiler doesn't generate regular *.o files, but generates *.o files in its own intercode --- and when you attempt to link these files, the compiler takes intercode of all modules, optimizes it and runs linker on it. This whole-project optimization allows more advanced optimizations, such as finding that "f" is constant through the program, replacing "f != pstat_getdynamic" with zero and finally removing "f" because it is unused. Linker than sees no reference to pstat_getdynamic and generates proper ./a.out.

If you change the conftest file to somehow use the call to the function being tested, for example:

char pstat_getdynamic();
char (*f)()=pstat_getdynamic;
int main(int argc, char *argv[])
if (argc == 1) return f != pstat_getdynamic;
return f();

, the compiler will properly fail on unknown function.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]