From 075a5f6aaf5a782c6302fcb1b21a73cd1b65a5e6 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 28 Jun 2017 13:25:33 +0000 Subject: [PATCH] backport: [multiple changes] 2017-06-28 Richard Biener Backport from mainline 2017-06-09 Richard Biener PR middle-end/81007 * ipa-polymorphic-call.c (ipa_polymorphic_call_context::restrict_to_inner_class): Skip FIELD_DECLs with error_mark_node type. * passes.def (all_lowering_passes): Run pass_build_cgraph_edges last again. * g++.dg/pr81007.C: New testcase. 2017-06-14 Richard Biener PR tree-optimization/81083 * tree-ssa-sccvn.c (vn_reference_lookup_3): Do not use abnormals as values. * gcc.dg/torture/pr81083.c: New testcase. 2017-06-21 Richard Biener PR gcov-profile/81080 * configure.ac: Add AC_SYS_LARGEFILE. * libgcov.h: Include auto-target.h before tsystem.h to pick up _FILE_OFFSET_BITS which might differ for multilibs. * config.in: Regenerate. * configure: Likewise. From-SVN: r249738 --- gcc/ChangeLog | 18 +++ gcc/ipa-polymorphic-call.c | 3 +- gcc/passes.def | 2 +- gcc/testsuite/ChangeLog | 13 ++ gcc/testsuite/g++.dg/pr81007.C | 15 ++ gcc/testsuite/gcc.dg/torture/pr81083.c | 15 ++ gcc/tree-ssa-sccvn.c | 4 +- libgcc/ChangeLog | 12 ++ libgcc/config.in | 6 + libgcc/configure | 201 +++++++++++++++++++++++++ libgcc/configure.ac | 2 + libgcc/libgcov.h | 1 + 12 files changed, 289 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr81007.C create mode 100644 gcc/testsuite/gcc.dg/torture/pr81083.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aa3f24bf4d9..69ae97b073c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2017-06-28 Richard Biener + + Backport from mainline + 2017-06-09 Richard Biener + + PR middle-end/81007 + * ipa-polymorphic-call.c + (ipa_polymorphic_call_context::restrict_to_inner_class): + Skip FIELD_DECLs with error_mark_node type. + * passes.def (all_lowering_passes): Run pass_build_cgraph_edges + last again. + + 2017-06-14 Richard Biener + + PR tree-optimization/81083 + * tree-ssa-sccvn.c (vn_reference_lookup_3): Do not use abnormals + as values. + 2017-06-27 Segher Boessenkool Backports from trunk: diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index c8bab92b7bb..afffb17462e 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -267,7 +267,8 @@ ipa_polymorphic_call_context::restrict_to_inner_class (tree otr_type, { for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld)) { - if (TREE_CODE (fld) != FIELD_DECL) + if (TREE_CODE (fld) != FIELD_DECL + || TREE_TYPE (fld) == error_mark_node) continue; pos = int_bit_position (fld); diff --git a/gcc/passes.def b/gcc/passes.def index 6b0f05b07bd..e2610a38f41 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -42,9 +42,9 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_build_cfg); NEXT_PASS (pass_warn_function_return); NEXT_PASS (pass_expand_omp); - NEXT_PASS (pass_build_cgraph_edges); NEXT_PASS (pass_sprintf_length, false); NEXT_PASS (pass_walloca, /*strict_mode_p=*/true); + NEXT_PASS (pass_build_cgraph_edges); TERMINATE_PASS_LIST (all_lowering_passes) /* Interprocedural optimization passes. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 188b2a5a90c..55ad2d2c6ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2017-06-28 Richard Biener + + Backport from mainline + 2017-06-09 Richard Biener + + PR middle-end/81007 + * g++.dg/pr81007.C: New testcase. + + 2017-06-14 Richard Biener + + PR tree-optimization/81083 + * gcc.dg/torture/pr81083.c: New testcase. + 2017-06-28 Eric Botcazou * gcc.dg/tree-prof/val-profiler-threads-1.c (main): Fix 2nd argument diff --git a/gcc/testsuite/g++.dg/pr81007.C b/gcc/testsuite/g++.dg/pr81007.C new file mode 100644 index 00000000000..87d7d40b913 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr81007.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-options "-O2" } + +struct A +{ + A p; // { dg-error "incomplete" } + virtual void foo(); +}; + +struct B : A {}; + +void bar(B& b) +{ + b.foo(); +} diff --git a/gcc/testsuite/gcc.dg/torture/pr81083.c b/gcc/testsuite/gcc.dg/torture/pr81083.c new file mode 100644 index 00000000000..53f96a3835a --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81083.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +void setjmp(); +void func(); +void a(int arg) +{ + extern struct { int x; } obj; + setjmp(); + obj.x = arg; + arg = arg; + if (obj.x) + func(); + if (obj.x) + func(); +} diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 36386cf3e60..ac3bfd2cb03 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2035,7 +2035,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, ops[1] = bitsize_int (ref->size); ops[2] = bitsize_int (offset - offset2); tree val = vn_nary_build_or_lookup (rcode, vr->type, ops); - if (val) + if (val + && (TREE_CODE (val) != SSA_NAME + || ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (val))) { vn_reference_t res = vn_reference_lookup_or_insert_for_pieces (vuse, vr->set, vr->type, vr->operands, val); diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 06843b878ff..f0580a58dc3 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,15 @@ +2017-06-28 Richard Biener + + Backport from mainline + 2017-06-21 Richard Biener + + PR gcov-profile/81080 + * configure.ac: Add AC_SYS_LARGEFILE. + * libgcov.h: Include auto-target.h before tsystem.h to pick + up _FILE_OFFSET_BITS which might differ for multilibs. + * config.in: Regenerate. + * configure: Likewise. + 2017-05-26 Richard Henderson PR libgcc/80037 diff --git a/libgcc/config.in b/libgcc/config.in index 25aa0d93bab..7de22ee0a72 100644 --- a/libgcc/config.in +++ b/libgcc/config.in @@ -71,3 +71,9 @@ /* Define to 1 if the target use emutls for thread-local storage. */ #undef USE_EMUTLS + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES diff --git a/libgcc/configure b/libgcc/configure index 45c459788c3..42dda7fbeec 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -672,6 +672,7 @@ enable_version_specific_runtime_libs with_slibdir enable_maintainer_mode with_build_libsubdir +enable_largefile enable_decimal_float with_system_libunwind enable_explicit_exception_frame_registration @@ -1308,6 +1309,7 @@ Optional Features: --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer + --disable-largefile omit support for large files --enable-decimal-float={no,yes,bid,dpd} enable decimal float extension to C. Selecting 'bid' or 'dpd' choses which decimal floating point format @@ -4061,6 +4063,205 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_c_preproc_warn_flag=yes +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if test "${ac_cv_sys_largefile_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi +fi + + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects diff --git a/libgcc/configure.ac b/libgcc/configure.ac index af151473709..6bcaad651ff 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -191,6 +191,8 @@ GCC_NO_EXECUTABLES AC_PROG_CC AC_PROG_CPP_WERROR +AC_SYS_LARGEFILE + AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) AS_VAR_ARITH([double_type_size], [$ac_cv_sizeof_double \* 8]) diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h index 4c1204ca83c..eb5a9147bef 100644 --- a/libgcc/libgcov.h +++ b/libgcc/libgcov.h @@ -38,6 +38,7 @@ /* This path will be used by libgcov runtime. */ #include "tconfig.h" +#include "auto-target.h" #include "tsystem.h" #include "coretypes.h" #include "tm.h"