This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR gcov-profile/54487 (profiledbootstrap intermittent failures) (issue6496113)


On Wed, Sep 12, 2012 at 01:45:12PM -0700, Teresa Johnson wrote:
> This fixes PR gcov-profile/54487 where the gcda files were not locked
> by the profile-use read, enabling writes by other instrumented compiles
> to change the profile in the middle of the profile use read. The GCOV_LOCKED
> macro was not set because it was guarded by HOST_HAS_F_SETLKW, which was
> never set. The fix is to add a compile test in the configure to set it.
> 
> Tested with bootstrap and profiledbootstrap on x86_64-unknown-linux-gnu.
> Ok for trunk?
> 
> Thanks,
> Teresa
> 
> 2012-09-12  Teresa Johnson  <tejohnson@google.com>
> 

Please include
	PR gcov-profile/54487
here in the ChangeLog entry.

> 	* configure.ac(HOST_HAS_F_SETLKW): Set based on compile

Space before (.

> 	test using F_SETLKW with fcntl.
> 	* configure, config.in: Regenerate.
> 
> --- configure.ac	(revision 191225)
> +++ configure.ac	(working copy)
> @@ -1159,6 +1159,16 @@ if test $gcc_cv_type_clock_t = yes; then
>    [Define if <time.h> defines clock_t.])
>  fi
>  
> +# Check if F_SETLKW is supported by fcntl.
> +AC_CACHE_CHECK(for F_SETLKW, ac_cv_f_setlkw, [
> +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
> +#include "fcntl.h"

Please use
#include <fcntl.h>
instead.

> +]], [[struct flock fl; fl.l_whence = 0; fl.l_start = 0; fl.l_len = 0; fl.l_pid = 0; return fcntl (1, F_SETLKW, &fl);]])],[ac_cv_f_setlkw=yes],[ac_cv_f_setlkw=no])])

And split this overlong line, there is no reason why you can't use a newline
e.g. after every ; in the test proglet.

> +if test $ac_cv_f_setlkw = yes; then
> +  AC_DEFINE(HOST_HAS_F_SETLKW, 1,
> +  [Define if F_SETLKW supported by fcntl.])
> +fi
> +
>  # Restore CFLAGS, CXXFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
>  CFLAGS="$saved_CFLAGS"
>  CXXFLAGS="$saved_CXXFLAGS"

Ok for trunk with those changes, IMHO it would be worthwhile to put this
into 4.7 too, I've seen several unexplained profiledbootstrap errors on
that branch in the past already when using make -jN with high N.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]