diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2016-05-11 13:45:56 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2016-05-11 13:45:56 +0200 |
commit | cf2693b851f4a3a53f015c2113b9d6dc7ae54fe6 (patch) | |
tree | f0f998391d67ff63cbb8934194b2665a952db641 | |
parent | 128df3b55b1b42a5f876fc9f8875d96ee02d0d6c (diff) |
Merge branches/gcc-5-branch rev 236108.
Change-Id: I421c7be7ac36a838c822da9b9412865e9e4fb1fa
78 files changed, 1749 insertions, 438 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ce777a3789..694f4507164 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,138 @@ +2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/70963 + * config/rs6000/vsx.md (vsx_xvcvdpsxds_scale): Generate correct + code for a zero scale factor. + (vsx_xvcvdpuxds_scale): Likewise. + +2016-05-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + Backport from mainline + 2016-05-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + * config/s390/s390.md ("*vec_cmp<insn_cmp>df_cconly") + ("*fixuns_truncdfdi2_z13") + ("*fixuns_trunc<FP:mode><GPR:mode>2_z196") + ("*fix_truncdfdi2_bfp_z13", "*floatunsdidf2_z13") + ("*extendsfdf2_z13"): Replace TARGET_Z13 with TARGET_VX. + +2016-05-10 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline + 2016-04-27 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * config/rtems.h (LIB_SPEC): Add -latomic. + +2016-05-10 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline + 2016-04-27 Joel Sherrill <joel@rtems.org> + + * config/microblaze/rtems.h: Redefine LINK_SPEC to avoid + xilink.ld and flags not relevant to RTEMS. + +2016-05-02 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-04-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70526 + * tree-sra.c (build_ref_for_offset): Use prev_base to + extract the alias pointer type. + +2016-04-28 Jakub Jelinek <jakub@redhat.com> + + PR target/70858 + * config/i386/i386.c (bdesc_special_args): Add | OPTION_MASK_ISA_64BIT + to __builtin_ia32_lwpval64 and __builtin_ia32_lwpins64. + (bdesc_args): Add | OPTION_MASK_ISA_64BIT to __builtin_ia32_bextr_u64, + __builtin_ia32_bextri_u64, __builtin_ia32_bzhi_di, + __builtin_ia32_pdep_di and __builtin_ia32_pext_di. + +2016-04-28 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2016-03-23 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR driver/70132 + * config/arm/driver-arm.c (host_detect_local_cpu): Reorder exit logic + to not call fclose twice on file. + +2016-04-28 Thomas Preud'homme <thomas.preudhomme@arm.com> + + Backport from mainline + 2016-01-18 Thomas Preud'homme <thomas.preudhomme@arm.com> + + * config/arm/arm.c (thumb1_reorg): Check that the comparison is + against the constant 0. + +2016-04-27 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-04-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * config/rs6000/rs6000-builtin.def: Correct pasto error for + stxvd2x and stxvw4x built-in functions. + +2016-04-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-03-14 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/70098 + * config/rs6000/rs6000.md (*ctr<mode>_internal1, *ctr<mode>_internal2, + *ctr<mode>_internal5, *ctr<mode>_internal6): Also allow "d" as output. + (define_split for the GPR case): Use int_reg_operand instead of + gpc_reg_operand for the output. + +2016-04-22 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2016-04-20 H.J. Lu <hongjiu.lu@intel.com> + + * doc/invoke.texi: Replace -skip-rax-setup with -mskip-rax-setup. + +2016-04-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/70674 + * config/s390/s390.c (s390_restore_gprs_from_fprs): Pick the new + stack_restore_from_fpr pattern when restoring r15. + (s390_optimize_prologue): Strip away the memory barrier in the + parallel when trying to get rid of restore insns. + * config/s390/s390.md ("stack_restore_from_fpr"): New insn + definition for loading the stack pointer from an FPR. Compared to + the normal move insn this pattern includes a full memory barrier. + +2016-04-15 Kirill Yukhin <kirill.yukhin@intel.com> + + PR target/70662 + * config/i386/sse.md(define_insn "<avx512>_vec_dup<mode><mask_name>"): + Fix mode size check. + +2016-04-15 Kirill Yukhin <kirill.yukhin@intel.com> + + PR target/70662 + * config/i386/sse.md(define_insn "<avx512>_vec_dup<mode><mask_name>"): + Use proper memory operand modifiers. + +2016-04-14 Nick Clifton <nickc@redhat.com> + Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + PR target/70044 + * config/aarch64/aarch64.c + (aarch64_override_options_after_change): When forcing + flag_omit_frame_pointer to be true, use a special value that can + be detected if this function is called again, thus preventing + flag_omit_leaf_frame_pointer from being forced to be false. + +2016-04-12 Eric Botcazou <ebotcazou@adacore.com> + + PR target/70630 + * config/sparc/sparc.c (sparc_compute_frame_size): Add parentheses. + 2016-04-12 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4e3167d42c1..4578ac08819 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20160412 +20160511 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b6998220ce5..393704d055e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,25 @@ +2016-05-06 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/70969 + * system-darwin-ppc64.ads: Add pragma No_Elaboration_Code_All. + * system-linux-armeb.ads: Likewise. + * system-linux-mips64el.ads: Likewise. + * system-linux-mips.ads: Likewise. + * system-linux-mipsel.ads: Likewise. + * system-linux-ppc64.ads: Likewise. + * system-linux-sparcv9.ads: Likewise. + * system-rtems.ads: Likewise. + +2016-05-02 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * gcc-interface/Makefile.in (install-gcc-specs): Use foreach. + Honor DESTDIR. + +2016-04-28 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/70786 + * a-textio.adb (Get_Immediate): Add missing 'not' in expression. + 2016-04-02 Eric Botcazou <ebotcazou@adacore.com> * gcc-interface/decl.c (components_to_record): Restrict the previous diff --git a/gcc/ada/a-textio.adb b/gcc/ada/a-textio.adb index 2ebec616c6d..60beb93fff5 100644 --- a/gcc/ada/a-textio.adb +++ b/gcc/ada/a-textio.adb @@ -668,7 +668,7 @@ package body Ada.Text_IO is Available := True; Item := - (if Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method) + (if not Is_Start_Of_Encoding (Character'Val (ch), File.WC_Method) then Character'Val (ch) else Get_Upper_Half_Char_Immed (Character'Val (ch), File)); end if; diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index e1ca51572fd..c9ee7b545cf 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -2553,10 +2553,9 @@ gnatlink-re: ../stamp-tools gnatmake-re install-gcc-specs: # Install all the requested GCC spec files. - for f in $(GCC_SPEC_FILES); do \ - $(INSTALL_DATA_DATE) $(srcdir)/ada/$$f \ - $(libsubdir)/$$(echo $$f|sed -e 's#_[a-zA-Z0-9]*##g'); \ - done + $(foreach f,$(GCC_SPEC_FILES), \ + $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) \ + $(DESTDIR)$(libsubdir)/$$(echo $(f)|sed -e 's#_[a-zA-Z0-9]*##g');) install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs # Create the directory before deleting it, in case the directory is diff --git a/gcc/ada/system-darwin-ppc64.ads b/gcc/ada/system-darwin-ppc64.ads index 573f3fc39c0..ebd5adadf82 100644 --- a/gcc/ada/system-darwin-ppc64.ads +++ b/gcc/ada/system-darwin-ppc64.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-linux-armeb.ads b/gcc/ada/system-linux-armeb.ads index bcc31f3daeb..2d8f34470e6 100644 --- a/gcc/ada/system-linux-armeb.ads +++ b/gcc/ada/system-linux-armeb.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-linux-mips.ads b/gcc/ada/system-linux-mips.ads index 08724650d4d..f34f665b55f 100644 --- a/gcc/ada/system-linux-mips.ads +++ b/gcc/ada/system-linux-mips.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-linux-mips64el.ads b/gcc/ada/system-linux-mips64el.ads index 5c8cad17749..e4093cddb0c 100644 --- a/gcc/ada/system-linux-mips64el.ads +++ b/gcc/ada/system-linux-mips64el.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-linux-mipsel.ads b/gcc/ada/system-linux-mipsel.ads index e6d56fb8286..53415c89e8a 100644 --- a/gcc/ada/system-linux-mipsel.ads +++ b/gcc/ada/system-linux-mipsel.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-linux-ppc64.ads b/gcc/ada/system-linux-ppc64.ads index 52d5d4402b6..a9862f4dc13 100644 --- a/gcc/ada/system-linux-ppc64.ads +++ b/gcc/ada/system-linux-ppc64.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-linux-sparcv9.ads b/gcc/ada/system-linux-sparcv9.ads index 5b7598f3e43..8adf4f310f9 100644 --- a/gcc/ada/system-linux-sparcv9.ads +++ b/gcc/ada/system-linux-sparcv9.ads @@ -40,6 +40,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/ada/system-rtems.ads b/gcc/ada/system-rtems.ads index 50bf7ac6402..1ab644ce0ef 100644 --- a/gcc/ada/system-rtems.ads +++ b/gcc/ada/system-rtems.ads @@ -44,6 +44,9 @@ package System is -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada -- 2005, this is Pure in any case (AI-362). + pragma No_Elaboration_Code_All; + -- Allow the use of that restriction in units that WITH this unit + type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index be0286dfa0c..b0868c5753c 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2016-04-18 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2016-03-31 Marek Polacek <polacek@redhat.com> + + PR c/70297 + * c-decl.c (merge_decls): Also set TYPE_ALIGN and TYPE_USER_ALIGN. + 2016-02-17 Bernd Schmidt <bschmidt@redhat.com> Backport from mainline diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index a71b3de1918..33ad00f913f 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2376,6 +2376,35 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) DECL_ATTRIBUTES (newdecl) = targetm.merge_decl_attributes (olddecl, newdecl); + /* For typedefs use the old type, as the new type's DECL_NAME points + at newdecl, which will be ggc_freed. */ + if (TREE_CODE (newdecl) == TYPE_DECL) + { + /* But NEWTYPE might have an attribute, honor that. */ + tree tem = newtype; + newtype = oldtype; + + if (TYPE_USER_ALIGN (tem)) + { + if (TYPE_ALIGN (tem) > TYPE_ALIGN (newtype)) + TYPE_ALIGN (newtype) = TYPE_ALIGN (tem); + TYPE_USER_ALIGN (newtype) = true; + } + + /* And remove the new type from the variants list. */ + if (TYPE_NAME (TREE_TYPE (newdecl)) == newdecl) + { + tree remove = TREE_TYPE (newdecl); + for (tree t = TYPE_MAIN_VARIANT (remove); ; + t = TYPE_NEXT_VARIANT (t)) + if (TYPE_NEXT_VARIANT (t) == remove) + { + TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove); + break; + } + } + } + /* Merge the data types specified in the two decls. */ TREE_TYPE (newdecl) = TREE_TYPE (olddecl) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 5ab999db6a7..1899a11204c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -31143,9 +31143,9 @@ static const struct builtin_description bdesc_special_args[] = { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_llwpcb, "__builtin_ia32_llwpcb", IX86_BUILTIN_LLWPCB, UNKNOWN, (int) VOID_FTYPE_PVOID }, { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_slwpcb, "__builtin_ia32_slwpcb", IX86_BUILTIN_SLWPCB, UNKNOWN, (int) PVOID_FTYPE_VOID }, { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvalsi3, "__builtin_ia32_lwpval32", IX86_BUILTIN_LWPVAL32, UNKNOWN, (int) VOID_FTYPE_UINT_UINT_UINT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpvaldi3, "__builtin_ia32_lwpval64", IX86_BUILTIN_LWPVAL64, UNKNOWN, (int) VOID_FTYPE_UINT64_UINT_UINT }, + { OPTION_MASK_ISA_LWP | OPTION_MASK_ISA_64BIT, CODE_FOR_lwp_lwpvaldi3, "__builtin_ia32_lwpval64", IX86_BUILTIN_LWPVAL64, UNKNOWN, (int) VOID_FTYPE_UINT64_UINT_UINT }, { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinssi3, "__builtin_ia32_lwpins32", IX86_BUILTIN_LWPINS32, UNKNOWN, (int) UCHAR_FTYPE_UINT_UINT_UINT }, - { OPTION_MASK_ISA_LWP, CODE_FOR_lwp_lwpinsdi3, "__builtin_ia32_lwpins64", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT64_UINT_UINT }, + { OPTION_MASK_ISA_LWP | OPTION_MASK_ISA_64BIT, CODE_FOR_lwp_lwpinsdi3, "__builtin_ia32_lwpins64", IX86_BUILTIN_LWPINS64, UNKNOWN, (int) UCHAR_FTYPE_UINT64_UINT_UINT }, /* FSGSBASE */ { OPTION_MASK_ISA_FSGSBASE | OPTION_MASK_ISA_64BIT, CODE_FOR_rdfsbasesi, "__builtin_ia32_rdfsbase32", IX86_BUILTIN_RDFSBASE32, UNKNOWN, (int) UNSIGNED_FTYPE_VOID }, @@ -32076,12 +32076,12 @@ static const struct builtin_description bdesc_args[] = /* BMI */ { OPTION_MASK_ISA_BMI, CODE_FOR_bmi_bextr_si, "__builtin_ia32_bextr_u32", IX86_BUILTIN_BEXTR32, UNKNOWN, (int) UINT_FTYPE_UINT_UINT }, - { OPTION_MASK_ISA_BMI, CODE_FOR_bmi_bextr_di, "__builtin_ia32_bextr_u64", IX86_BUILTIN_BEXTR64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, + { OPTION_MASK_ISA_BMI | OPTION_MASK_ISA_64BIT, CODE_FOR_bmi_bextr_di, "__builtin_ia32_bextr_u64", IX86_BUILTIN_BEXTR64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, { OPTION_MASK_ISA_BMI, CODE_FOR_ctzhi2, "__builtin_ctzs", IX86_BUILTIN_CTZS, UNKNOWN, (int) UINT16_FTYPE_UINT16 }, /* TBM */ { OPTION_MASK_ISA_TBM, CODE_FOR_tbm_bextri_si, "__builtin_ia32_bextri_u32", IX86_BUILTIN_BEXTRI32, UNKNOWN, (int) UINT_FTYPE_UINT_UINT }, - { OPTION_MASK_ISA_TBM, CODE_FOR_tbm_bextri_di, "__builtin_ia32_bextri_u64", IX86_BUILTIN_BEXTRI64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, + { OPTION_MASK_ISA_TBM | OPTION_MASK_ISA_64BIT, CODE_FOR_tbm_bextri_di, "__builtin_ia32_bextri_u64", IX86_BUILTIN_BEXTRI64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, /* F16C */ { OPTION_MASK_ISA_F16C, CODE_FOR_vcvtph2ps, "__builtin_ia32_vcvtph2ps", IX86_BUILTIN_CVTPH2PS, UNKNOWN, (int) V4SF_FTYPE_V8HI }, @@ -32091,11 +32091,11 @@ static const struct builtin_description bdesc_args[] = /* BMI2 */ { OPTION_MASK_ISA_BMI2, CODE_FOR_bmi2_bzhi_si3, "__builtin_ia32_bzhi_si", IX86_BUILTIN_BZHI32, UNKNOWN, (int) UINT_FTYPE_UINT_UINT }, - { OPTION_MASK_ISA_BMI2, CODE_FOR_bmi2_bzhi_di3, "__builtin_ia32_bzhi_di", IX86_BUILTIN_BZHI64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, + { OPTION_MASK_ISA_BMI2 | OPTION_MASK_ISA_64BIT, CODE_FOR_bmi2_bzhi_di3, "__builtin_ia32_bzhi_di", IX86_BUILTIN_BZHI64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, { OPTION_MASK_ISA_BMI2, CODE_FOR_bmi2_pdep_si3, "__builtin_ia32_pdep_si", IX86_BUILTIN_PDEP32, UNKNOWN, (int) UINT_FTYPE_UINT_UINT }, - { OPTION_MASK_ISA_BMI2, CODE_FOR_bmi2_pdep_di3, "__builtin_ia32_pdep_di", IX86_BUILTIN_PDEP64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, + { OPTION_MASK_ISA_BMI2 | OPTION_MASK_ISA_64BIT, CODE_FOR_bmi2_pdep_di3, "__builtin_ia32_pdep_di", IX86_BUILTIN_PDEP64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, { OPTION_MASK_ISA_BMI2, CODE_FOR_bmi2_pext_si3, "__builtin_ia32_pext_si", IX86_BUILTIN_PEXT32, UNKNOWN, (int) UINT_FTYPE_UINT_UINT }, - { OPTION_MASK_ISA_BMI2, CODE_FOR_bmi2_pext_di3, "__builtin_ia32_pext_di", IX86_BUILTIN_PEXT64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, + { OPTION_MASK_ISA_BMI2 | OPTION_MASK_ISA_64BIT, CODE_FOR_bmi2_pext_di3, "__builtin_ia32_pext_di", IX86_BUILTIN_PEXT64, UNKNOWN, (int) UINT64_FTYPE_UINT64_UINT64 }, /* AVX512F */ { OPTION_MASK_ISA_AVX512F, CODE_FOR_avx512f_si512_256si, "__builtin_ia32_si512_256si", IX86_BUILTIN_SI512_SI256, UNKNOWN, (int) V16SI_FTYPE_V8SI }, diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 5692a11aa29..2f6a5c4e6cb 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -16658,7 +16658,17 @@ (match_operand:<ssexmmmode> 1 "nonimmediate_operand" "vm") (parallel [(const_int 0)]))))] "TARGET_AVX512F" - "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %1}" +{ + /* There is no DF broadcast (in AVX-512*) to 128b register. + Mimic it with integer variant. */ + if (<MODE>mode == V2DFmode) + return "vpbroadcastq\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"; + + if (GET_MODE_SIZE (GET_MODE_INNER (<MODE>mode)) == 4) + return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %k1}"; + else + return "v<sseintprefix>broadcast<bcstscalarsuff>\t{%1, %0<mask_operand2>|%0<mask_operand2>, %q1}"; +} [(set_attr "type" "ssemov") (set_attr "prefix" "evex") (set_attr "mode" "<sseinsnmode>")]) diff --git a/gcc/config/microblaze/rtems.h b/gcc/config/microblaze/rtems.h index c8d42db045e..cf8a398394b 100644 --- a/gcc/config/microblaze/rtems.h +++ b/gcc/config/microblaze/rtems.h @@ -23,3 +23,10 @@ along with GCC; see the file COPYING3. If not see builtin_define( "__rtems__" ); \ builtin_assert( "system=rtems" ); \ } while (0) + +/* Redefine to include only items relevant for RTEMS */ +#undef LINK_SPEC +#define LINK_SPEC "%{shared:-shared} -N -relax \ + %{mbig-endian:-EB --oformat=elf32-microblaze} \ + %{mlittle-endian:-EL --oformat=elf32-microblazeel} \ + %{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0}" diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def index 7b79efcedb3..9f8283d310f 100644 --- a/gcc/config/rs6000/rs6000-builtin.def +++ b/gcc/config/rs6000/rs6000-builtin.def @@ -1371,13 +1371,13 @@ BU_VSX_X (LXVW4X_V4SI, "lxvw4x_v4si", MEM) BU_VSX_X (LXVW4X_V8HI, "lxvw4x_v8hi", MEM) BU_VSX_X (LXVW4X_V16QI, "lxvw4x_v16qi", MEM) BU_VSX_X (STXSDX, "stxsdx", MEM) -BU_VSX_X (STXVD2X_V1TI, "stxsdx_v1ti", MEM) -BU_VSX_X (STXVD2X_V2DF, "stxsdx_v2df", MEM) -BU_VSX_X (STXVD2X_V2DI, "stxsdx_v2di", MEM) -BU_VSX_X (STXVW4X_V4SF, "stxsdx_v4sf", MEM) -BU_VSX_X (STXVW4X_V4SI, "stxsdx_v4si", MEM) -BU_VSX_X (STXVW4X_V8HI, "stxsdx_v8hi", MEM) -BU_VSX_X (STXVW4X_V16QI, "stxsdx_v16qi", MEM) +BU_VSX_X (STXVD2X_V1TI, "stxvd2x_v1ti", MEM) +BU_VSX_X (STXVD2X_V2DF, "stxvd2x_v2df", MEM) +BU_VSX_X (STXVD2X_V2DI, "stxvd2x_v2di", MEM) +BU_VSX_X (STXVW4X_V4SF, "stxvw4x_v4sf", MEM) +BU_VSX_X (STXVW4X_V4SI, "stxvw4x_v4si", MEM) +BU_VSX_X (STXVW4X_V8HI, "stxvw4x_v8hi", MEM) +BU_VSX_X (STXVW4X_V16QI, "stxvw4x_v16qi", MEM) BU_VSX_X (XSABSDP, "xsabsdp", CONST) BU_VSX_X (XSADDDP, "xsadddp", FP) BU_VSX_X (XSCMPODP, "xscmpodp", FP) diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 7720e9c71c7..114bc96f7b0 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -12987,7 +12987,7 @@ (const_int 1)) (label_ref (match_operand 0 "" "")) (pc))) - (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l") + (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l") (plus:P (match_dup 1) (const_int -1))) (clobber (match_scratch:CC 3 "=X,&x,&x,&x")) @@ -13011,7 +13011,7 @@ (const_int 1)) (pc) (label_ref (match_operand 0 "" "")))) - (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l") + (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l") (plus:P (match_dup 1) (const_int -1))) (clobber (match_scratch:CC 3 "=X,&x,&x,&x")) @@ -13037,7 +13037,7 @@ (const_int 1)) (label_ref (match_operand 0 "" "")) (pc))) - (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l") + (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l") (plus:P (match_dup 1) (const_int -1))) (clobber (match_scratch:CC 3 "=X,&x,&x,&x")) @@ -13061,7 +13061,7 @@ (const_int 1)) (pc) (label_ref (match_operand 0 "" "")))) - (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*c*l") + (set (match_operand:P 2 "nonimmediate_operand" "=1,*r,m,*d*c*l") (plus:P (match_dup 1) (const_int -1))) (clobber (match_scratch:CC 3 "=X,&x,&x,&x")) @@ -13088,7 +13088,7 @@ (const_int 1)]) (match_operand 5 "" "") (match_operand 6 "" ""))) - (set (match_operand:P 0 "gpc_reg_operand" "") + (set (match_operand:P 0 "int_reg_operand" "") (plus:P (match_dup 1) (const_int -1))) (clobber (match_scratch:CC 3 "")) (clobber (match_scratch:P 4 ""))] diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md index f2abdcd846a..c112b10c9c6 100644 --- a/gcc/config/rs6000/vsx.md +++ b/gcc/config/rs6000/vsx.md @@ -1416,10 +1416,15 @@ { rtx op0 = operands[0]; rtx op1 = operands[1]; - rtx tmp = gen_reg_rtx (V2DFmode); - int scale = INTVAL(operands[2]); - if (scale != 0) - rs6000_scale_v2df (tmp, op1, scale); + rtx tmp; + int scale = INTVAL (operands[2]); + if (scale == 0) + tmp = op1; + else + { + tmp = gen_reg_rtx (V2DFmode); + rs6000_scale_v2df (tmp, op1, scale); + } emit_insn (gen_vsx_xvcvdpsxds (op0, tmp)); DONE; }) @@ -1440,10 +1445,15 @@ { rtx op0 = operands[0]; rtx op1 = operands[1]; - rtx tmp = gen_reg_rtx (V2DFmode); - int scale = INTVAL(operands[2]); - if (scale != 0) - rs6000_scale_v2df (tmp, op1, scale); + rtx tmp; + int scale = INTVAL (operands[2]); + if (scale == 0) + tmp = op1; + else + { + tmp = gen_reg_rtx (V2DFmode); + rs6000_scale_v2df (tmp, op1, scale); + } emit_insn (gen_vsx_xvcvdpuxds (op0, tmp)); DONE; }) diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h index af848403016..aa1549c8495 100644 --- a/gcc/config/rtems.h +++ b/gcc/config/rtems.h @@ -45,6 +45,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \ "%{!nostdlib: %{qrtems: --start-group \ -lrtemsbsp -lrtemscpu \ - -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}" + -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}" #define TARGET_POSIX_IO diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 64407bb8384..c2c58eede61 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -10333,19 +10333,25 @@ s390_restore_gprs_from_fprs (void) for (i = 6; i < 16; i++) { - if (FP_REGNO_P (cfun_gpr_save_slot (i))) - { - rtx_insn *insn = - emit_move_insn (gen_rtx_REG (DImode, i), - gen_rtx_REG (DImode, cfun_gpr_save_slot (i))); - df_set_regs_ever_live (i, true); - add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, i)); - if (i == STACK_POINTER_REGNUM) - add_reg_note (insn, REG_CFA_DEF_CFA, - plus_constant (Pmode, stack_pointer_rtx, - STACK_POINTER_OFFSET)); - RTX_FRAME_RELATED_P (insn) = 1; - } + rtx_insn *insn; + + if (!FP_REGNO_P (cfun_gpr_save_slot (i))) + continue; + + rtx fpr = gen_rtx_REG (DImode, cfun_gpr_save_slot (i)); + + if (i == STACK_POINTER_REGNUM) + insn = emit_insn (gen_stack_restore_from_fpr (fpr)); + else + insn = emit_move_insn (gen_rtx_REG (DImode, i), fpr); + + df_set_regs_ever_live (i, true); + add_reg_note (insn, REG_CFA_RESTORE, gen_rtx_REG (DImode, i)); + if (i == STACK_POINTER_REGNUM) + add_reg_note (insn, REG_CFA_DEF_CFA, + plus_constant (Pmode, stack_pointer_rtx, + STACK_POINTER_OFFSET)); + RTX_FRAME_RELATED_P (insn) = 1; } } @@ -12617,37 +12623,46 @@ s390_optimize_prologue (void) /* Remove ldgr/lgdr instructions used for saving and restore GPRs if possible. */ - if (TARGET_Z10 - && GET_CODE (pat) == SET - && GET_MODE (SET_SRC (pat)) == DImode - && REG_P (SET_SRC (pat)) - && REG_P (SET_DEST (pat))) + if (TARGET_Z10) { - int src_regno = REGNO (SET_SRC (pat)); - int dest_regno = REGNO (SET_DEST (pat)); - int gpr_regno; - int fpr_regno; + rtx tmp_pat = pat; - if (!((GENERAL_REGNO_P (src_regno) && FP_REGNO_P (dest_regno)) - || (FP_REGNO_P (src_regno) && GENERAL_REGNO_P (dest_regno)))) - continue; + if (INSN_CODE (insn) == CODE_FOR_stack_restore_from_fpr) + tmp_pat = XVECEXP (pat, 0, 0); - gpr_regno = GENERAL_REGNO_P (src_regno) ? src_regno : dest_regno; - fpr_regno = FP_REGNO_P (src_regno) ? src_regno : dest_regno; + if (GET_CODE (tmp_pat) == SET + && GET_MODE (SET_SRC (tmp_pat)) == DImode + && REG_P (SET_SRC (tmp_pat)) + && REG_P (SET_DEST (tmp_pat))) + { + int src_regno = REGNO (SET_SRC (tmp_pat)); + int dest_regno = REGNO (SET_DEST (tmp_pat)); + int gpr_regno; + int fpr_regno; + + if (!((GENERAL_REGNO_P (src_regno) + && FP_REGNO_P (dest_regno)) + || (FP_REGNO_P (src_regno) + && GENERAL_REGNO_P (dest_regno)))) + continue; - /* GPR must be call-saved, FPR must be call-clobbered. */ - if (!call_really_used_regs[fpr_regno] - || call_really_used_regs[gpr_regno]) - continue; + gpr_regno = GENERAL_REGNO_P (src_regno) ? src_regno : dest_regno; + fpr_regno = FP_REGNO_P (src_regno) ? src_regno : dest_regno; - /* It must not happen that what we once saved in an FPR now - needs a stack slot. */ - gcc_assert (cfun_gpr_save_slot (gpr_regno) != SAVE_SLOT_STACK); + /* GPR must be call-saved, FPR must be call-clobbered. */ + if (!call_really_used_regs[fpr_regno] + || call_really_used_regs[gpr_regno]) + continue; - if (cfun_gpr_save_slot (gpr_regno) == SAVE_SLOT_NONE) - { - remove_insn (insn); - continue; + /* It must not happen that what we once saved in an FPR now + needs a stack slot. */ + gcc_assert (cfun_gpr_save_slot (gpr_regno) != SAVE_SLOT_STACK); + + if (cfun_gpr_save_slot (gpr_regno) == SAVE_SLOT_NONE) + { + remove_insn (insn); + continue; + } } } diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md index 71587d13316..e7d9b55020f 100644 --- a/gcc/config/s390/s390.md +++ b/gcc/config/s390/s390.md @@ -289,6 +289,8 @@ (BASE_REGNUM 13) ; Return address register. (RETURN_REGNUM 14) + ; Stack pointer register. + (STACK_REGNUM 15) ; Condition code register. (CC_REGNUM 33) ; Thread local storage pointer register. @@ -1261,7 +1263,7 @@ (compare:VFCMP (match_operand:DF 0 "register_operand" "v") (match_operand:DF 1 "register_operand" "v"))) (clobber (match_scratch:V2DI 2 "=v"))] - "TARGET_Z13 && TARGET_HARD_FLOAT" + "TARGET_VX && TARGET_HARD_FLOAT" "wfc<asm_fcmp>dbs\t%v2,%v0,%v1" [(set_attr "op_type" "VRR")]) @@ -4494,7 +4496,7 @@ (unsigned_fix:DI (match_operand:DF 1 "register_operand" "f,v"))) (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND) (clobber (reg:CC CC_REGNUM))] - "TARGET_Z13 && TARGET_HARD_FLOAT" + "TARGET_VX && TARGET_HARD_FLOAT" "@ clgdbr\t%0,%h2,%1,0 wclgdb\t%v0,%v1,0,%h2" @@ -4509,7 +4511,7 @@ (unspec:GPR [(match_operand:GPR 2 "immediate_operand" "K")] UNSPEC_ROUND) (clobber (reg:CC CC_REGNUM))] "TARGET_Z196 && TARGET_HARD_FLOAT - && (!TARGET_Z13 || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)" + && (!TARGET_VX || <GPR:MODE>mode != DImode || <FP:MODE>mode != DFmode)" "cl<GPR:gf><FP:xde><FP:bt>r\t%0,%h2,%1,0" [(set_attr "op_type" "RRF") (set_attr "type" "ftoi")]) @@ -4529,7 +4531,7 @@ (fix:DI (match_operand:DF 1 "register_operand" "f,v"))) (unspec:DI [(match_operand:DI 2 "immediate_operand" "K,K")] UNSPEC_ROUND) (clobber (reg:CC CC_REGNUM))] - "TARGET_Z13 && TARGET_HARD_FLOAT" + "TARGET_VX && TARGET_HARD_FLOAT" "@ cgdbr\t%0,%h2,%1 wcgdb\t%v0,%v1,0,%h2" @@ -4636,7 +4638,7 @@ (define_insn "*floatunsdidf2_z13" [(set (match_operand:DF 0 "register_operand" "=f,v") (unsigned_float:DF (match_operand:DI 1 "register_operand" "d,v")))] - "TARGET_Z13 && TARGET_HARD_FLOAT" + "TARGET_VX && TARGET_HARD_FLOAT" "@ cdlgbr\t%0,0,%1,0 wcdlgb\t%v0,%v1,0,0" @@ -4729,7 +4731,7 @@ (define_insn "*extendsfdf2_z13" [(set (match_operand:DF 0 "register_operand" "=f,f,v") (float_extend:DF (match_operand:SF 1 "nonimmediate_operand" "f,R,v")))] - "TARGET_Z13 && TARGET_HARD_FLOAT" + "TARGET_VX && TARGET_HARD_FLOAT" "@ ldebr\t%0,%1 ldeb\t%0,%1 @@ -10362,6 +10364,14 @@ [(set_attr "length" "0")]) +(define_insn "stack_restore_from_fpr" + [(set (reg:DI STACK_REGNUM) + (match_operand:DI 0 "register_operand" "f")) + (clobber (mem:BLK (scratch)))] + "TARGET_Z10" + "lgdr\t%%r15,%0" + [(set_attr "op_type" "RRE")]) + ; ; Data prefetch patterns ; diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 61c7c311c4e..268d6c391c0 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -5007,13 +5007,18 @@ sparc_compute_frame_size (HOST_WIDE_INT size, int leaf_function) /* Calculate space needed for global registers. */ if (TARGET_ARCH64) - for (i = 0; i < 8; i++) - if (save_global_or_fp_reg_p (i, 0)) - n_global_fp_regs += 2; + { + for (i = 0; i < 8; i++) + if (save_global_or_fp_reg_p (i, 0)) + n_global_fp_regs += 2; + } else - for (i = 0; i < 8; i += 2) - if (save_global_or_fp_reg_p (i, 0) || save_global_or_fp_reg_p (i + 1, 0)) - n_global_fp_regs += 2; + { + for (i = 0; i < 8; i += 2) + if (save_global_or_fp_reg_p (i, 0) + || save_global_or_fp_reg_p (i + 1, 0)) + n_global_fp_regs += 2; + } /* In the flat window model, find out which local and in registers need to be saved. We don't reserve space in the current frame for them as they diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 646862f013b..0ec4290de33 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,42 @@ +2016-05-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/70635 + * pt.c (resolve_typename_type): Fix typos in infinite recursion + avoidance mechanism. + +2016-04-18 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2016-03-31 Marek Polacek <polacek@redhat.com> + + PR c/70297 + * decl.c (duplicate_decls): Also set TYPE_ALIGN and TYPE_USER_ALIGN. + +2016-04-18 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-11-11 Jason Merrill <jason@redhat.com> + + * decl.c (duplicate_decls): When combining typedefs, remove the + new type from the variants list. + +2016-04-15 Jason Merrill <jason@redhat.com> + + * pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Get + LAMBDA_EXPR_RETURN_TYPE from the instantiated closure. + + PR c++/67164 + * pt.c (copy_template_args): New. + (tsubst_pack_expansion): Use it. + +2016-04-13 Alan Modra <amodra@gmail.com> + + Backport from mainline + 2016-03-22 Patrick Palka <ppalka@gcc.gnu.org> + PR target/70107 + PR c++/70096 + * pt.c (tsubst_decl): Clear the DECL_MODE of the new decl. + 2016-04-06 Richard Biener <rguenther@suse.de> Backport from mainline diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c9e87ef7760..d38e49d84cf 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1991,7 +1991,31 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) /* For typedefs use the old type, as the new type's DECL_NAME points at newdecl, which will be ggc_freed. */ if (TREE_CODE (newdecl) == TYPE_DECL) - newtype = oldtype; + { + /* But NEWTYPE might have an attribute, honor that. */ + tree tem = TREE_TYPE (newdecl); + newtype = oldtype; + + if (TYPE_USER_ALIGN (tem)) + { + if (TYPE_ALIGN (tem) > TYPE_ALIGN (newtype)) + TYPE_ALIGN (newtype) = TYPE_ALIGN (tem); + TYPE_USER_ALIGN (newtype) = true; + } + + /* And remove the new type from the variants list. */ + if (TYPE_NAME (TREE_TYPE (newdecl)) == newdecl) + { + tree remove = TREE_TYPE (newdecl); + for (tree t = TYPE_MAIN_VARIANT (remove); ; + t = TYPE_NEXT_VARIANT (t)) + if (TYPE_NEXT_VARIANT (t) == remove) + { + TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (remove); + break; + } + } + } else /* Merge the data types specified in the two decls. */ newtype = merge_types (TREE_TYPE (newdecl), TREE_TYPE (olddecl)); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 969328c84db..e80377e7ee0 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -178,6 +178,7 @@ static int check_cv_quals_for_unify (int, tree, tree); static void template_parm_level_and_index (tree, int*, int*); static int unify_pack_expansion (tree, tree, tree, tree, unification_kind_t, bool, bool); +static tree copy_template_args (tree); static tree tsubst_template_arg (tree, tree, tsubst_flags_t, tree); static tree tsubst_template_args (tree, tree, tsubst_flags_t, tree); static tree tsubst_template_parms (tree, tree, tsubst_flags_t); @@ -10237,11 +10238,12 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, /* For each argument in each argument pack, substitute into the pattern. */ result = make_tree_vec (len); + tree elem_args = copy_template_args (args); for (i = 0; i < len; ++i) { t = gen_elem_of_pack_expansion_instantiation (pattern, packs, i, - args, complain, + elem_args, complain, in_decl); TREE_VEC_ELT (result, i) = t; if (t == error_mark_node) @@ -10317,6 +10319,32 @@ get_pattern_parm (tree parm, tree tmpl) return patparm; } +/* Return an exact copy of template args T that can be modified + independently. */ + +static tree +copy_template_args (tree t) +{ + if (t == error_mark_node) + return t; + + int len = TREE_VEC_LENGTH (t); + tree new_vec = make_tree_vec (len); + + for (int i = 0; i < len; ++i) + { + tree elt = TREE_VEC_ELT (t, i); + if (elt && TREE_CODE (elt) == TREE_VEC) + elt = copy_template_args (elt); + TREE_VEC_ELT (new_vec, i) = elt; + } + + NON_DEFAULT_TEMPLATE_ARGS_COUNT (new_vec) + = NON_DEFAULT_TEMPLATE_ARGS_COUNT (t); + + return new_vec; +} + /* Substitute ARGS into the vector or list of template arguments T. */ static tree @@ -11529,6 +11557,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) /* The initializer must not be expanded until it is required; see [temp.inst]. */ DECL_INITIAL (r) = NULL_TREE; + if (VAR_P (r)) + DECL_MODE (r) = VOIDmode; if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL)) SET_DECL_RTL (r, NULL); DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0; @@ -15871,8 +15901,6 @@ tsubst_copy_and_build (tree t, else scope = RECUR (scope); LAMBDA_EXPR_EXTRA_SCOPE (r) = scope; - LAMBDA_EXPR_RETURN_TYPE (r) - = tsubst (LAMBDA_EXPR_RETURN_TYPE (t), args, complain, in_decl); gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (t) == NULL_TREE && LAMBDA_EXPR_PENDING_PROXIES (t) == NULL); @@ -15883,6 +15911,9 @@ tsubst_copy_and_build (tree t, declaration of the op() for later calls to lambda_function. */ complete_type (type); + if (tree fn = lambda_function (type)) + LAMBDA_EXPR_RETURN_TYPE (r) = TREE_TYPE (TREE_TYPE (fn)); + LAMBDA_EXPR_THIS_CAPTURE (r) = NULL_TREE; insert_pending_capture_proxies (); @@ -22176,9 +22207,9 @@ resolve_typename_type (tree type, bool only_current_p) { /* Ill-formed programs can cause infinite recursion here, so we must catch that. */ - TYPENAME_IS_RESOLVING_P (type) = 1; + TYPENAME_IS_RESOLVING_P (result) = 1; result = resolve_typename_type (result, only_current_p); - TYPENAME_IS_RESOLVING_P (type) = 0; + TYPENAME_IS_RESOLVING_P (result) = 0; } /* Qualify the resulting type. */ diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 09d917b9807..d88a0f06d23 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -23051,7 +23051,7 @@ useful together with @option{-mrecord-mcount}. @itemx -mno-skip-rax-setup @opindex mskip-rax-setup When generating code for the x86-64 architecture with SSE extensions -disabled, @option{-skip-rax-setup} can be used to skip setting up RAX +disabled, @option{-mskip-rax-setup} can be used to skip setting up RAX register when there are no variable arguments passed in vector registers. @strong{Warning:} Since RAX register is used to avoid unnecessarily diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1a9441a6cc5..5e4fa6187a5 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,12 @@ +2016-04-28 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR java/70839 + * decl.c (parse_version): Remove minor handling. + +2016-04-28 Matthias Klose <doko@ubuntu.com> + + * decl.c (parse_version): Freeze the minor version in the abi version. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 72133b4fcd2..a8c2f64c493 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -528,7 +528,7 @@ static void parse_version (void) { const char *p = version_string; - unsigned int major = 0, minor = 0; + unsigned int major = 0; unsigned int abi_version; /* Skip leading junk. */ @@ -546,13 +546,6 @@ parse_version (void) gcc_assert (*p == '.' && ISDIGIT (p[1])); ++p; - /* Extract minor version. */ - while (ISDIGIT (*p)) - { - minor = minor * 10 + *p - '0'; - ++p; - } - if (flag_indirect_dispatch) { abi_version = GCJ_CURRENT_BC_ABI_VERSION; @@ -561,9 +554,10 @@ parse_version (void) else /* C++ ABI */ { /* Implicit in this computation is the idea that we won't break the - old-style binary ABI in a sub-minor release (e.g., from 4.0.0 to - 4.0.1). */ - abi_version = 100000 * major + 1000 * minor; + old-style binary ABI in a sub-minor release (e.g., from 5.0.0 to + 5.1.0). Freeze the ABI on the gcc-5-branch with the value of the + GCC 5.3 release.*/ + abi_version = 100000 * major + 1000 * 3; } if (flag_bootstrap_classes) abi_version |= FLAG_BOOTSTRAP_LOADER; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e272d7be718..bfab499d54f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,84 @@ +2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-05-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/70963 + * gcc.target/powerpc/pr70963.c: New. + +2016-05-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/70635 + * g++.dg/parse/pr70635.C: New. + +2016-05-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from mainline + PR libgfortran/70684 + * gfortran.dg/list_read_14.f90: New test. + +2016-05-02 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2016-04-05 Richard Biener <rguenther@suse.de> + + PR tree-optimization/70526 + * g++.dg/torture/pr70526.C: New testcase. + +2016-04-28 Jakub Jelinek <jakub@redhat.com> + + PR target/70858 + * gcc.target/i386/pr70858.c: New test. + +2016-04-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2016-03-14 Segher Boessenkool <segher@kernel.crashing.org> + + PR target/70098 + * lib/target-supports.exp (check_effective_target_powerpc64_no_dm): + New function. + * g++.dg/pr70098.C: New testcase. + +2016-04-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com> + + PR target/70674 + * gcc.target/s390/pr70674.c: New test. + +2016-04-18 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2016-03-31 Marek Polacek <polacek@redhat.com> + + PR c/70297 + * c-c++-common/pr70297.c: New test. + * g++.dg/cpp0x/typedef-redecl.C: New test. + * gcc.dg/typedef-redecl2.c: New test. + +2016-04-15 Kirill Yukhin <kirill.yukhin@intel.com> + + PR target/70662 + * gcc.target/i386/pr70662.c: New test. + +2016-04-14 Kyrylo Tkachov <kyrylo.tkachov@arm.com> + + Backport from mainline + 2016-03-31 Nick Clifton <nickc@redhat.com> + + PR target/70044 + * gcc.target/aarch64/pr70044.c: New test. + +2016-04-13 Alan Modra <amodra@gmail.com> + + Backport from mainline + 2016-03-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + * g++.dg/template/ptrmem30.C (read): Rename to data_read. + (Holder::foo): Reflect this. + + 2016-03-22 Patrick Palka <ppalka@gcc.gnu.org> + PR c++/70096 + * g++.dg/template/ptrmem30.C: New test. + 2016-04-11 Kyrylo Tkachov <kyrylo.tkachov@arm.com> Backport from mainline diff --git a/gcc/testsuite/c-c++-common/pr70297.c b/gcc/testsuite/c-c++-common/pr70297.c new file mode 100644 index 00000000000..70a4f15cd22 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr70297.c @@ -0,0 +1,9 @@ +/* PR c/70297 */ +/* { dg-do compile } */ +/* { dg-options "-g" } */ + +typedef int T; +typedef int T __attribute__((aligned (4))); +struct S { + T *t; +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/typedef-redecl.C b/gcc/testsuite/g++.dg/cpp0x/typedef-redecl.C new file mode 100644 index 00000000000..576c7ce0332 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/typedef-redecl.C @@ -0,0 +1,12 @@ +// PR c/70297 +// { dg-do compile { target c++11 } } + +#define N 64 + +typedef int T; +typedef int T __attribute__((aligned (N))); +typedef int T __attribute__((aligned (N * 2))); +typedef int T __attribute__((aligned (N))); +typedef int T; + +static_assert (alignof (T) == N * 2, "N * 2"); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-tuple2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-tuple2.C new file mode 100644 index 00000000000..43c00e91d56 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-tuple2.C @@ -0,0 +1,29 @@ +// PR c++/67164 +// { dg-do compile { target c++11 } } + +#include <type_traits> + +namespace detail { + template <bool ...b> + struct fast_and + : std::is_same<fast_and<b...>, fast_and<(b, true)...>> + { }; +} + +template <typename ...Xn> +struct tuple { + tuple() { } + + template <typename ...Yn, typename = typename std::enable_if< + detail::fast_and<std::is_constructible<Xn, Yn&&>::value...>::value + >::type> + tuple(Yn&& ...yn) { } + + template <typename ...Yn, typename = typename std::enable_if< + detail::fast_and<std::is_constructible<Xn, Yn const&>::value...>::value + >::type> + tuple(tuple<Yn...> const& other) { } +}; + +tuple<tuple<>> t{}; +tuple<tuple<>> copy = t; diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-trailing1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-trailing1.C new file mode 100644 index 00000000000..96755b11fd8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-trailing1.C @@ -0,0 +1,12 @@ +// { dg-do compile { target c++14 } } + +template <class T> +void f() +{ + auto lam = [](auto a)->decltype(++a) { return a; }; +} + +int main() +{ + f<int>(); +} diff --git a/gcc/testsuite/g++.dg/parse/pr70635.C b/gcc/testsuite/g++.dg/parse/pr70635.C new file mode 100644 index 00000000000..0873840daf5 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/pr70635.C @@ -0,0 +1,25 @@ +// PR c++/70635 +// { dg-options "-fpermissive -w" } + +template < typename T > +struct A +{ + struct B; + typedef typename B::type type; +}; + +template < typename T > +struct A < T >::B +{ + typedef typename A < type >::type type; // { dg-error "type" } + type Foo (); +}; + +template < typename T > +typename A < T >::B::type +A < T >::B::Foo () +{ + return 0; +} + +template class A<int>; diff --git a/gcc/testsuite/g++.dg/pr70098.C b/gcc/testsuite/g++.dg/pr70098.C new file mode 100644 index 00000000000..f5eb48f96e2 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr70098.C @@ -0,0 +1,91 @@ +// PR target/70098 +// { dg-do compile } +// { dg-options -O2 } +// { dg-require-effective-target c++11 } +// { dg-xfail-if "PR70098" { lp64 && powerpc64_no_dm } } +// { dg-prune-output ".*internal compiler error.*" } + +template < typename > struct traits; +template < typename, int _Rows, int _Cols, int = 0, int = _Rows, + int = _Cols > class Matrix; +template < typename > class G; +template < typename Derived > struct A { + typedef G < Derived > type; +}; + +template < typename Derived > class C { +public: + enum { RowsAtCompileTime = + traits < Derived >::RowsAtCompileTime } static Zero; +}; + +template < typename Derived > class G:public C < Derived > { +}; + +template < int _Rows > class D { +public: + long rows() { + return _Rows; + } +}; + +template < typename Derived > class PlainObjectBase:public A < Derived >::type { + typedef typename A < Derived >::type Base; + D < Base::RowsAtCompileTime > m_storage; + +public: + long rows() { + return m_storage.rows(); + } +}; + +int fn1(); + +struct B { + static long run(long x, long) { + int offset(fn1()); + return x + offset; +}}; + +long fn2(int x) +{ + return B::run(x, 0); +} + +template < typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, + int _MaxCols > + struct traits <Matrix < _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols >> { + enum { RowsAtCompileTime = _Rows }; +}; + +template < typename, int, int, int, int _MaxRows, int _MaxCols > + class Matrix:public PlainObjectBase < Matrix < double, _MaxRows, + _MaxCols >> { +public: + template < typename OtherDerived > Matrix(OtherDerived); +}; + +struct F { + static Matrix < double, 2, 2 > run(long size) { + Matrix < double, 2, 2 > diag = Matrix < double, 2, 2 >::Zero; + long i = 0; + while (i < size) { + long randomInt = fn2(-1); + if (randomInt == 0) + ++i; + else { + double alpha(randomInt); + diag = alpha; + i = 2; + } + } + + return diag; + } +}; + +void fn3(Matrix < double, 2, 2 > m) +{ + long size = m.rows(); + F::run(size); +} diff --git a/gcc/testsuite/g++.dg/template/ptrmem30.C b/gcc/testsuite/g++.dg/template/ptrmem30.C new file mode 100644 index 00000000000..31e9b5d17f6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem30.C @@ -0,0 +1,45 @@ +// PR c++/70096 +// { dg-do run } + +int data_read; + +struct Holder +{ + void foo () { data_read = data; } + int data; +}; + +void +poison_stack () +{ + volatile char a[256]; + __builtin_memset ((void *)a, 0xa, sizeof a); +} + +template <typename F> +void test1 () +{ + Holder h; + h.data = 42; + F Holder::*fptr = &Holder::foo; + (h.*fptr)(); +} + +template <typename F> +void test2 () +{ + Holder h; + h.data = 42; + F Holder::*fptr1 = &Holder::foo; + F Holder::*fptr2 = fptr1; + (h.*fptr2)(); +} + + +int main () +{ + poison_stack (); + test1<void()>(); + poison_stack (); + test2<void()>(); +} diff --git a/gcc/testsuite/g++.dg/torture/pr70526.C b/gcc/testsuite/g++.dg/torture/pr70526.C new file mode 100644 index 00000000000..37a3e5f5a49 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr70526.C @@ -0,0 +1,35 @@ +// { dg-do run } + +typedef unsigned uint32_t; + +template<typename T> +struct AlignedStorage2 +{ + char mBytes[sizeof(T)]; + + const T* addr() const { return reinterpret_cast<const T*>(mBytes); } + T* addr() { return reinterpret_cast<T*>(mBytes); } +}; + +struct Register { + uint32_t reg_; +}; + +class TypedOrValueRegister +{ + AlignedStorage2<Register> typed; + __attribute__((noinline)) Register& dataTyped() { return *typed.addr(); } +public: + TypedOrValueRegister(Register reg) + { + dataTyped() = reg; + } + Register typedReg() const { return *typed.addr(); } +}; + +int main() { + Register reg = { 10u }; + if (TypedOrValueRegister(reg).typedReg().reg_ != 10) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/typedef-redecl2.c b/gcc/testsuite/gcc.dg/typedef-redecl2.c new file mode 100644 index 00000000000..c2314c78eaa --- /dev/null +++ b/gcc/testsuite/gcc.dg/typedef-redecl2.c @@ -0,0 +1,13 @@ +/* PR c/70297 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#define N 64 + +typedef int T; +typedef int T __attribute__((aligned (N))); +typedef int T __attribute__((aligned (N * 2))); +typedef int T __attribute__((aligned (N))); +typedef int T; + +_Static_assert (_Alignof (T) == N * 2, "N * 2"); diff --git a/gcc/testsuite/gcc.target/i386/pr70662.c b/gcc/testsuite/gcc.target/i386/pr70662.c new file mode 100644 index 00000000000..109e224d7b4 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70662.c @@ -0,0 +1,19 @@ +/* { dg-do assemble { target { ! ia32 } } } */ +/* { dg-require-effective-target avx512vbmi } */ +/* { dg-require-effective-target masm_intel } */ +/* { dg-options "-Og -fschedule-insns -fno-tree-fre -mavx512vbmi --param=max-sched-ready-insns=1 -masm=intel" } */ + +typedef char v64u8 __attribute__((vector_size(64))); +typedef int v64u32 __attribute__((vector_size(64))); +typedef long v64u64 __attribute__((vector_size(64))); +typedef __int128 v64u128 __attribute__((vector_size(64))); + +v64u128 +foo(int u8_0, unsigned u128_0, v64u32 v64u32_1, v64u32 v64u32_0, v64u64 v64u64_0, v64u128 v64u128_0) +{ + v64u8 v64u8_0 = v64u8_0; + v64u32_0 = v64u32_0 >> (v64u32){0, 0, 0, 1, 0, ((v64u64)v64u64_0)[u8_0], ((v64u32)v64u128_0)[15], 0, 0, 0, 0, 4, ((v64u64)v64u64_0)[v64u32_0[0]] - 1}; + v64u8_0 = v64u8_0 << ((v64u8)v64u32_1 & 1); + v64u64_0[0] >>= 0; + return u128_0 + (v64u128)v64u8_0 + (v64u128)v64u32_0 + (v64u128)v64u64_0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr70858.c b/gcc/testsuite/gcc.target/i386/pr70858.c new file mode 100644 index 00000000000..99d7877346c --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr70858.c @@ -0,0 +1,45 @@ +/* PR target/70858 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mlwp -mbmi -mtbm -mbmi2 -std=gnu11" } */ + +void +f1 (unsigned long long x, unsigned int y) +{ + __builtin_ia32_lwpval64 (x, y, 1); /* { dg-warning "implicit declaration of function .__builtin_ia32_lwpval64." "" { target ia32 } } */ +} + +char +f2 (unsigned long long x, unsigned int y) +{ + return __builtin_ia32_lwpins64 (x, y, 1); /* { dg-warning "implicit declaration of function .__builtin_ia32_lwpins64." "" { target ia32 } } */ +} + +unsigned long long +f3 (unsigned long long x, unsigned long long y) +{ + return __builtin_ia32_bextr_u64 (x, y); /* { dg-warning "implicit declaration of function .__builtin_ia32_bextr_u64." "" { target ia32 } } */ +} + +unsigned long long +f4 (unsigned long long x) +{ + return __builtin_ia32_bextri_u64 (x, 1); /* { dg-warning "implicit declaration of function .__builtin_ia32_bextri_u64." "" { target ia32 } } */ +} + +unsigned long long +f5 (unsigned long long x, unsigned long long y) +{ + return __builtin_ia32_bzhi_di (x, y); /* { dg-warning "implicit declaration of function .__builtin_ia32_bzhi_di." "" { target ia32 } } */ +} + +unsigned long long +f6 (unsigned long long x, unsigned long long y) +{ + return __builtin_ia32_pdep_di (x, y); /* { dg-warning "implicit declaration of function .__builtin_ia32_pdep_di." "" { target ia32 } } */ +} + +unsigned long long +f7 (unsigned long long x, unsigned long long y) +{ + return __builtin_ia32_pext_di (x, y); /* { dg-warning "implicit declaration of function .__builtin_ia32_pext_di." "" { target ia32 } } */ +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr70963.c b/gcc/testsuite/gcc.target/powerpc/pr70963.c new file mode 100644 index 00000000000..b5d8316b722 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr70963.c @@ -0,0 +1,43 @@ +/* { dg-do run { target { powerpc64*-*-* && vsx_hw } } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-options "-maltivec" } */ + +#include <stdlib.h> +#include <stdio.h> +#include <altivec.h> + +static int failed; +static void test (void); + +static void check (int result, const char *name) +{ + if (!result) + { + failed++; + printf ("fail %s\n", name); + } +} + +int main (void) +{ + test (); + if (failed) + abort (); + return 0; +} + +vector double x = { 81.0, 76.0 }; +vector long long y = { 81, 76 }; + +static void test() +{ + vector long long a = vec_cts (x, 0); + vector double b = vec_ctf (a, 0); + vector long long c = __builtin_vsx_xvcvdpuxds_scale (x, 0); + vector double d = vec_ctf (c, 0); + check (vec_all_eq (a, y), "vec_cts"); + check (vec_all_eq (b, x), "vec_ctf"); + check (vec_all_eq (c, y), "xvcvdpuxds"); + check (vec_all_eq (d, x), "vec_ctf unsigned"); +} diff --git a/gcc/testsuite/gcc.target/s390/pr70674.c b/gcc/testsuite/gcc.target/s390/pr70674.c new file mode 100644 index 00000000000..13bf271d95f --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/pr70674.c @@ -0,0 +1,13 @@ +/* Test case for PR/70674. */ + +/* { dg-do compile { target s390x-*-* } } */ +/* { dg-options "-march=z10 -mtune=z196 -O2 -fno-omit-frame-pointer -fno-asynchronous-unwind-tables" } */ + +void +foo (void) +{ + volatile int a = 5; + (void) a; +} + +/* { dg-final { scan-assembler-not "^.*lgdr.*\n.*\\(%r11\\)" } } */ diff --git a/gcc/testsuite/gfortran.dg/list_read_14.f90 b/gcc/testsuite/gfortran.dg/list_read_14.f90 new file mode 100644 index 00000000000..15bcfad500d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/list_read_14.f90 @@ -0,0 +1,25 @@ +! { dg-do run } +! PR70684 incorrect reading of values from file on Windows +program test +implicit none +integer,parameter :: isize=12 +integer,parameter :: funit=12 +integer :: i +character(1), parameter :: cr=char(13) +double precision, dimension(isize) :: a, res +res= (/ 1.0000000000000000, 2.0000000000000000, 3.0000000000000000, & + 4.0000000000000000, 5.0000000000000000, 6.0000000000000000, & + 7.0000000000000000, 8.0000000000000000, 9.0000000000000000, & + 10.000000000000000, 11.000000000000000, 12.000000000000000 /) +do i=1,isize + a(i)=dble(i) +enddo +open(funit,status="scratch") +write(funit,'(1x,6(f25.20,'',''),a)') (a(i),i=1,6), cr +write(funit,'(1x,6(f25.20,'',''),a)') (a(i),i=7,12), cr +rewind(funit) +a=0d0 +read(funit,*) (a(i),i=1,isize) +close(funit) +if (any(a /= res)) call abort +end diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 6df3bf22e26..e1597282466 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1575,6 +1575,19 @@ proc check_effective_target_avx_runtime { } { return 0 } +# Return 1 if we are compiling for 64-bit PowerPC but we do not use direct +# move instructions for moves from GPR to FPR. + +proc check_effective_target_powerpc64_no_dm { } { + # The "mulld" checks if we are generating PowerPC64 code. The "lfd" + # checks if we do not use direct moves, but use the old-fashioned + # slower move-via-the-stack. + return [check_no_messages_and_pattern powerpc64_no_dm \ + {\mmulld\M.*\mlfd} assembly { + double f(long long x) { return x*x; } + } {-O2}] +} + # Return 1 if the target supports executing power8 vector instructions, 0 # otherwise. Cache the result. diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 98dce7d825e..b2e9190ccec 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1589,7 +1589,7 @@ build_ref_for_offset (location_t loc, tree base, HOST_WIDE_INT offset, } else { - off = build_int_cst (reference_alias_ptr_type (base), + off = build_int_cst (reference_alias_ptr_type (prev_base), base_offset + offset / BITS_PER_UNIT); base = build_fold_addr_expr (unshare_expr (base)); } diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog index 282831d23dd..58826de45ca 100644 --- a/libatomic/ChangeLog +++ b/libatomic/ChangeLog @@ -1,3 +1,13 @@ +2016-05-10 Sebastian Huber <sebastian.huber@embedded-brains.de> + + Backport from mainline: + 2016-04-27 Sebastian Huber <sebastian.huber@embedded-brains.de> + + * configure.tgt (configure_tgt_pre_target_cpu_XCFLAGS): New variable. + (*-*-rtems*): New supported target. + * config/rtems/host-config.h: New file. + * config/rtems/lock.c: Likewise. + 2016-01-06 Szabolcs Nagy <szabolcs.nagy@arm.com> Backport from mainline: diff --git a/libatomic/config/rtems/host-config.h b/libatomic/config/rtems/host-config.h new file mode 100644 index 00000000000..d11e9efb01f --- /dev/null +++ b/libatomic/config/rtems/host-config.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2016 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Atomic Library (libatomic). + + Libatomic is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +/* Included after all more target-specific host-config.h. */ + +#include <machine/_libatomic.h> + +static inline UWORD +protect_start (void *ptr) +{ + return _Libatomic_Protect_start (ptr); +} + +static inline void +protect_end (void *ptr, UWORD isr_level) +{ + _Libatomic_Protect_end (ptr, isr_level); +} + +#include_next <host-config.h> diff --git a/libatomic/config/rtems/lock.c b/libatomic/config/rtems/lock.c new file mode 100644 index 00000000000..f999f9b6837 --- /dev/null +++ b/libatomic/config/rtems/lock.c @@ -0,0 +1,37 @@ +/* Copyright (C) 2016 Free Software Foundation, Inc. + Contributed by Sebastian Huber <sebastian.huber@embedded-brains.de>. + + This file is part of the GNU Atomic Library (libatomic). + + Libatomic is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Libatomic is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + Under Section 7 of GPL version 3, you are granted additional + permissions described in the GCC Runtime Library Exception, version + 3.1, as published by the Free Software Foundation. + + You should have received a copy of the GNU General Public License and + a copy of the GCC Runtime Library Exception along with this program; + see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + <http://www.gnu.org/licenses/>. */ + +#include "libatomic_i.h" + +void +libat_lock_n (void *ptr, size_t n) +{ + _Libatomic_Lock_n (ptr, n); +} + +void +libat_unlock_n (void *ptr, size_t n) +{ + _Libatomic_Unlock_n (ptr, n); +} diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt index 3c1feddc356..f516afa8b9c 100644 --- a/libatomic/configure.tgt +++ b/libatomic/configure.tgt @@ -26,6 +26,10 @@ # Map the target cpu to an ARCH sub-directory. At the same time, # work out any special compilation flags as necessary. +# Give operating systems the opportunity to discard XCFLAGS modifications based +# on ${target_cpu}. For example to allow proper use of multilibs. +configure_tgt_pre_target_cpu_XCFLAGS="${XCFLAGS}" + case "${target_cpu}" in alpha*) # fenv.c needs this option to generate inexact exceptions. @@ -128,6 +132,12 @@ case "${target}" in ;; esac ;; + + *-*-rtems*) + XCFLAGS="${configure_tgt_pre_target_cpu_XCFLAGS}" + config_path="rtems" + ;; + *-*-elf*) # ??? No target OS. We could be targeting bare-metal kernel-mode, # or user-mode for some custom OS. If the target supports TAS, diff --git a/libcilkrts/ChangeLog b/libcilkrts/ChangeLog index facdcf3c8cd..904c67f7fa3 100644 --- a/libcilkrts/ChangeLog +++ b/libcilkrts/ChangeLog @@ -1,3 +1,12 @@ +2016-05-08 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + Backport from mainline + 2016-04-26 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR target/60290 + * Makefile.am (GENERAL_FLAGS): Add -funwind-tables. + * Makefile.in: Regenerate. + 2015-12-04 Release Manager * GCC 5.3.0 released. diff --git a/libcilkrts/Makefile.am b/libcilkrts/Makefile.am index 70538a21a50..4f944dd1a62 100644 --- a/libcilkrts/Makefile.am +++ b/libcilkrts/Makefile.am @@ -43,6 +43,9 @@ GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime -I$(top_srcdir)/ # Enable Intel Cilk Plus extension GENERAL_FLAGS += -fcilkplus +# Always generate unwind tables +GENERAL_FLAGS += -funwind-tables + AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99 AM_CPPFLAGS = $(GENERAL_FLAGS) AM_LDFLAGS = $(XLDFLAGS) diff --git a/libcilkrts/Makefile.in b/libcilkrts/Makefile.in index e1a54b57678..defb3edcb7b 100644 --- a/libcilkrts/Makefile.in +++ b/libcilkrts/Makefile.in @@ -343,9 +343,11 @@ ACLOCAL_AMFLAGS = -I .. -I ../config # GENERAL_FLAGS += -D_Cilk_spawn="" -D_Cilk_sync="" -D_Cilk_for=for # Enable Intel Cilk Plus extension + +# Always generate unwind tables GENERAL_FLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/runtime \ -I$(top_srcdir)/runtime/config/$(config_dir) \ - -DIN_CILK_RUNTIME=1 -fcilkplus + -DIN_CILK_RUNTIME=1 -fcilkplus -funwind-tables AM_CFLAGS = $(XCFLAGS) $(GENERAL_FLAGS) -std=c99 AM_CPPFLAGS = $(GENERAL_FLAGS) AM_LDFLAGS = $(XLDFLAGS) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index b3952c36f50..b356340f478 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2016-05-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + Backport from trunk. + PR libgfortran/70684 + * io/list_read (check_buffers): Add '\r' to check for end of line. + 2016-04-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> Dominique d'Humieres <dominiq@lps.ens.fr> diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index e02feca952b..6b42ecf1824 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -197,7 +197,7 @@ check_buffers (st_parameter_dt *dtp) } done: - dtp->u.p.at_eol = (c == '\n' || c == EOF); + dtp->u.p.at_eol = (c == '\n' || c == '\r' || c == EOF); return c; } diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 31041864edd..41be2bf6c1d 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2016-04-23 Dominique d'Humieres <dominiq@lps.ens.fr> + + backport from trunk: + 2016-04-20 Ben Elliston <bje@gnu.org> + + * testsuite/lib/libjava.exp (libjava_arguments): Use 'file + normalize' rather than the defunct DejaGnu 'absolute' proc. + 2016-01-03 Matthias Klose <doko@ubuntu.com> * include/jvm.h (GCJ_CXX_ABI_VERSION): Freeze the ABI for releases diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp index 0cfb25330a5..45d2074e088 100644 --- a/libjava/testsuite/lib/libjava.exp +++ b/libjava/testsuite/lib/libjava.exp @@ -416,7 +416,7 @@ proc libjava_arguments {{mode compile}} { # Search for libtool. We need it to link. set found_compiler 0 - set d [absolute $objdir] + set d [file normalize $objdir] foreach x {. .. ../.. ../../..} { if {[file exists $d/$x/libtool]} then { # We have to run silently to avoid DejaGNU lossage. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 09b58655300..04e167fc31a 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,48 @@ +2016-04-20 Jonathan Wakely <jwakely@redhat.com> + + Backport from mainline + 2016-01-26 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/69478 + * include/bits/stl_algobase.h (__copy_move<_IsMove, true, + random_access_iterator_tag>): Check is_move_assignable when moving. + (__copy_move_backwards<_IsMove, true, random_access_iterator_tag>): + Likewise. + * testsuite/25_algorithms/copy/move_iterators/69478.cc: New. + * testsuite/25_algorithms/copy_backward/move_iterators/69478.cc: New. + * testsuite/25_algorithms/move/69478.cc: New. + * testsuite/25_algorithms/move_backward/69478.cc: New. + + Backport from mainline + 2016-04-05 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/70503 + * src/c++11/thread.cc (execute_native_thread_routine, + execute_native_thread_routine_compat): Give internal linkage. + * testsuite/30_threads/thread/70503.cc: New test. + + Backport from mainline + 2016-01-25 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/69464 + * include/Makefile.am: Add new header. + * include/Makefile.in: Regenerate. + * include/bits/random.h (uniform_int_distribution): Move to + bits/uniform_int_dist.h. + * include/bits/random.tcc (uniform_int_distribution::operator(), + uniform_int_distribution::__generate_impl): Likewise. + * include/bits/uniform_int_dist.h: New header. + * include/bits/stl_algo.h [__cplusplus >= 201103L]: Include + <bits/uniform_int_dist.h> instead of <random>. + * testsuite/20_util/specialized_algorithms/uninitialized_copy/ + move_iterators/1.cc: Include correct header for uninitialized_copy. + * testsuite/20_util/specialized_algorithms/uninitialized_copy_n/ + move_iterators/1.cc: Likewise. + * testsuite/25_algorithms/nth_element/58800.cc: Include correct + header for vector. + * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lines. + * testsuite/libstdc++-prettyprinters/whatis.cc: Include <random>. + 2016-04-06 Eric Botcazou <ebotcazou@adacore.com> * src/Makefile.am (libstdc++-symbols.ver): Remove useless /dev/null. diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am index 5b3b93b169f..5b6b4eb9063 100644 --- a/libstdc++-v3/include/Makefile.am +++ b/libstdc++-v3/include/Makefile.am @@ -178,6 +178,7 @@ bits_headers = \ ${bits_srcdir}/stl_vector.h \ ${bits_srcdir}/streambuf.tcc \ ${bits_srcdir}/stringfwd.h \ + ${bits_srcdir}/uniform_int_dist.h \ ${bits_srcdir}/unique_ptr.h \ ${bits_srcdir}/unordered_map.h \ ${bits_srcdir}/unordered_set.h \ diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in index 256d598ab6f..02b3ae846c8 100644 --- a/libstdc++-v3/include/Makefile.in +++ b/libstdc++-v3/include/Makefile.in @@ -468,6 +468,7 @@ bits_headers = \ ${bits_srcdir}/stl_vector.h \ ${bits_srcdir}/streambuf.tcc \ ${bits_srcdir}/stringfwd.h \ + ${bits_srcdir}/uniform_int_dist.h \ ${bits_srcdir}/unique_ptr.h \ ${bits_srcdir}/unordered_map.h \ ${bits_srcdir}/unordered_set.h \ diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 8caade50827..d152722aefd 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -32,6 +32,7 @@ #define _RANDOM_H 1 #include <vector> +#include <bits/uniform_int_dist.h> namespace std _GLIBCXX_VISIBILITY(default) { @@ -149,14 +150,6 @@ _GLIBCXX_END_NAMESPACE_VERSION __mod(_Tp __x) { return _Mod<_Tp, __m, __a, __c>::__calc(__x); } - /* Determine whether number is a power of 2. */ - template<typename _Tp> - inline bool - _Power_of_2(_Tp __x) - { - return ((__x - 1) & __x) == 0; - }; - /* * An adaptor class for converting the output of any Generator into * the input for a specific Distribution. @@ -1656,164 +1649,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @{ */ - /** - * @brief Uniform discrete distribution for random numbers. - * A discrete random distribution on the range @f$[min, max]@f$ with equal - * probability throughout the range. - */ - template<typename _IntType = int> - class uniform_int_distribution - { - static_assert(std::is_integral<_IntType>::value, - "template argument not an integral type"); - - public: - /** The type of the range of the distribution. */ - typedef _IntType result_type; - /** Parameter type. */ - struct param_type - { - typedef uniform_int_distribution<_IntType> distribution_type; - - explicit - param_type(_IntType __a = 0, - _IntType __b = std::numeric_limits<_IntType>::max()) - : _M_a(__a), _M_b(__b) - { - _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); - } - - result_type - a() const - { return _M_a; } - - result_type - b() const - { return _M_b; } - - friend bool - operator==(const param_type& __p1, const param_type& __p2) - { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } - - private: - _IntType _M_a; - _IntType _M_b; - }; - - public: - /** - * @brief Constructs a uniform distribution object. - */ - explicit - uniform_int_distribution(_IntType __a = 0, - _IntType __b = std::numeric_limits<_IntType>::max()) - : _M_param(__a, __b) - { } - - explicit - uniform_int_distribution(const param_type& __p) - : _M_param(__p) - { } - - /** - * @brief Resets the distribution state. - * - * Does nothing for the uniform integer distribution. - */ - void - reset() { } - - result_type - a() const - { return _M_param.a(); } - - result_type - b() const - { return _M_param.b(); } - - /** - * @brief Returns the parameter set of the distribution. - */ - param_type - param() const - { return _M_param; } - - /** - * @brief Sets the parameter set of the distribution. - * @param __param The new parameter set of the distribution. - */ - void - param(const param_type& __param) - { _M_param = __param; } - - /** - * @brief Returns the inclusive lower bound of the distribution range. - */ - result_type - min() const - { return this->a(); } - - /** - * @brief Returns the inclusive upper bound of the distribution range. - */ - result_type - max() const - { return this->b(); } - - /** - * @brief Generating functions. - */ - template<typename _UniformRandomNumberGenerator> - result_type - operator()(_UniformRandomNumberGenerator& __urng) - { return this->operator()(__urng, _M_param); } - - template<typename _UniformRandomNumberGenerator> - result_type - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __p); - - template<typename _ForwardIterator, - typename _UniformRandomNumberGenerator> - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng) - { this->__generate(__f, __t, __urng, _M_param); } - - template<typename _ForwardIterator, - typename _UniformRandomNumberGenerator> - void - __generate(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - template<typename _UniformRandomNumberGenerator> - void - __generate(result_type* __f, result_type* __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p) - { this->__generate_impl(__f, __t, __urng, __p); } - - /** - * @brief Return true if two uniform integer distributions have - * the same parameters. - */ - friend bool - operator==(const uniform_int_distribution& __d1, - const uniform_int_distribution& __d2) - { return __d1._M_param == __d2._M_param; } - - private: - template<typename _ForwardIterator, - typename _UniformRandomNumberGenerator> - void - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __p); - - param_type _M_param; - }; + // std::uniform_int_distribution is defined in <bits/uniform_int_dist.h> /** * @brief Return true if two uniform integer distributions have diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index f10d052f909..d092cacf0cb 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -872,158 +872,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } - template<typename _IntType> - template<typename _UniformRandomNumberGenerator> - typename uniform_int_distribution<_IntType>::result_type - uniform_int_distribution<_IntType>:: - operator()(_UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - typedef typename _UniformRandomNumberGenerator::result_type - _Gresult_type; - typedef typename std::make_unsigned<result_type>::type __utype; - typedef typename std::common_type<_Gresult_type, __utype>::type - __uctype; - - const __uctype __urngmin = __urng.min(); - const __uctype __urngmax = __urng.max(); - const __uctype __urngrange = __urngmax - __urngmin; - const __uctype __urange - = __uctype(__param.b()) - __uctype(__param.a()); - - __uctype __ret; - - if (__urngrange > __urange) - { - // downscaling - const __uctype __uerange = __urange + 1; // __urange can be zero - const __uctype __scaling = __urngrange / __uerange; - const __uctype __past = __uerange * __scaling; - do - __ret = __uctype(__urng()) - __urngmin; - while (__ret >= __past); - __ret /= __scaling; - } - else if (__urngrange < __urange) - { - // upscaling - /* - Note that every value in [0, urange] - can be written uniquely as - - (urngrange + 1) * high + low - - where - - high in [0, urange / (urngrange + 1)] - - and - - low in [0, urngrange]. - */ - __uctype __tmp; // wraparound control - do - { - const __uctype __uerngrange = __urngrange + 1; - __tmp = (__uerngrange * operator() - (__urng, param_type(0, __urange / __uerngrange))); - __ret = __tmp + (__uctype(__urng()) - __urngmin); - } - while (__ret > __urange || __ret < __tmp); - } - else - __ret = __uctype(__urng()) - __urngmin; - - return __ret + __param.a(); - } - - - template<typename _IntType> - template<typename _ForwardIterator, - typename _UniformRandomNumberGenerator> - void - uniform_int_distribution<_IntType>:: - __generate_impl(_ForwardIterator __f, _ForwardIterator __t, - _UniformRandomNumberGenerator& __urng, - const param_type& __param) - { - __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) - typedef typename _UniformRandomNumberGenerator::result_type - _Gresult_type; - typedef typename std::make_unsigned<result_type>::type __utype; - typedef typename std::common_type<_Gresult_type, __utype>::type - __uctype; - - const __uctype __urngmin = __urng.min(); - const __uctype __urngmax = __urng.max(); - const __uctype __urngrange = __urngmax - __urngmin; - const __uctype __urange - = __uctype(__param.b()) - __uctype(__param.a()); - - __uctype __ret; - - if (__urngrange > __urange) - { - if (__detail::_Power_of_2(__urngrange + 1) - && __detail::_Power_of_2(__urange + 1)) - { - while (__f != __t) - { - __ret = __uctype(__urng()) - __urngmin; - *__f++ = (__ret & __urange) + __param.a(); - } - } - else - { - // downscaling - const __uctype __uerange = __urange + 1; // __urange can be zero - const __uctype __scaling = __urngrange / __uerange; - const __uctype __past = __uerange * __scaling; - while (__f != __t) - { - do - __ret = __uctype(__urng()) - __urngmin; - while (__ret >= __past); - *__f++ = __ret / __scaling + __param.a(); - } - } - } - else if (__urngrange < __urange) - { - // upscaling - /* - Note that every value in [0, urange] - can be written uniquely as - - (urngrange + 1) * high + low - - where - - high in [0, urange / (urngrange + 1)] - - and - - low in [0, urngrange]. - */ - __uctype __tmp; // wraparound control - while (__f != __t) - { - do - { - const __uctype __uerngrange = __urngrange + 1; - __tmp = (__uerngrange * operator() - (__urng, param_type(0, __urange / __uerngrange))); - __ret = __tmp + (__uctype(__urng()) - __urngmin); - } - while (__ret > __urange || __ret < __tmp); - *__f++ = __ret; - } - } - else - while (__f != __t) - *__f++ = __uctype(__urng()) - __urngmin + __param.a(); - } - template<typename _IntType, typename _CharT, typename _Traits> std::basic_ostream<_CharT, _Traits>& operator<<(std::basic_ostream<_CharT, _Traits>& __os, diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 53c455b16f3..77bb37ae92f 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -63,7 +63,7 @@ #include <bits/predefined_ops.h> #if __cplusplus >= 201103L -#include <random> // for std::uniform_int_distribution +#include <bits/uniform_int_dist.h> #endif // See concept_check.h for the __glibcxx_*_requires macros. diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index 2b69e618954..68959fa3ef6 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -373,9 +373,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __copy_m(const _Tp* __first, const _Tp* __last, _Tp* __result) { #if __cplusplus >= 201103L + using __assignable = conditional<_IsMove, + is_move_assignable<_Tp>, + is_copy_assignable<_Tp>>; // trivial types can have deleted assignment - static_assert( is_copy_assignable<_Tp>::value, - "type is not assignable" ); + static_assert( __assignable::type::value, "type is not assignable" ); #endif const ptrdiff_t _Num = __last - __first; if (_Num) @@ -573,9 +575,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __copy_move_b(const _Tp* __first, const _Tp* __last, _Tp* __result) { #if __cplusplus >= 201103L + using __assignable = conditional<_IsMove, + is_move_assignable<_Tp>, + is_copy_assignable<_Tp>>; // trivial types can have deleted assignment - static_assert( is_copy_assignable<_Tp>::value, - "type is not assignable" ); + static_assert( __assignable::type::value, "type is not assignable" ); #endif const ptrdiff_t _Num = __last - __first; if (_Num) diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h new file mode 100644 index 00000000000..670e3795324 --- /dev/null +++ b/libstdc++-v3/include/bits/uniform_int_dist.h @@ -0,0 +1,369 @@ +// Class template uniform_int_distribution -*- C++ -*- + +// Copyright (C) 2009-2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// <http://www.gnu.org/licenses/>. + +/** + * @file bits/uniform_int_dist.h + * This is an internal header file, included by other library headers. + * Do not attempt to use it directly. @headername{random} + */ + +#ifndef _GLIBCXX_BITS_UNIFORM_INT_DIST_H +#define _GLIBCXX_BITS_UNIFORM_INT_DIST_H + +#include <type_traits> +#include <limits> + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + namespace __detail + { + /* Determine whether number is a power of 2. */ + template<typename _Tp> + inline bool + _Power_of_2(_Tp __x) + { + return ((__x - 1) & __x) == 0; + }; + } + + /** + * @brief Uniform discrete distribution for random numbers. + * + * A discrete random distribution on the range @f$[min, max]@f$ with equal + * probability throughout the range. + * + * @ingroup random_distributions_uniform + */ + template<typename _IntType = int> + class uniform_int_distribution + { + static_assert(std::is_integral<_IntType>::value, + "template argument not an integral type"); + + public: + /** The type of the range of the distribution. */ + typedef _IntType result_type; + /** Parameter type. */ + struct param_type + { + typedef uniform_int_distribution<_IntType> distribution_type; + + explicit + param_type(_IntType __a = 0, + _IntType __b = std::numeric_limits<_IntType>::max()) + : _M_a(__a), _M_b(__b) + { + _GLIBCXX_DEBUG_ASSERT(_M_a <= _M_b); + } + + result_type + a() const + { return _M_a; } + + result_type + b() const + { return _M_b; } + + friend bool + operator==(const param_type& __p1, const param_type& __p2) + { return __p1._M_a == __p2._M_a && __p1._M_b == __p2._M_b; } + + private: + _IntType _M_a; + _IntType _M_b; + }; + + public: + /** + * @brief Constructs a uniform distribution object. + */ + explicit + uniform_int_distribution(_IntType __a = 0, + _IntType __b = std::numeric_limits<_IntType>::max()) + : _M_param(__a, __b) + { } + + explicit + uniform_int_distribution(const param_type& __p) + : _M_param(__p) + { } + + /** + * @brief Resets the distribution state. + * + * Does nothing for the uniform integer distribution. + */ + void + reset() { } + + result_type + a() const + { return _M_param.a(); } + + result_type + b() const + { return _M_param.b(); } + + /** + * @brief Returns the parameter set of the distribution. + */ + param_type + param() const + { return _M_param; } + + /** + * @brief Sets the parameter set of the distribution. + * @param __param The new parameter set of the distribution. + */ + void + param(const param_type& __param) + { _M_param = __param; } + + /** + * @brief Returns the inclusive lower bound of the distribution range. + */ + result_type + min() const + { return this->a(); } + + /** + * @brief Returns the inclusive upper bound of the distribution range. + */ + result_type + max() const + { return this->b(); } + + /** + * @brief Generating functions. + */ + template<typename _UniformRandomNumberGenerator> + result_type + operator()(_UniformRandomNumberGenerator& __urng) + { return this->operator()(__urng, _M_param); } + + template<typename _UniformRandomNumberGenerator> + result_type + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __p); + + template<typename _ForwardIterator, + typename _UniformRandomNumberGenerator> + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng) + { this->__generate(__f, __t, __urng, _M_param); } + + template<typename _ForwardIterator, + typename _UniformRandomNumberGenerator> + void + __generate(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + template<typename _UniformRandomNumberGenerator> + void + __generate(result_type* __f, result_type* __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p) + { this->__generate_impl(__f, __t, __urng, __p); } + + /** + * @brief Return true if two uniform integer distributions have + * the same parameters. + */ + friend bool + operator==(const uniform_int_distribution& __d1, + const uniform_int_distribution& __d2) + { return __d1._M_param == __d2._M_param; } + + private: + template<typename _ForwardIterator, + typename _UniformRandomNumberGenerator> + void + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __p); + + param_type _M_param; + }; + + template<typename _IntType> + template<typename _UniformRandomNumberGenerator> + typename uniform_int_distribution<_IntType>::result_type + uniform_int_distribution<_IntType>:: + operator()(_UniformRandomNumberGenerator& __urng, + const param_type& __param) + { + typedef typename _UniformRandomNumberGenerator::result_type + _Gresult_type; + typedef typename std::make_unsigned<result_type>::type __utype; + typedef typename std::common_type<_Gresult_type, __utype>::type + __uctype; + + const __uctype __urngmin = __urng.min(); + const __uctype __urngmax = __urng.max(); + const __uctype __urngrange = __urngmax - __urngmin; + const __uctype __urange + = __uctype(__param.b()) - __uctype(__param.a()); + + __uctype __ret; + + if (__urngrange > __urange) + { + // downscaling + const __uctype __uerange = __urange + 1; // __urange can be zero + const __uctype __scaling = __urngrange / __uerange; + const __uctype __past = __uerange * __scaling; + do + __ret = __uctype(__urng()) - __urngmin; + while (__ret >= __past); + __ret /= __scaling; + } + else if (__urngrange < __urange) + { + // upscaling + /* + Note that every value in [0, urange] + can be written uniquely as + + (urngrange + 1) * high + low + + where + + high in [0, urange / (urngrange + 1)] + + and + + low in [0, urngrange]. + */ + __uctype __tmp; // wraparound control + do + { + const __uctype __uerngrange = __urngrange + 1; + __tmp = (__uerngrange * operator() + (__urng, param_type(0, __urange / __uerngrange))); + __ret = __tmp + (__uctype(__urng()) - __urngmin); + } + while (__ret > __urange || __ret < __tmp); + } + else + __ret = __uctype(__urng()) - __urngmin; + + return __ret + __param.a(); + } + + + template<typename _IntType> + template<typename _ForwardIterator, + typename _UniformRandomNumberGenerator> + void + uniform_int_distribution<_IntType>:: + __generate_impl(_ForwardIterator __f, _ForwardIterator __t, + _UniformRandomNumberGenerator& __urng, + const param_type& __param) + { + __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) + typedef typename _UniformRandomNumberGenerator::result_type + _Gresult_type; + typedef typename std::make_unsigned<result_type>::type __utype; + typedef typename std::common_type<_Gresult_type, __utype>::type + __uctype; + + const __uctype __urngmin = __urng.min(); + const __uctype __urngmax = __urng.max(); + const __uctype __urngrange = __urngmax - __urngmin; + const __uctype __urange + = __uctype(__param.b()) - __uctype(__param.a()); + + __uctype __ret; + + if (__urngrange > __urange) + { + if (__detail::_Power_of_2(__urngrange + 1) + && __detail::_Power_of_2(__urange + 1)) + { + while (__f != __t) + { + __ret = __uctype(__urng()) - __urngmin; + *__f++ = (__ret & __urange) + __param.a(); + } + } + else + { + // downscaling + const __uctype __uerange = __urange + 1; // __urange can be zero + const __uctype __scaling = __urngrange / __uerange; + const __uctype __past = __uerange * __scaling; + while (__f != __t) + { + do + __ret = __uctype(__urng()) - __urngmin; + while (__ret >= __past); + *__f++ = __ret / __scaling + __param.a(); + } + } + } + else if (__urngrange < __urange) + { + // upscaling + /* + Note that every value in [0, urange] + can be written uniquely as + + (urngrange + 1) * high + low + + where + + high in [0, urange / (urngrange + 1)] + + and + + low in [0, urngrange]. + */ + __uctype __tmp; // wraparound control + while (__f != __t) + { + do + { + const __uctype __uerngrange = __urngrange + 1; + __tmp = (__uerngrange * operator() + (__urng, param_type(0, __urange / __uerngrange))); + __ret = __tmp + (__uctype(__urng()) - __urngmin); + } + while (__ret > __urange || __ret < __tmp); + *__f++ = __ret; + } + } + else + while (__f != __t) + *__f++ = __uctype(__urng()) - __urngmin + __param.a(); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/libstdc++-v3/src/c++11/thread.cc b/libstdc++-v3/src/c++11/thread.cc index 906cafa735a..7fa415b49d1 100644 --- a/libstdc++-v3/src/c++11/thread.cc +++ b/libstdc++-v3/src/c++11/thread.cc @@ -70,9 +70,9 @@ static inline int get_nprocs() namespace std _GLIBCXX_VISIBILITY(default) { - namespace + extern "C" { - extern "C" void* + static void* execute_native_thread_routine(void* __p) { thread::_Impl_base* __t = static_cast<thread::_Impl_base*>(__p); @@ -94,7 +94,7 @@ namespace std _GLIBCXX_VISIBILITY(default) return nullptr; } - } + } // extern "C" _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc index f8a7d78d4cf..39cc9b6ec7c 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc @@ -19,7 +19,7 @@ #undef _GLIBCXX_CONCEPT_CHECKS -#include <algorithm> +#include <memory> #include <iterator> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc index 853a71cc334..9628c19b022 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy_n/move_iterators/1.cc @@ -21,7 +21,7 @@ #undef _GLIBCXX_CONCEPT_CHECKS -#include <algorithm> +#include <memory> #include <iterator> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc b/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc new file mode 100644 index 00000000000..707b273c83e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/69478.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// PR libstdc++/69478 + +#include <algorithm> +#include <iterator> + +void +test01() +{ + // A move-only type that is also a trivial class. + struct trivial_rvalstruct + { + trivial_rvalstruct() = default; + trivial_rvalstruct(trivial_rvalstruct&&) = default; + trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default; + }; + static_assert(std::is_trivial<trivial_rvalstruct>::value, ""); + + trivial_rvalstruct a[1], b[1]; + copy(std::make_move_iterator(a), std::make_move_iterator(a + 1), b); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc new file mode 100644 index 00000000000..e00d146996f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/69478.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// PR libstdc++/69478 + +#include <algorithm> +#include <iterator> + +void +test01() +{ + // A move-only type that is also a trivial class. + struct trivial_rvalstruct + { + trivial_rvalstruct() = default; + trivial_rvalstruct(trivial_rvalstruct&&) = default; + trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default; + }; + static_assert(std::is_trivial<trivial_rvalstruct>::value, ""); + + trivial_rvalstruct a[1], b[1]; + copy_backward(std::make_move_iterator(a), std::make_move_iterator(a+1), b); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move/69478.cc b/libstdc++-v3/testsuite/25_algorithms/move/69478.cc new file mode 100644 index 00000000000..791e0bfcff6 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move/69478.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// PR libstdc++/69478 + +#include <algorithm> +#include <iterator> + +void +test01() +{ + // A move-only type that is also a trivial class. + struct trivial_rvalstruct + { + trivial_rvalstruct() = default; + trivial_rvalstruct(trivial_rvalstruct&&) = default; + trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default; + }; + static_assert(std::is_trivial<trivial_rvalstruct>::value, ""); + + trivial_rvalstruct a[1], b[1]; + std::move(a, a + 1, b); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc new file mode 100644 index 00000000000..8ca198fc2c1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/69478.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// PR libstdc++/69478 + +#include <algorithm> +#include <iterator> + +void +test01() +{ + // A move-only type that is also a trivial class. + struct trivial_rvalstruct + { + trivial_rvalstruct() = default; + trivial_rvalstruct(trivial_rvalstruct&&) = default; + trivial_rvalstruct& operator=(trivial_rvalstruct&&) = default; + }; + static_assert(std::is_trivial<trivial_rvalstruct>::value, ""); + + trivial_rvalstruct a[1], b[1]; + std::move_backward(a, a + 1, b); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc index e79d43869f0..faf1171f98d 100644 --- a/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc @@ -20,6 +20,7 @@ // { dg-options "-std=gnu++11" } #include <algorithm> +#include <vector> #include <testsuite_hooks.h> #include <testsuite_iterators.h> diff --git a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc index 11d553910c9..e9ebc684732 100644 --- a/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc +++ b/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc @@ -10,6 +10,6 @@ std::__detail::_Adaptor<std::mt19937, unsigned long> aurng(urng); auto x = std::generate_canonical<std::size_t, std::numeric_limits<std::size_t>::digits>(urng); -// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 167 } +// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 160 } -// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 3466 } +// { dg-error "static assertion failed: template argument not a floating point type" "" { target *-*-* } 3314 } diff --git a/libstdc++-v3/testsuite/30_threads/thread/70503.cc b/libstdc++-v3/testsuite/30_threads/thread/70503.cc new file mode 100644 index 00000000000..3b64ef8d2de --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/thread/70503.cc @@ -0,0 +1,38 @@ +// Copyright (C) 2016 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-do link } +// { dg-options "-std=gnu++11 -static" { target *-*-*gnu* } } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } +// { dg-require-effective-target static } + +#include <thread> + +extern "C" { + // Should not get multiple definition errors from libstdc++.a(thread.o) + void execute_native_thread_routine(void) { } + void execute_native_thread_routine_compat(void) { } +} + +int main() +{ + execute_native_thread_routine(); + execute_native_thread_routine_compat(); + + std::thread{}.detach(); // ensure libstdc++.a(thread.o) is linked in +} diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc index 0f9c2fbbcd9..374bbe5fba5 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/whatis.cc @@ -1,7 +1,7 @@ // { dg-do run } // { dg-options "-g -O0 -std=gnu++11" } -// Copyright (C) 2011-2015 Free Software Foundation, Inc. +// Copyright (C) 2011-2016 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,6 +33,7 @@ #include <set> #include <unordered_map> #include <unordered_set> +#include <random> template<class T> void |