(Yes, I like to play with test-grade builds 8-) The new optimizer in GCC 4.5 (correctly) turns the tail-recursive c-stack test in the configure script in diffutils-2.8.7 into an endless loop. This causes builds to hang in the configure script. The one-line patch (here as text, and hopefully attached) fixes the test. I am sure this should go upstream as well, but I don't know where to do that. 8-) Reproducible: Always Steps to Reproduce: 1. emerge and gcc-config gcc version 4.5.1 2. emerge --oneshot diffutils Actual Results: will hang in configure forever at the check for stack overruns. Expected Results: oughta just build normally. The below patch fixes both the configure script and the m4 macro that generated same, so that both kinds of users can stay happy. By calling "recurse" twice in the return we prevent the tail-recursion-to-loop transformation from eating the recursion. The code should work for old and new compilers equally. (will attach file as well after bug creation.) diff -rup diffutils-2.8.7.orig/configure diffutils-2.8.7/configure --- diffutils-2.8.7.orig/configure 2004-04-13 00:04:38.000000000 -0700 +++ diffutils-2.8.7/configure 2010-10-13 21:45:49.865239663 -0700 @@ -8396,7 +8396,7 @@ cat >>conftest.$ac_ext <<_ACEOF { char array[500]; array[0] = 1; - return *p + recurse (array); + return *p + recurse (array) - recurse (array); } int diff -rup diffutils-2.8.7.orig/m4/c-stack.m4 diffutils-2.8.7/m4/c-stack.m4 --- diffutils-2.8.7.orig/m4/c-stack.m4 2004-03-07 15:51:10.000000000 -0800 +++ diffutils-2.8.7/m4/c-stack.m4 2010-10-13 21:16:29.326926806 -0700 @@ -102,7 +102,7 @@ AC_DEFUN([AC_SYS_X
Created attachment 250521 [details, diff] patch to configure data to let package build under gcc 4.5 Should be safe for all versions of gcc and all versions of diffutils.
post size limit ate the patch text, but I attached the original (which I successfully tested with an .ebuild in my PORTDIR_OVERLAY directory).
Comment on attachment 250521 [details, diff] patch to configure data to let package build under gcc 4.5 just noticed I use "+" in one place and "-" in the other. whoops. Doesn't matter functionally, but probably ought to be consistent.
Created attachment 250523 [details, diff] patch to configure data to let package build under gcc 4.5 (Use same operator in both segments to prevent confusion later...) Patch simply calls "recurse (array)" twice instead of just once in the return statement in the function recurse(char *p). The advanced tail recursion detection in GCC 4.5* will convert the original single-call version of the test into an endless loop.
already in upstream: http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=91a109c0426e8b8cd8b317e29c8a91bd99757f0a commit 91a109c0426e8b8cd8b317e29c8a91bd99757f0a Author: Eric Blake <ebb9@byu.net> Date: Tue Sep 23 08:56:10 2008 -0600 c-stack: avoid compiler optimizations when provoking overflow * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Make recursion harder to optimize, to ensure a stack overflow occurs. * tests/test-c-stack.c (recurse): Likewise. Borrowed from libsigsegv.
(In reply to comment #5) > already in upstream: > http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=91a109c0426e8b8cd8b317e29c8a91bd99757f0a > > commit 91a109c0426e8b8cd8b317e29c8a91bd99757f0a > Author: Eric Blake <ebb9@byu.net> > Date: Tue Sep 23 08:56:10 2008 -0600 > > c-stack: avoid compiler optimizations when provoking overflow > > * m4/c-stack.m4 (AC_SYS_XSI_STACK_OVERFLOW_HEURISTIC): Make > recursion harder to optimize, to ensure a stack overflow occurs. > * tests/test-c-stack.c (recurse): Likewise. > Borrowed from libsigsegv. > that's 2008. Is the stable version of diffutils in the tree that *old*. May be a new diffutils should be made stable altogether, this is the only bug returned when I searched for diffutils in bugzilla so the 30 days requirement should be fulfilled.
I have been told that both gcc 4.5 and the fixed diffutils are ~arch keyworded at the moment, so it's not a problem :) They just need to be stabilized at the same time.
> that's 2008. Is the stable version of diffutils in the tree that *old*. > May be a new diffutils should be made stable altogether, this is the only bug > returned > when I searched for diffutils in bugzilla so the 30 days requirement should be > fulfilled. Then file a stabilization bug.
(In reply to comment #8) > > that's 2008. Is the stable version of diffutils in the tree that *old*. > > May be a new diffutils should be made stable altogether, this is the only bug > > returned > > when I searched for diffutils in bugzilla so the 30 days requirement should be > > fulfilled. > > Then file a stabilization bug. well today I had this problem ,I have a stable system (not world) this is anoying. I am asking to stablize anew version of diffutils or a pached version of diffutils-2.8.7 the one I have had this problem. using stable version :sys-apps/diffutils-2.8.7-r2 after rsync Sun Mar 20 16:17:07 VET 2011 no sure how to ask for stabilization (simple user) filled Bug 359657 would like someone to have a look at this.
I still get an infinite loop in conftest every single time I build sys-apps/diffutils-2.8.7-r2 with gcc-4.5.2. Even in clean metro builds.
(In reply to comment #10) > I still get an infinite loop in conftest every single time I build > sys-apps/diffutils-2.8.7-r2 with gcc-4.5.2. Even in clean metro builds. I'm seeing this as well. sys-apps/diffutils-2.9-r1 is fine though.