[PATCH] Fix bootstrap on powerpc*-aix* (PR bootstrap/70704)

Jason Merrill jason@redhat.com
Mon Apr 25 19:42:00 GMT 2016


Looks good to me.

Jason

On Mon, Apr 25, 2016 at 3:30 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As mentioned in the PR, some checking code, in particular the one
> in C++ FE's build_non_dependent_expr, may affect code generation, as it can
> instantiate templates that aren't instantiated otherwise, which affects
> the various counters like cfun->funcdef_no, DECL_UID etc.
>
> I'd like to commit the attached (shorter, safer) patch to gcc 6 branch,
> which just disables this checking.
>
> The larger, included patch, makes -fchecking a 3 state option, -fno-checking
> aka -fchecking=0, no checking, -fchecking aka -fchecking=1 the previous
> -fchecking except for the build_non_dependent_expr bits, and -fchecking=2
> as checking that might affect code generation and tweaks the configury,
> so that for non-release builds it defaults to this -fchecking=2, while for
> release checking builds stage1 defaults to -fchecking=1 and stage2+
> defaults to -fno-checking.
>
> The shorter patch is currently being bootstrapped on powerpc-ibm-aix7.1.3.0,
> the larger patch I've so far bootstrapped/regtested on x86_64-linux and
> i686-linux on gcc-6 branch with implicit --enable-checking=release (where
> stage1 performs yes but no extra checking), --disable-checking,
> --enable-checking=yes,rtl and on the trunk so far bootstrapped and regtest
> --pending with --enable-checking=yes,extra,rtl.  Will still check
> also the implicit --enable-checking=yes,extra.
>
> Ok for trunk (the included patch) and 6 branch (the attached patch)?
>
> 2016-04-25  Jakub Jelinek  <jakub@redhat.com>
>
>         PR bootstrap/70704
>         * configure.ac (--enable-stage1-checking): For --disable-checking or
>         implicit --enable-checking, make sure extra flag matches in between
>         stage1 and later checking.
>         * configure: Regenerated.
> gcc/
>         * configure.ac (--enable-checking): Document extra flag, for
>         non-release builds default to --enable-checking=yes,extra.
>         If misc checking and extra checking, define CHECKING_P to 2 instead
>         of 1.
>         * common.opt (fchecking=): Add.
>         * doc/invoke.texi (-fchecking=): Document.
>         * doc/install.texi: Document --enable-checking changes.
>         * configure: Regenerated.
>         * config.in: Regenerated.
> gcc/cp/
>         * pt.c (build_non_dependent_expr): Use flag_checking > 1 instead of
>         just flag_checking.
>
> --- configure.ac.jj     2016-03-17 23:58:35.000000000 +0100
> +++ configure.ac        2016-04-25 18:15:34.703842886 +0200
> @@ -3530,16 +3530,17 @@ AC_ARG_ENABLE(stage1-checking,
>    # For --disable-checking or implicit --enable-checking=release, avoid
>    # setting --enable-checking=gc in the default stage1 checking for LTO
>    # bootstraps.  See PR62077.
> -  stage1_checking=--enable-checking=release,misc,gimple,rtlflag,tree,types
>    case $BUILD_CONFIG in
>      *lto*)
> -      if test "x$enable_checking" = x && \
> -        test -d ${srcdir}/gcc && \
> -        test x"`cat ${srcdir}/gcc/DEV-PHASE`" = xexperimental; then
> -       stage1_checking=--enable-checking=yes,types
> -      fi;;
> -    *) stage1_checking=--enable-checking=yes,types;;
> +      stage1_checking=--enable-checking=release,misc,gimple,rtlflag,tree,types;;
> +    *)
> +      stage1_checking=--enable-checking=yes,types;;
>    esac
> +  if test "x$enable_checking" = x && \
> +     test -d ${srcdir}/gcc && \
> +     test x"`cat ${srcdir}/gcc/DEV-PHASE`" = xexperimental; then
> +    stage1_checking=yes,types,extra
> +  fi
>  else
>    stage1_checking=--enable-checking=$enable_checking,types
>  fi])
> --- gcc/configure.ac.jj 2016-01-27 19:47:35.000000000 +0100
> +++ gcc/configure.ac    2016-04-25 17:56:40.789041032 +0200
> @@ -516,12 +516,12 @@ AC_ARG_ENABLE(checking,
>                 [enable expensive run-time checks.  With LIST,
>                  enable only specific categories of checks.
>                  Categories are: yes,no,all,none,release.
> -                Flags are: assert,df,fold,gc,gcac,gimple,misc,
> +                Flags are: assert,df,extra,fold,gc,gcac,gimple,misc,
>                  rtlflag,rtl,runtime,tree,valgrind,types])],
>  [ac_checking_flags="${enableval}"],[
>  # Determine the default checks.
>  if test x$is_release = x ; then
> -  ac_checking_flags=yes
> +  ac_checking_flags=yes,extra
>  else
>    ac_checking_flags=release
>  fi])
> @@ -531,32 +531,33 @@ do
>         case $check in
>         # these set all the flags to specific states
>         yes)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
> -                       ac_fold_checking= ; ac_gc_checking=1 ;
> +                       ac_fold_checking= ; ac_gc_checking=1 ; ac_extra_checking= ;
>                         ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
>                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
>                         ac_tree_checking=1 ; ac_valgrind_checking= ;
>                         ac_types_checking=1 ;;
>         no|none)        ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
> -                       ac_fold_checking= ; ac_gc_checking= ;
> +                       ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
>                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
>                         ac_rtlflag_checking= ; ac_runtime_checking= ;
>                         ac_tree_checking= ; ac_valgrind_checking= ;
>                         ac_types_checking= ;;
>         all)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
> -                       ac_fold_checking=1 ; ac_gc_checking=1 ;
> +                       ac_fold_checking=1 ; ac_gc_checking=1 ; ac_extra_checking=1 ;
>                         ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
>                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
>                         ac_tree_checking=1 ; ac_valgrind_checking= ;
>                         ac_types_checking=1 ;;
>         release)        ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
> -                       ac_fold_checking= ; ac_gc_checking= ;
> +                       ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
>                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
>                         ac_rtlflag_checking= ; ac_runtime_checking=1 ;
>                         ac_tree_checking= ; ac_valgrind_checking= ;
>                         ac_types_checking= ;;
>         # these enable particular checks
>         assert)         ac_assert_checking=1 ;;
> -       df)             ac_df_checking=1 ;;
> +       df)             ac_df_checking=1 ;;
> +       extra)          ac_extra_checking=1 ;;
>         fold)           ac_fold_checking=1 ;;
>         gc)             ac_gc_checking=1 ;;
>         gcac)           ac_gc_always_collect=1 ;;
> @@ -575,9 +576,13 @@ IFS="$ac_save_IFS"
>
>  nocommon_flag=""
>  if test x$ac_checking != x ; then
> -  AC_DEFINE(CHECKING_P, 1,
> +  if test x$ac_extra_checking != x ; then
> +    ac_checking=2
> +  fi
> +  AC_DEFINE_UNQUOTED(CHECKING_P, $ac_checking,
>  [Define to 1 if you want more run-time sanity checks.  This one gets a grab
> -   bag of miscellaneous but relatively cheap checks.])
> +   bag of miscellaneous but relatively cheap checks.  Define to 2 if you want
> +   also extra run-time checking that might affect code generation.])
>    nocommon_flag=-fno-common
>  else
>    AC_DEFINE(CHECKING_P, 0)
> --- gcc/common.opt.jj   2016-03-17 16:54:46.000000000 +0100
> +++ gcc/common.opt      2016-04-25 17:46:20.112362251 +0200
> @@ -1029,6 +1029,10 @@ fchecking
>  Common Var(flag_checking) Init(CHECKING_P)
>  Perform internal consistency checkings.
>
> +fchecking=
> +Common Joined RejectNegative UInteger Var(flag_checking)
> +Perform internal consistency checkings.
> +
>  fcombine-stack-adjustments
>  Common Report Var(flag_combine_stack_adjustments) Optimization
>  Looks for opportunities to reduce stack adjustments and stack references.
> --- gcc/cp/pt.c.jj      2016-04-22 18:21:27.000000000 +0200
> +++ gcc/cp/pt.c 2016-04-25 17:43:05.478972266 +0200
> @@ -23623,8 +23623,10 @@ build_non_dependent_expr (tree expr)
>
>    /* When checking, try to get a constant value for all non-dependent
>       expressions in order to expose bugs in *_dependent_expression_p
> -     and constexpr.  */
> -  if (flag_checking && cxx_dialect >= cxx11
> +     and constexpr.  This can affect code generation, see PR70704, so
> +     only do this for -fchecking=2.  */
> +  if (flag_checking > 1
> +      && cxx_dialect >= cxx11
>        /* Don't do this during nsdmi parsing as it can lead to
>          unexpected recursive instantiations.  */
>        && !parsing_nsdmi ())
> --- gcc/doc/invoke.texi.jj      2016-04-22 18:21:28.000000000 +0200
> +++ gcc/doc/invoke.texi 2016-04-25 18:01:03.666517058 +0200
> @@ -501,7 +501,8 @@ Objective-C and Objective-C++ Dialects}.
>  @item Developer Options
>  @xref{Developer Options,,GCC Developer Options}.
>  @gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
> --fchecking -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
> +-fchecking -fchecking=@var{n} -fdbg-cnt-list @gol
> +-fdbg-cnt=@var{counter-value-list} @gol
>  -fdisable-ipa-@var{pass_name} @gol
>  -fdisable-rtl-@var{pass_name} @gol
>  -fdisable-rtl-@var{pass-name}=@var{range-list} @gol
> @@ -12368,10 +12369,12 @@ Here are some examples showing uses of t
>  @end smallexample
>
>  @item -fchecking
> +@itemx -fchecking=@var{n}
>  @opindex fchecking
>  @opindex fno-checking
>  Enable internal consistency checking.  The default depends on
> -the compiler configuration.
> +the compiler configuration.  @option{-fchecking=2} enables further
> +internal consistency checking that might affect code generation.
>
>  @item -frandom-seed=@var{string}
>  @opindex frandom-seed
> --- gcc/doc/install.texi.jj     2016-04-22 18:21:28.000000000 +0200
> +++ gcc/doc/install.texi        2016-04-25 17:52:24.156481290 +0200
> @@ -1708,7 +1708,7 @@ When you specify this option, the compil
>  consistency checks of the requested complexity.  This does not change the
>  generated code, but adds error checking within the compiler.  This will
>  slow down the compiler and may only work properly if you are building
> -the compiler with GCC@.  This is @samp{yes} by default when building
> +the compiler with GCC@.  This is @samp{yes,extra} by default when building
>  from SVN or snapshots, but @samp{release} for releases.  The default
>  for building the stage1 compiler is @samp{yes}.  More control
>  over the checks may be had by specifying @var{list}.  The categories of
> @@ -1717,8 +1717,11 @@ checks available are @samp{yes} (most co
>  all), @samp{all} (all but @samp{valgrind}), @samp{release} (cheapest
>  checks @samp{assert,runtime}) or @samp{none} (same as @samp{no}).
>  Individual checks can be enabled with these flags @samp{assert},
> -@samp{df}, @samp{fold}, @samp{gc}, @samp{gcac} @samp{misc}, @samp{rtl},
> -@samp{rtlflag}, @samp{runtime}, @samp{tree}, and @samp{valgrind}.
> +@samp{df}, @samp{fold}, @samp{gc}, @samp{gcac}, @samp{misc}, @samp{rtl},
> +@samp{rtlflag}, @samp{runtime}, @samp{tree}, @samp{extra} and @samp{valgrind}.
> +@samp{extra} adds for @samp{misc} checking extra checks that might affect
> +code generation and should therefore not differ between stage1 and later
> +stages.
>
>  The @samp{valgrind} check requires the external @command{valgrind}
>  simulator, available from @uref{http://valgrind.org/}.  The
> --- configure.jj        2016-03-17 23:58:35.000000000 +0100
> +++ configure   2016-04-25 18:15:42.364740223 +0200
> @@ -14850,16 +14850,17 @@ else
>    # For --disable-checking or implicit --enable-checking=release, avoid
>    # setting --enable-checking=gc in the default stage1 checking for LTO
>    # bootstraps.  See PR62077.
> -  stage1_checking=--enable-checking=release,misc,gimple,rtlflag,tree,types
>    case $BUILD_CONFIG in
>      *lto*)
> -      if test "x$enable_checking" = x && \
> -        test -d ${srcdir}/gcc && \
> -        test x"`cat ${srcdir}/gcc/DEV-PHASE`" = xexperimental; then
> -       stage1_checking=--enable-checking=yes,types
> -      fi;;
> -    *) stage1_checking=--enable-checking=yes,types;;
> +      stage1_checking=--enable-checking=release,misc,gimple,rtlflag,tree,types;;
> +    *)
> +      stage1_checking=--enable-checking=yes,types;;
>    esac
> +  if test "x$enable_checking" = x && \
> +     test -d ${srcdir}/gcc && \
> +     test x"`cat ${srcdir}/gcc/DEV-PHASE`" = xexperimental; then
> +    stage1_checking=yes,types,extra
> +  fi
>  else
>    stage1_checking=--enable-checking=$enable_checking,types
>  fi
> --- gcc/configure.jj    2016-01-27 19:47:28.000000000 +0100
> +++ gcc/configure       2016-04-25 18:02:16.701537995 +0200
> @@ -1596,7 +1596,7 @@ Optional Features:
>                            enable expensive run-time checks. With LIST, enable
>                            only specific categories of checks. Categories are:
>                            yes,no,all,none,release. Flags are:
> -                          assert,df,fold,gc,gcac,gimple,misc,
> +                          assert,df,extra,fold,gc,gcac,gimple,misc,
>                            rtlflag,rtl,runtime,tree,valgrind,types
>    --enable-coverage[=LEVEL]
>                            enable compiler's code coverage collection. Use to
> @@ -7075,7 +7075,7 @@ else
>
>  # Determine the default checks.
>  if test x$is_release = x ; then
> -  ac_checking_flags=yes
> +  ac_checking_flags=yes,extra
>  else
>    ac_checking_flags=release
>  fi
> @@ -7087,32 +7087,33 @@ do
>         case $check in
>         # these set all the flags to specific states
>         yes)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking= ;
> -                       ac_fold_checking= ; ac_gc_checking=1 ;
> +                       ac_fold_checking= ; ac_gc_checking=1 ; ac_extra_checking= ;
>                         ac_gc_always_collect= ; ac_gimple_checking=1 ; ac_rtl_checking= ;
>                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
>                         ac_tree_checking=1 ; ac_valgrind_checking= ;
>                         ac_types_checking=1 ;;
>         no|none)        ac_assert_checking= ; ac_checking= ; ac_df_checking= ;
> -                       ac_fold_checking= ; ac_gc_checking= ;
> +                       ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
>                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
>                         ac_rtlflag_checking= ; ac_runtime_checking= ;
>                         ac_tree_checking= ; ac_valgrind_checking= ;
>                         ac_types_checking= ;;
>         all)            ac_assert_checking=1 ; ac_checking=1 ; ac_df_checking=1 ;
> -                       ac_fold_checking=1 ; ac_gc_checking=1 ;
> +                       ac_fold_checking=1 ; ac_gc_checking=1 ; ac_extra_checking=1 ;
>                         ac_gc_always_collect=1 ; ac_gimple_checking=1 ; ac_rtl_checking=1 ;
>                         ac_rtlflag_checking=1 ; ac_runtime_checking=1 ;
>                         ac_tree_checking=1 ; ac_valgrind_checking= ;
>                         ac_types_checking=1 ;;
>         release)        ac_assert_checking=1 ; ac_checking= ; ac_df_checking= ;
> -                       ac_fold_checking= ; ac_gc_checking= ;
> +                       ac_fold_checking= ; ac_gc_checking= ; ac_extra_checking= ;
>                         ac_gc_always_collect= ; ac_gimple_checking= ; ac_rtl_checking= ;
>                         ac_rtlflag_checking= ; ac_runtime_checking=1 ;
>                         ac_tree_checking= ; ac_valgrind_checking= ;
>                         ac_types_checking= ;;
>         # these enable particular checks
>         assert)         ac_assert_checking=1 ;;
> -       df)             ac_df_checking=1 ;;
> +       df)             ac_df_checking=1 ;;
> +       extra)          ac_extra_checking=1 ;;
>         fold)           ac_fold_checking=1 ;;
>         gc)             ac_gc_checking=1 ;;
>         gcac)           ac_gc_always_collect=1 ;;
> @@ -7131,8 +7132,13 @@ IFS="$ac_save_IFS"
>
>  nocommon_flag=""
>  if test x$ac_checking != x ; then
> +  if test x$ac_extra_checking != x ; then
> +    ac_checking=2
> +  fi
>
> -$as_echo "#define CHECKING_P 1" >>confdefs.h
> +cat >>confdefs.h <<_ACEOF
> +#define CHECKING_P $ac_checking
> +_ACEOF
>
>    nocommon_flag=-fno-common
>  else
> @@ -18453,7 +18459,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 18456 "configure"
> +#line 18462 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> @@ -18559,7 +18565,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 18562 "configure"
> +#line 18568 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> --- gcc/config.in.jj    2016-01-26 20:50:26.000000000 +0100
> +++ gcc/config.in       2016-04-25 18:02:20.000000000 +0200
> @@ -31,7 +31,8 @@
>
>
>  /* Define to 1 if you want more run-time sanity checks. This one gets a grab
> -   bag of miscellaneous but relatively cheap checks. */
> +   bag of miscellaneous but relatively cheap checks. Define to 2 if you want
> +   also extra run-time checking that might affect code generation. */
>  #ifndef USED_FOR_TARGET
>  #undef CHECKING_P
>  #endif
>
>         Jakub



More information about the Gcc-patches mailing list