bug-coreutils
[Top][All Lists]
Advanced

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

Re: heap corruption in du


From: Paul Eggert
Subject: Re: heap corruption in du
Date: Wed, 19 Oct 2005 15:37:38 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Mikulas Patocka <address@hidden> writes:

> Intel compiler's interprocedural optimizations (-ipo) optimizes this
> out even though the symbol is unknown.

Wonderful.  (:-)

I installed the following patch to try to catch this.

2005-10-19  Paul Eggert  <address@hidden>

        * doc/autoconf.texi (Generating Sources): AC_LANG_PROGRAMS ->
        AC_LANG_PROGRAM, fixing a typo.  Don't give details about
        the inner workings of AC_LANG_FUNC_LINK_TRY.
        * lib/autoconf/c.m4 (AC_LANG_CALL(C)): Reformat to match
        AC_LANG_FUNC_LINK_TRY.  This involves returning the value returned
        by the function rather than ignoring it.
        (AC_LANG_FUNC_LINK_TRY(C)): Call the function rather than simply
        comparing its address.  Intel's interprocedural optimization was
        outsmarting the old heuristic.  Problem reported by
        Mikulas Patocka.

--- doc/autoconf.texi   1 Sep 2005 13:49:02 -0000       1.929
+++ doc/autoconf.texi   19 Oct 2005 22:33:51 -0000
@@ -2997,7 +2997,7 @@ breed: they are executed directly by @fi
 Execute the @var{cmds} right before creating @file{config.status}.
 
 This macro presents the last opportunity to call @code{AC_SUBST},
address@hidden, or @code{AC_CONFIG_FOOS} macros. 
address@hidden, or @code{AC_CONFIG_FOOS} macros.
 @end defmac
 
 @defmac AC_CONFIG_COMMANDS_POST (@var{cmds})
@@ -6921,7 +6921,7 @@ fputs (hw, stdout);
 @acindex{LANG_CALL}
 Expands into a source file which consists of the @var{prologue}, and
 then a call to the @var{function} as body of the main function (e.g.,
address@hidden in C).  Since it uses @code{AC_LANG_PROGRAMS}, the feature
address@hidden in C).  Since it uses @code{AC_LANG_PROGRAM}, the feature
 of the latter are available.
 
 This function will probably be replaced in the future by a version
@@ -6932,10 +6932,9 @@ not encouraged, as it violates strongly 
 
 @defmac AC_LANG_FUNC_LINK_TRY (@var{function})
 @acindex{LANG_FUNC_LINK_TRY}
-Expands into a source file which consists of a pseudo use of the
address@hidden as body of the main function (e.g., @code{main} in C): a
-simple (function pointer) assignment.  Since it uses
address@hidden, the feature of the latter are available.
+Expands into a source file which uses the @var{function} in the body of
+the main function (e.g., @code{main} in C).  Since it uses
address@hidden, the feature of the latter are available.
 
 As @code{AC_LANG_CALL}, this macro is documented only for completeness.
 It is considered to be severely broken, and in the future will be
--- lib/autoconf/c.m4   7 Sep 2005 14:43:14 -0000       1.203
+++ lib/autoconf/c.m4   19 Oct 2005 22:33:51 -0000
@@ -162,13 +162,13 @@ $2
 m4_define([AC_LANG_CALL(C)],
 [AC_LANG_PROGRAM([$1
 m4_if([$2], [main], ,
-[/* Override any gcc2 internal prototype to avoid an error.  */
+[/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char $2 ();])], [$2 ();])])
+char $2 ();])], [return $2 ();])])
 
 
 # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
@@ -204,26 +204,20 @@ m4_define([AC_LANG_FUNC_LINK_TRY(C)],
 
 #undef $1
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $1 ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$1) || defined (__stub___$1)
 choke me
-#else
-char (*f) () = $1;
-#endif
-#ifdef __cplusplus
-}
 #endif
-], [return f != $1;])])
+], [return $1 ();])])
 
 
 # AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION)




reply via email to

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