aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2014-03-11 06:54:00 +0000
committerYvan Roux <yvan.roux@linaro.org>2014-03-11 06:54:00 +0000
commit1f51dbb07a00c4f5d62c6403e659e537f8cc4dc7 (patch)
tree3c215d827c63c4f0086979d77851da8fa27255c7
parent8ffde9f094a200eddbb2acec330640de1f8f8180 (diff)
parent7b8fa3abc5308d37d3e7f415baf1b5cad1ed8f36 (diff)
Merge from branches/gcc-4_8-branch up to rev 208264.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/linaro/gcc-4_8-branch@208471 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog248
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/builtins.c24
-rw-r--r--gcc/combine.c14
-rw-r--r--gcc/config.in6
-rw-r--r--gcc/config/arm/arm.h14
-rw-r--r--gcc/config/i386/driver-i386.c45
-rw-r--r--gcc/config/i386/i386.c109
-rw-r--r--gcc/config/i386/i386.md8
-rw-r--r--gcc/config/i386/sse.md4
-rw-r--r--gcc/config/microblaze/microblaze.c162
-rw-r--r--gcc/config/microblaze/microblaze.h9
-rw-r--r--gcc/config/microblaze/microblaze.md79
-rw-r--r--gcc/config/microblaze/predicates.md8
-rw-r--r--gcc/config/pa/pa.c20
-rw-r--r--gcc/config/pa/pa.h9
-rw-r--r--gcc/config/s390/s390.c5
-rwxr-xr-xgcc/configure37
-rw-r--r--gcc/configure.ac13
-rw-r--r--gcc/cp/ChangeLog64
-rw-r--r--gcc/cp/mangle.c1
-rw-r--r--gcc/cp/name-lookup.c20
-rw-r--r--gcc/cp/parser.c26
-rw-r--r--gcc/cp/pt.c59
-rw-r--r--gcc/cp/semantics.c5
-rw-r--r--gcc/cp/typeck.c5
-rw-r--r--gcc/doc/invoke.texi86
-rw-r--r--gcc/fortran/ChangeLog60
-rw-r--r--gcc/fortran/decl.c9
-rw-r--r--gcc/fortran/expr.c10
-rw-r--r--gcc/fortran/frontend-passes.c2
-rw-r--r--gcc/fortran/primary.c3
-rw-r--r--gcc/fortran/resolve.c23
-rw-r--r--gcc/fortran/trans-array.c5
-rw-r--r--gcc/fortran/trans-decl.c5
-rw-r--r--gcc/fortran/trans-expr.c8
-rw-r--r--gcc/fortran/trans-intrinsic.c4
-rw-r--r--gcc/ipa-cp.c4
-rw-r--r--gcc/ipa-prop.c3
-rw-r--r--gcc/testsuite/ChangeLog145
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted48.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/deleted3.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/enum_base2.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept22.C21
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic146.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic149.C11
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic150.C9
-rw-r--r--gcc/testsuite/g++.dg/ext/vector27.C7
-rw-r--r--gcc/testsuite/g++.dg/gomp/for-20.C16
-rw-r--r--gcc/testsuite/g++.dg/template/ref7.C16
-rw-r--r--gcc/testsuite/g++.dg/template/using27.C33
-rw-r--r--gcc/testsuite/g++.dg/template/using28.C17
-rw-r--r--gcc/testsuite/g++.dg/template/using29.C21
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20140212-1.c37
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr60017.c33
-rw-r--r--gcc/testsuite/gcc.dg/ipa/pr55260.c38
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr59903.c56
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr60115.c14
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr60183.c38
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr60276.c52
-rw-r--r--gcc/testsuite/gcc.target/i386/nest-1.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr39162.c3
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-1.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-2.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-3.c15
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-4.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-5.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-6.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr59794-7.c13
-rw-r--r--gcc/testsuite/gcc.target/i386/sse-5.c3
-rw-r--r--gcc/testsuite/gcc.target/microblaze/others/mem_reload.c74
-rw-r--r--gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c23
-rw-r--r--gcc/testsuite/gfortran.dg/default_initialization_7.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/elemental_subroutine_9.f9039
-rw-r--r--gcc/testsuite/gfortran.dg/fmt_g_1.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/ichar_3.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/init_flag_12.f9013
-rw-r--r--gcc/testsuite/gfortran.dg/pr59700.f9040
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_45.f9024
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_46.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/round_3.f0841
-rw-r--r--gcc/testsuite/gfortran.dg/str_comp_optimize_1.f9022
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_generic_15.f9018
-rw-r--r--gcc/testsuite/gnat.dg/opt32.adb37
-rw-r--r--gcc/tree-cfg.c10
-rw-r--r--gcc/tree-eh.c41
-rw-r--r--gcc/tree-ssa-live.c3
-rw-r--r--gcc/tree-ssa-phiprop.c9
-rw-r--r--gcc/tree-vect-data-refs.c7
-rw-r--r--gcc/tree-vect-loop.c5
-rw-r--r--gcc/tree-vect-stmts.c28
-rw-r--r--gcc/tree-vectorizer.h5
-rw-r--r--libatomic/ChangeLog6
-rw-r--r--libatomic/cas_n.c25
-rw-r--r--libbacktrace/ChangeLog7
-rw-r--r--libbacktrace/Makefile.in2
-rwxr-xr-xlibbacktrace/configure5
-rw-r--r--libbacktrace/configure.ac2
-rw-r--r--libgcc/ChangeLog17
-rw-r--r--libgcc/config/arm/sfp-machine.h10
-rw-r--r--libgcc/unwind-seh.c5
-rw-r--r--libgfortran/ChangeLog27
-rw-r--r--libgfortran/io/io.h10
-rw-r--r--libgfortran/io/list_read.c41
-rw-r--r--libgfortran/io/write_float.def24
107 files changed, 2292 insertions, 366 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af97b9cca80..de0ee76b0cb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,251 @@
+2014-02-25 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-02-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60276
+ * tree-vectorizer.h (struct _stmt_vec_info): Add min_neg_dist field.
+ (STMT_VINFO_MIN_NEG_DIST): New macro.
+ * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Record
+ STMT_VINFO_MIN_NEG_DIST.
+ * tree-vect-stmts.c (vectorizable_load): Verify if assumptions
+ made for negative dependence distances still hold.
+
+2014-02-25 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-02-21 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/60291
+ * tree-ssa-live.c (mark_all_vars_used_1): Do not walk
+ DECL_INITIAL for globals not in the current function context.
+
+ 2014-02-20 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/60221
+ * tree-eh.c (execute_cleanup_eh_1): Also cleanup empty EH
+ regions at -O0.
+
+ 2014-02-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60183
+ * tree-ssa-phiprop.c (propagate_with_phi): Avoid speculating
+ loads.
+ (tree_ssa_phiprop): Calculate and free post-dominators.
+
+2014-02-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/55426
+ * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Allow 128 to 64-bit
+ conversions.
+
+2014-02-24 John David Anglin <danglin@gcc.gnu.org>
+
+ * config/pa/pa.c (pa_output_move_double): Don't valididate when
+ adjusting offsetable addresses.
+
+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * config/microblaze/microblaze.md: Correct ashrsi_reg / lshrsi_reg names
+
+2014-02-23 Edgar E. Iglesias <edgar.iglesias@xilinx.com>
+
+ * config/microblaze/microblaze.h: Remove SECONDARY_MEMORY_NEEDED
+ definition.
+
+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * /config/microblaze/microblaze.c: Add microblaze_asm_output_mi_thunk
+ and define TARGET_ASM_OUTPUT_MI_THUNK and
+ TARGET_ASM_CAN_OUTPUT_MI_THUNK.
+
+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * config/microblaze/predicates.md: Add cmp_op predicate.
+ * config/microblaze/microblaze.md: Add branch_compare instruction
+ which uses cmp_op predicate and emits cmp insn before branch.
+ * config/microblaze/microblaze.c (microblaze_emit_compare): Rename
+ to microblaze_expand_conditional_branch and consolidate logic.
+ (microblaze_expand_conditional_branch): emit branch_compare
+ insn instead of handling cmp op separate from branch insn.
+
+2014-02-21 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/55260
+ * ipa-cp.c (cgraph_edge_brings_all_agg_vals_for_node): Uce correct
+ info when checking whether lattices are bottom.
+
+2014-02-21 Jakub Jelinek <jakub@redhat.com>
+
+ * config/i386/i386.c (ix86_expand_vec_perm): Use V8SImode
+ mode for mask of V8SFmode permutation.
+
+2014-02-20 Richard Henderson <rth@redhat.com>
+
+ PR c++/60272
+ * builtins.c (expand_builtin_atomic_compare_exchange): Conditionalize
+ on failure the store back into EXPECT. Always make a new pseudo for
+ OLDVAL.
+
+2014-02-20 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/57896
+ * config/i386/i386.c (expand_vec_perm_interleave2): Don't call
+ gen_reg_rtx if d->testing_p.
+ (expand_vec_perm_pshufb2, expand_vec_perm_even_odd_1,
+ expand_vec_perm_broadcast_1): Return early if d->testing_p and
+ we will certainly return true.
+
+2014-02-20 Richard Biener <rguenther@suse.de>
+
+ * tree-cfg.c (replace_uses_by): Mark altered BBs before
+ doing the substitution.
+
+2014-02-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2014-02-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/60207
+ * config/i386/i386.c (construct_container): Remove TFmode check
+ for X86_64_INTEGER_CLASS.
+
+2014-02-19 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2014-02-19 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/59794
+ * config/i386/i386.c (type_natural_mode): Warn for ABI changes
+ only when -Wpsabi is enabled.
+
+2014-02-19 Terry Guo <terry.guo@arm.com>
+
+ Backport from mainline
+ 2014-02-08 Terry Guo <terry.guo@arm.com>
+
+ * doc/invoke.texi: Document ARM -march=armv7e-m.
+
+2014-02-18 Kai Tietz <ktietz@redhat.com>
+
+ Backport from mainline
+ 2014-02-18 Kai Tietz <ktietz@redhat.com>
+
+ PR target/60193
+ * config/i386/i386.c (ix86_expand_prologue): Use
+ rax register as displacement for restoring %r10, %rax.
+ Additional fix wrong offset for restoring both-registers.
+
+2014-02-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * ipa-prop.c (compute_complex_ancestor_jump_func): Replace overzealous
+ assertion with conditional return.
+
+2014-02-18 Jakub Jelinek <jakub@redhat.com>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ PR driver/60233
+ * config/i386/driver-i386.c (host_detect_local_cpu): If
+ YMM state is not saved by the OS, also clear has_f16c. Move
+ CPUID 0x80000001 handling before YMM state saving checking.
+
+2014-02-14 Roland McGrath <mcgrathr@google.com>
+
+ * configure.ac (HAVE_AS_IX86_UD2): New test for 'ud2' mnemonic.
+ * configure: Regenerated.
+ * config.in: Regenerated.
+ * config/i386/i386.md (trap) [HAVE_AS_IX86_UD2]: Use the mnemonic
+ instead of ASM_SHORT.
+
+2014-02-13 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2014-02-13 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/sse.md (xop_vmfrcz<mode>2): Generate const0 in
+ operands[2], not operands[3].
+
+2014-02-13 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * config/s390/s390.c (s390_asm_output_function_label): Fix crash
+ caused by bad second argument to warning_at() with -mhotpatch and
+ nested functions (e.g. with gfortran).
+
+2014-02-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backport from mainline
+ 2014-02-12 H.J. Lu <hongjiu.lu@intel.com>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/60151
+ * configure.ac (HAVE_AS_GOTOFF_IN_DATA): Pass --32 to GNU assembler.
+
+2014-02-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR rtl-optimization/60116
+ * combine.c (try_combine): Also remove dangling REG_DEAD notes on the
+ other_insn once the combination has been validated.
+
+2014-02-10 Nagaraju Mekala <nagaraju.mekala@xilinx.com>
+
+ * config/microblaze/microblaze.md: Add movsi4_rev insn pattern.
+ * config/microblaze/predicates.md: Add reg_or_mem_operand predicate.
+
+2014-02-10 Nagaraju Mekala <nagaraju.mekala@xilinx.com>
+
+ * config/microblaze/microblaze.c: Extend mcpu version format
+
+2014-02-10 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * config/microblaze/microblaze.h: Define SIZE_TYPE and PTRDIFF_TYPE.
+
+2014-02-10 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-01-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/59903
+ * tree-vect-loop.c (vect_transform_loop): Guard multiple-types
+ check properly.
+
+ 2014-02-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60115
+ * tree-eh.c (tree_could_trap_p): Unify TARGET_MEM_REF and
+ MEM_REF handling. Properly verify that the accesses are not
+ out of the objects bound.
+
+2014-02-05 James Greenhalgh <james.greenhalgh@arm.com>
+
+ Backport from mainline.
+ 2014-02-05 James Greenhalgh <james.greenhalgh@arm.com>
+
+ PR target/59718
+ * doc/invoke.texi (-march): Clarify documentation for ARM.
+ (-mtune): Likewise.
+ (-mcpu): Likewise.
+
+2014-02-04 John David Anglin <danglin@gcc.gnu.org>
+
+ PR target/59777
+ * config/pa/pa.c (legitimize_tls_address): Return original address
+ if not passed a SYMBOL_REF rtx.
+ (hppa_legitimize_address): Call legitimize_tls_address for all TLS
+ addresses.
+ (pa_emit_move_sequence): Simplify TLS source operands.
+ (pa_legitimate_constant_p): Reject all TLS constants.
+ * config/pa/pa.h (PA_SYMBOL_REF_TLS_P): Correct comment.
+ (CONSTANT_ADDRESS_P): Reject TLS CONST addresses.
+
+2014-02-04 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2014-02-02 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/60017
+ * config/i386/i386.c (classify_argument): Fix handling of bit_offset
+ when calculating size of integer atomic types.
+
2014-02-02 Uros Bizjak <ubizjak@gmail.com>
Backport from mainline
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 6b7c04d7d87..ddfa5824047 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20140203
+20140303
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 1be69686bee..1df41f87885 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -5350,7 +5350,7 @@ static rtx
expand_builtin_atomic_compare_exchange (enum machine_mode mode, tree exp,
rtx target)
{
- rtx expect, desired, mem, oldval;
+ rtx expect, desired, mem, oldval, label;
enum memmodel success, failure;
tree weak;
bool is_weak;
@@ -5388,14 +5388,26 @@ expand_builtin_atomic_compare_exchange (enum machine_mode mode, tree exp,
if (host_integerp (weak, 0) && tree_low_cst (weak, 0) != 0)
is_weak = true;
- oldval = expect;
- if (!expand_atomic_compare_and_swap ((target == const0_rtx ? NULL : &target),
- &oldval, mem, oldval, desired,
+ if (target == const0_rtx)
+ target = NULL;
+
+ /* Lest the rtl backend create a race condition with an imporoper store
+ to memory, always create a new pseudo for OLDVAL. */
+ oldval = NULL;
+
+ if (!expand_atomic_compare_and_swap (&target, &oldval, mem, expect, desired,
is_weak, success, failure))
return NULL_RTX;
- if (oldval != expect)
- emit_move_insn (expect, oldval);
+ /* Conditionally store back to EXPECT, lest we create a race condition
+ with an improper store to memory. */
+ /* ??? With a rearrangement of atomics at the gimple level, we can handle
+ the normal case where EXPECT is totally private, i.e. a register. At
+ which point the store can be unconditional. */
+ label = gen_label_rtx ();
+ emit_cmp_and_jump_insns (target, const0_rtx, NE, NULL, VOIDmode, 1, label);
+ emit_move_insn (expect, oldval);
+ emit_label (label);
return target;
}
diff --git a/gcc/combine.c b/gcc/combine.c
index 659288b56bc..a0e881fb2d6 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3884,15 +3884,19 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p,
PATTERN (undobuf.other_insn) = other_pat;
- /* If any of the notes in OTHER_INSN were REG_UNUSED, ensure that they
- are still valid. Then add any non-duplicate notes added by
- recog_for_combine. */
+ /* If any of the notes in OTHER_INSN were REG_DEAD or REG_UNUSED,
+ ensure that they are still valid. Then add any non-duplicate
+ notes added by recog_for_combine. */
for (note = REG_NOTES (undobuf.other_insn); note; note = next)
{
next = XEXP (note, 1);
- if (REG_NOTE_KIND (note) == REG_UNUSED
- && ! reg_set_p (XEXP (note, 0), PATTERN (undobuf.other_insn)))
+ if ((REG_NOTE_KIND (note) == REG_DEAD
+ && !reg_referenced_p (XEXP (note, 0),
+ PATTERN (undobuf.other_insn)))
+ ||(REG_NOTE_KIND (note) == REG_UNUSED
+ && !reg_set_p (XEXP (note, 0),
+ PATTERN (undobuf.other_insn))))
remove_note (undobuf.other_insn, note);
}
diff --git a/gcc/config.in b/gcc/config.in
index 42140c30505..27497d4194b 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -363,6 +363,12 @@
#endif
+/* Define if your assembler supports the 'ud2' mnemonic. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_IX86_UD2
+#endif
+
+
/* Define if your assembler supports the lituse_jsrdirect relocation. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_JSRDIRECT_RELOCS
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index aeb95481c51..496164af3e4 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1244,11 +1244,15 @@ enum reg_class
VFPv2.
In big-endian mode, modes greater than word size (i.e. DFmode) are stored in
VFP registers in little-endian order. We can't describe that accurately to
- GCC, so avoid taking subregs of such values. */
-#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
- (TARGET_VFP && TARGET_BIG_END \
- && (GET_MODE_SIZE (FROM) > UNITS_PER_WORD \
- || GET_MODE_SIZE (TO) > UNITS_PER_WORD) \
+ GCC, so avoid taking subregs of such values.
+ The only exception is going from a 128-bit to a 64-bit type. In that case
+ the data layout happens to be consistent for big-endian, so we explicitly allow
+ that case. */
+#define CANNOT_CHANGE_MODE_CLASS(FROM, TO, CLASS) \
+ (TARGET_VFP && TARGET_BIG_END \
+ && !(GET_MODE_SIZE (FROM) == 16 && GET_MODE_SIZE (TO) == 8) \
+ && (GET_MODE_SIZE (FROM) > UNITS_PER_WORD \
+ || GET_MODE_SIZE (TO) > UNITS_PER_WORD) \
&& reg_classes_intersect_p (VFP_REGS, (CLASS)))
/* The class value for index registers, and the one for base regs. */
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 70ad5c9ac3a..148fbc227c1 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -488,6 +488,28 @@ const char *host_detect_local_cpu (int argc, const char **argv)
has_xsaveopt = eax & bit_XSAVEOPT;
}
+ /* Check cpuid level of extended features. */
+ __cpuid (0x80000000, ext_level, ebx, ecx, edx);
+
+ if (ext_level > 0x80000000)
+ {
+ __cpuid (0x80000001, eax, ebx, ecx, edx);
+
+ has_lahf_lm = ecx & bit_LAHF_LM;
+ has_sse4a = ecx & bit_SSE4a;
+ has_abm = ecx & bit_ABM;
+ has_lwp = ecx & bit_LWP;
+ has_fma4 = ecx & bit_FMA4;
+ has_xop = ecx & bit_XOP;
+ has_tbm = ecx & bit_TBM;
+ has_lzcnt = ecx & bit_LZCNT;
+ has_prfchw = ecx & bit_PRFCHW;
+
+ has_longmode = edx & bit_LM;
+ has_3dnowp = edx & bit_3DNOWP;
+ has_3dnow = edx & bit_3DNOW;
+ }
+
/* Get XCR_XFEATURE_ENABLED_MASK register with xgetbv. */
#define XCR_XFEATURE_ENABLED_MASK 0x0
#define XSTATE_FP 0x1
@@ -506,33 +528,12 @@ const char *host_detect_local_cpu (int argc, const char **argv)
has_avx2 = 0;
has_fma = 0;
has_fma4 = 0;
+ has_f16c = 0;
has_xop = 0;
has_xsave = 0;
has_xsaveopt = 0;
}
- /* Check cpuid level of extended features. */
- __cpuid (0x80000000, ext_level, ebx, ecx, edx);
-
- if (ext_level > 0x80000000)
- {
- __cpuid (0x80000001, eax, ebx, ecx, edx);
-
- has_lahf_lm = ecx & bit_LAHF_LM;
- has_sse4a = ecx & bit_SSE4a;
- has_abm = ecx & bit_ABM;
- has_lwp = ecx & bit_LWP;
- has_fma4 = ecx & bit_FMA4;
- has_xop = ecx & bit_XOP;
- has_tbm = ecx & bit_TBM;
- has_lzcnt = ecx & bit_LZCNT;
- has_prfchw = ecx & bit_PRFCHW;
-
- has_longmode = edx & bit_LM;
- has_3dnowp = edx & bit_3DNOWP;
- has_3dnow = edx & bit_3DNOW;
- }
-
if (!arch)
{
if (vendor == signature_AMD_ebx
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index c56ce3e9862..77c3781bf89 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5721,9 +5721,9 @@ init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
cum->nregs = 0;
cum->sse_nregs = 0;
cum->mmx_nregs = 0;
- cum->warn_avx = 0;
- cum->warn_sse = 0;
- cum->warn_mmx = 0;
+ cum->warn_avx = false;
+ cum->warn_sse = false;
+ cum->warn_mmx = false;
return;
}
@@ -5799,19 +5799,17 @@ type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum,
static bool warnedavx;
static bool warnedavx_ret;
- if (cum
- && !warnedavx
- && cum->warn_avx)
+ if (cum && cum->warn_avx && !warnedavx)
{
- warnedavx = true;
- warning (0, "AVX vector argument without AVX "
- "enabled changes the ABI");
+ if (warning (OPT_Wpsabi, "AVX vector argument "
+ "without AVX enabled changes the ABI"))
+ warnedavx = true;
}
- else if (in_return & !warnedavx_ret)
+ else if (in_return && !warnedavx_ret)
{
- warnedavx_ret = true;
- warning (0, "AVX vector return without AVX "
- "enabled changes the ABI");
+ if (warning (OPT_Wpsabi, "AVX vector return "
+ "without AVX enabled changes the ABI"))
+ warnedavx_ret = true;
}
return TYPE_MODE (type);
@@ -5822,21 +5820,17 @@ type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum,
static bool warnedsse;
static bool warnedsse_ret;
- if (cum
- && !warnedsse
- && cum->warn_sse)
+ if (cum && cum->warn_sse && !warnedsse)
{
- warnedsse = true;
- warning (0, "SSE vector argument without SSE "
- "enabled changes the ABI");
+ if (warning (OPT_Wpsabi, "SSE vector argument "
+ "without SSE enabled changes the ABI"))
+ warnedsse = true;
}
- else if (!TARGET_64BIT
- && in_return
- & !warnedsse_ret)
+ else if (!TARGET_64BIT && in_return && !warnedsse_ret)
{
- warnedsse_ret = true;
- warning (0, "SSE vector return without SSE "
- "enabled changes the ABI");
+ if (warning (OPT_Wpsabi, "SSE vector return "
+ "without SSE enabled changes the ABI"))
+ warnedsse_ret = true;
}
}
else if ((size == 8 && !TARGET_64BIT) && !TARGET_MMX)
@@ -5844,19 +5838,17 @@ type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum,
static bool warnedmmx;
static bool warnedmmx_ret;
- if (cum
- && !warnedmmx
- && cum->warn_mmx)
+ if (cum && cum->warn_mmx && !warnedmmx)
{
- warnedmmx = true;
- warning (0, "MMX vector argument without MMX "
- "enabled changes the ABI");
+ if (warning (OPT_Wpsabi, "MMX vector argument "
+ "without MMX enabled changes the ABI"))
+ warnedmmx = true;
}
- else if (in_return & !warnedmmx_ret)
+ else if (in_return && !warnedmmx_ret)
{
- warnedmmx_ret = true;
- warning (0, "MMX vector return without MMX "
- "enabled changes the ABI");
+ if (warning (OPT_Wpsabi, "MMX vector return "
+ "without MMX enabled changes the ABI"))
+ warnedmmx_ret = true;
}
}
return mode;
@@ -6204,25 +6196,28 @@ classify_argument (enum machine_mode mode, const_tree type,
case CHImode:
case CQImode:
{
- int size = (bit_offset % 64)+ (int) GET_MODE_BITSIZE (mode);
+ int size = bit_offset + (int) GET_MODE_BITSIZE (mode);
- if (size <= 32)
+ /* Analyze last 128 bits only. */
+ size = (size - 1) & 0x7f;
+
+ if (size < 32)
{
classes[0] = X86_64_INTEGERSI_CLASS;
return 1;
}
- else if (size <= 64)
+ else if (size < 64)
{
classes[0] = X86_64_INTEGER_CLASS;
return 1;
}
- else if (size <= 64+32)
+ else if (size < 64+32)
{
classes[0] = X86_64_INTEGER_CLASS;
classes[1] = X86_64_INTEGERSI_CLASS;
return 2;
}
- else if (size <= 64+64)
+ else if (size < 64+64)
{
classes[0] = classes[1] = X86_64_INTEGER_CLASS;
return 2;
@@ -6489,7 +6484,7 @@ construct_container (enum machine_mode mode, enum machine_mode orig_mode,
if (n == 2
&& regclass[0] == X86_64_INTEGER_CLASS
&& regclass[1] == X86_64_INTEGER_CLASS
- && (mode == CDImode || mode == TImode || mode == TFmode)
+ && (mode == CDImode || mode == TImode)
&& intreg[0] + 1 == intreg[1])
return gen_rtx_REG (mode, intreg[0]);
@@ -10526,17 +10521,16 @@ ix86_expand_prologue (void)
works for realigned stack, too. */
if (r10_live && eax_live)
{
- t = plus_constant (Pmode, stack_pointer_rtx, allocate);
+ t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, eax);
emit_move_insn (gen_rtx_REG (word_mode, R10_REG),
gen_frame_mem (word_mode, t));
- t = plus_constant (Pmode, stack_pointer_rtx,
- allocate - UNITS_PER_WORD);
+ t = plus_constant (Pmode, t, UNITS_PER_WORD);
emit_move_insn (gen_rtx_REG (word_mode, AX_REG),
gen_frame_mem (word_mode, t));
}
else if (eax_live || r10_live)
{
- t = plus_constant (Pmode, stack_pointer_rtx, allocate);
+ t = gen_rtx_PLUS (Pmode, stack_pointer_rtx, eax);
emit_move_insn (gen_rtx_REG (word_mode,
(eax_live ? AX_REG : R10_REG)),
gen_frame_mem (word_mode, t));
@@ -20466,7 +20460,7 @@ ix86_expand_vec_perm (rtx operands[])
return;
case V8SFmode:
- mask = gen_lowpart (V8SFmode, mask);
+ mask = gen_lowpart (V8SImode, mask);
if (one_operand_shuffle)
emit_insn (gen_avx2_permvarv8sf (target, op0, mask));
else
@@ -39411,7 +39405,9 @@ expand_vec_perm_interleave2 (struct expand_vec_perm_d *d)
else
dfinal.perm[i] = e;
}
- dfinal.op0 = gen_reg_rtx (dfinal.vmode);
+
+ if (!d->testing_p)
+ dfinal.op0 = gen_reg_rtx (dfinal.vmode);
dfinal.op1 = dfinal.op0;
dfinal.one_operand_p = true;
dremap.target = dfinal.op0;
@@ -39846,6 +39842,9 @@ expand_vec_perm_pshufb2 (struct expand_vec_perm_d *d)
return false;
gcc_assert (!d->one_operand_p);
+ if (d->testing_p)
+ return true;
+
nelt = d->nelt;
eltsz = GET_MODE_SIZE (GET_MODE_INNER (d->vmode));
@@ -40045,6 +40044,8 @@ expand_vec_perm_even_odd_1 (struct expand_vec_perm_d *d, unsigned odd)
switch (d->vmode)
{
case V4DFmode:
+ if (d->testing_p)
+ break;
t1 = gen_reg_rtx (V4DFmode);
t2 = gen_reg_rtx (V4DFmode);
@@ -40064,6 +40065,8 @@ expand_vec_perm_even_odd_1 (struct expand_vec_perm_d *d, unsigned odd)
{
int mask = odd ? 0xdd : 0x88;
+ if (d->testing_p)
+ break;
t1 = gen_reg_rtx (V8SFmode);
t2 = gen_reg_rtx (V8SFmode);
t3 = gen_reg_rtx (V8SFmode);
@@ -40105,6 +40108,8 @@ expand_vec_perm_even_odd_1 (struct expand_vec_perm_d *d, unsigned odd)
return expand_vec_perm_pshufb2 (d);
else
{
+ if (d->testing_p)
+ break;
/* We need 2*log2(N)-1 operations to achieve odd/even
with interleave. */
t1 = gen_reg_rtx (V8HImode);
@@ -40126,6 +40131,8 @@ expand_vec_perm_even_odd_1 (struct expand_vec_perm_d *d, unsigned odd)
return expand_vec_perm_pshufb2 (d);
else
{
+ if (d->testing_p)
+ break;
t1 = gen_reg_rtx (V16QImode);
t2 = gen_reg_rtx (V16QImode);
t3 = gen_reg_rtx (V16QImode);
@@ -40158,6 +40165,9 @@ expand_vec_perm_even_odd_1 (struct expand_vec_perm_d *d, unsigned odd)
return expand_vec_perm_even_odd_1 (&d_copy, odd);
}
+ if (d->testing_p)
+ break;
+
t1 = gen_reg_rtx (V4DImode);
t2 = gen_reg_rtx (V4DImode);
@@ -40184,6 +40194,9 @@ expand_vec_perm_even_odd_1 (struct expand_vec_perm_d *d, unsigned odd)
return expand_vec_perm_even_odd_1 (&d_copy, odd);
}
+ if (d->testing_p)
+ break;
+
t1 = gen_reg_rtx (V8SImode);
t2 = gen_reg_rtx (V8SImode);
@@ -40276,6 +40289,8 @@ expand_vec_perm_broadcast_1 (struct expand_vec_perm_d *d)
case V16QImode:
/* These can be implemented via interleave. We save one insn by
stopping once we have promoted to V4SImode and then use pshufd. */
+ if (d->testing_p)
+ return true;
do
{
rtx dest;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 5f1921c106c..891d4d4f3ed 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -17594,7 +17594,13 @@
(define_insn "trap"
[(trap_if (const_int 1) (const_int 6))]
""
- { return ASM_SHORT "0x0b0f"; }
+{
+#ifdef HAVE_AS_IX86_UD2
+ return "ud2";
+#else
+ return ASM_SHORT "0x0b0f";
+#endif
+}
[(set_attr "length" "2")])
(define_expand "prefetch"
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 565163704e1..cba540107c5 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -10254,10 +10254,10 @@
(unspec:VF_128
[(match_operand:VF_128 1 "nonimmediate_operand")]
UNSPEC_FRCZ)
- (match_dup 3)
+ (match_dup 2)
(const_int 1)))]
"TARGET_XOP"
- "operands[3] = CONST0_RTX (<MODE>mode);")
+ "operands[2] = CONST0_RTX (<MODE>mode);")
(define_insn "*xop_vmfrcz<mode>2"
[(set (match_operand:VF_128 0 "register_operand" "=x")
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index c121c2baec3..89793b05fe5 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -1609,21 +1609,28 @@ static int
microblaze_version_to_int (const char *version)
{
const char *p, *v;
- const char *tmpl = "vX.YY.Z";
+ const char *tmpl = "vXX.YY.Z";
int iver = 0;
p = version;
v = tmpl;
- while (*v)
+ while (*p)
{
if (*v == 'X')
{ /* Looking for major */
- if (!(*p >= '0' && *p <= '9'))
- return -1;
- iver += (int) (*p - '0');
- iver *= 10;
- }
+ if (*p == '.')
+ {
+ *v++;
+ }
+ else
+ {
+ if (!(*p >= '0' && *p <= '9'))
+ return -1;
+ iver += (int) (*p - '0');
+ iver *= 10;
+ }
+ }
else if (*v == 'Y')
{ /* Looking for minor */
if (!(*p >= '0' && *p <= '9'))
@@ -3064,6 +3071,73 @@ expand_pic_symbol_ref (enum machine_mode mode ATTRIBUTE_UNUSED, rtx op)
return result;
}
+static void
+microblaze_asm_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,
+ HOST_WIDE_INT delta, HOST_WIDE_INT vcall_offset,
+ tree function)
+{
+ rtx this_rtx, insn, funexp;
+
+ reload_completed = 1;
+ epilogue_completed = 1;
+
+ /* Mark the end of the (empty) prologue. */
+ emit_note (NOTE_INSN_PROLOGUE_END);
+
+ /* Find the "this" pointer. If the function returns a structure,
+ the structure return pointer is in MB_ABI_FIRST_ARG_REGNUM. */
+ if (aggregate_value_p (TREE_TYPE (TREE_TYPE (function)), function))
+ this_rtx = gen_rtx_REG (Pmode, (MB_ABI_FIRST_ARG_REGNUM + 1));
+ else
+ this_rtx = gen_rtx_REG (Pmode, MB_ABI_FIRST_ARG_REGNUM);
+
+ /* Apply the constant offset, if required. */
+ if (delta)
+ emit_insn (gen_addsi3 (this_rtx, this_rtx, GEN_INT (delta)));
+
+ /* Apply the offset from the vtable, if required. */
+ if (vcall_offset)
+ {
+ rtx vcall_offset_rtx = GEN_INT (vcall_offset);
+ rtx temp1 = gen_rtx_REG (Pmode, MB_ABI_TEMP1_REGNUM);
+
+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, this_rtx));
+
+ rtx loc = gen_rtx_PLUS (Pmode, temp1, vcall_offset_rtx);
+ emit_move_insn (temp1, gen_rtx_MEM (Pmode, loc));
+
+ emit_insn (gen_addsi3 (this_rtx, this_rtx, temp1));
+ }
+
+ /* Generate a tail call to the target function. */
+ if (!TREE_USED (function))
+ {
+ assemble_external (function);
+ TREE_USED (function) = 1;
+ }
+
+ funexp = XEXP (DECL_RTL (function), 0);
+ rtx temp2 = gen_rtx_REG (Pmode, MB_ABI_TEMP2_REGNUM);
+
+ if (flag_pic)
+ emit_move_insn (temp2, expand_pic_symbol_ref (Pmode, funexp));
+ else
+ emit_move_insn (temp2, funexp);
+
+ emit_insn (gen_indirect_jump (temp2));
+
+ /* Run just enough of rest_of_compilation. This sequence was
+ "borrowed" from rs6000.c. */
+ insn = get_insns ();
+ shorten_branches (insn);
+ final_start_function (insn, file, 1);
+ final (insn, file, 1);
+ final_end_function ();
+
+ reload_completed = 0;
+ epilogue_completed = 0;
+}
+
bool
microblaze_expand_move (enum machine_mode mode, rtx operands[])
{
@@ -3234,65 +3308,45 @@ microblaze_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
emit_move_insn (mem, fnaddr);
}
-/* Emit instruction to perform compare.
- cmp is (compare_op op0 op1). */
-static rtx
-microblaze_emit_compare (enum machine_mode mode, rtx cmp, enum rtx_code *cmp_code)
+/* Generate conditional branch -- first, generate test condition,
+ second, generate correct branch instruction. */
+
+void
+microblaze_expand_conditional_branch (enum machine_mode mode, rtx operands[])
{
- rtx cmp_op0 = XEXP (cmp, 0);
- rtx cmp_op1 = XEXP (cmp, 1);
+ enum rtx_code code = GET_CODE (operands[0]);
+ rtx cmp_op0 = operands[1];
+ rtx cmp_op1 = operands[2];
+ rtx label1 = operands[3];
rtx comp_reg = gen_reg_rtx (SImode);
- enum rtx_code code = *cmp_code;
-
+ rtx condition;
+
gcc_assert ((GET_CODE (cmp_op0) == REG) || (GET_CODE (cmp_op0) == SUBREG));
/* If comparing against zero, just test source reg. */
- if (cmp_op1 == const0_rtx)
- return cmp_op0;
+ if (cmp_op1 == const0_rtx)
+ {
+ comp_reg = cmp_op0;
+ condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx);
+ emit_jump_insn (gen_condjump (condition, label1));
+ }
- if (code == EQ || code == NE)
+ else if (code == EQ || code == NE)
{
/* Use xor for equal/not-equal comparison. */
emit_insn (gen_xorsi3 (comp_reg, cmp_op0, cmp_op1));
+ condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp_reg, const0_rtx);
+ emit_jump_insn (gen_condjump (condition, label1));
}
- else if (code == GT || code == GTU || code == LE || code == LEU)
- {
- /* MicroBlaze compare is not symmetrical. */
- /* Swap argument order. */
- cmp_op1 = force_reg (mode, cmp_op1);
- if (code == GT || code == LE)
- emit_insn (gen_signed_compare (comp_reg, cmp_op0, cmp_op1));
- else
- emit_insn (gen_unsigned_compare (comp_reg, cmp_op0, cmp_op1));
- /* Translate test condition. */
- *cmp_code = swap_condition (code);
- }
- else /* if (code == GE || code == GEU || code == LT || code == LTU) */
+ else
{
+ /* Generate compare and branch in single instruction. */
cmp_op1 = force_reg (mode, cmp_op1);
- if (code == GE || code == LT)
- emit_insn (gen_signed_compare (comp_reg, cmp_op1, cmp_op0));
- else
- emit_insn (gen_unsigned_compare (comp_reg, cmp_op1, cmp_op0));
+ condition = gen_rtx_fmt_ee (code, mode, cmp_op0, cmp_op1);
+ emit_jump_insn (gen_branch_compare(condition, cmp_op0, cmp_op1, label1));
}
-
- return comp_reg;
}
-/* Generate conditional branch -- first, generate test condition,
- second, generate correct branch instruction. */
-
-void
-microblaze_expand_conditional_branch (enum machine_mode mode, rtx operands[])
-{
- enum rtx_code code = GET_CODE (operands[0]);
- rtx comp;
- rtx condition;
-
- comp = microblaze_emit_compare (mode, operands[0], &code);
- condition = gen_rtx_fmt_ee (signed_condition (code), SImode, comp, const0_rtx);
- emit_jump_insn (gen_condjump (condition, operands[3]));
-}
void
microblaze_expand_conditional_branch_sf (rtx operands[])
@@ -3501,6 +3555,12 @@ microblaze_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x
#undef TARGET_SECONDARY_RELOAD
#define TARGET_SECONDARY_RELOAD microblaze_secondary_reload
+#undef TARGET_ASM_OUTPUT_MI_THUNK
+#define TARGET_ASM_OUTPUT_MI_THUNK microblaze_asm_output_mi_thunk
+
+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK hook_bool_const_tree_hwi_hwi_const_tree_true
+
#undef TARGET_SCHED_ADJUST_COST
#define TARGET_SCHED_ADJUST_COST microblaze_adjust_cost
diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h
index bc4d9a128d1..34c87c980ac 100644
--- a/gcc/config/microblaze/microblaze.h
+++ b/gcc/config/microblaze/microblaze.h
@@ -213,6 +213,12 @@ extern enum pipeline_type microblaze_pipe;
#define STRICT_ALIGNMENT 1
#define PCC_BITFIELD_TYPE_MATTERS 1
+#undef SIZE_TYPE
+#define SIZE_TYPE "unsigned int"
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE "int"
+
#define CONSTANT_ALIGNMENT(EXP, ALIGN) \
((TREE_CODE (EXP) == STRING_CST || TREE_CODE (EXP) == CONSTRUCTOR) \
&& (ALIGN) < BITS_PER_WORD \
@@ -407,9 +413,6 @@ extern enum reg_class microblaze_regno_to_class[];
|| GET_MODE (X) == VOIDmode) \
? (GR_REGS) : (CLASS))))
-#define SECONDARY_MEMORY_NEEDED(CLASS1, CLASS2, MODE) \
- (GET_MODE_CLASS (MODE) == MODE_INT)
-
/* Stack layout; function entry, exit and calling. */
#define STACK_GROWS_DOWNWARD
diff --git a/gcc/config/microblaze/microblaze.md b/gcc/config/microblaze/microblaze.md
index 25f074876aa..f1913b3c1db 100644
--- a/gcc/config/microblaze/microblaze.md
+++ b/gcc/config/microblaze/microblaze.md
@@ -1119,6 +1119,18 @@
}
)
+;;Load and store reverse
+(define_insn "movsi4_rev"
+ [(set (match_operand:SI 0 "reg_or_mem_operand" "=r,Q")
+ (bswap:SI (match_operand:SF 1 "reg_or_mem_operand" "Q,r")))]
+ "TARGET_REORDER"
+ "@
+ lwr\t%0,%y1,r0
+ swr\t%1,%y0,r0"
+ [(set_attr "type" "load,store")
+ (set_attr "mode" "SI")
+ (set_attr "length" "4,4")])
+
;; 32-bit floating point moves
(define_expand "movsf"
@@ -1473,7 +1485,7 @@
(set_attr "length" "124")]
)
-(define_insn "*ashlri_reg"
+(define_insn "*ashrsi_reg"
[(set (match_operand:SI 0 "register_operand" "=&d")
(ashiftrt:SI (match_operand:SI 1 "register_operand" "d")
(match_operand:SI 2 "register_operand" "d")))]
@@ -1562,7 +1574,7 @@
(set_attr "length" "124")]
)
-(define_insn "*lshlri_reg"
+(define_insn "*lshrsi_reg"
[(set (match_operand:SI 0 "register_operand" "=&d")
(lshiftrt:SI (match_operand:SI 1 "register_operand" "d")
(match_operand:SI 2 "register_operand" "d")))]
@@ -1623,28 +1635,6 @@
(set_attr "length" "4")]
)
-(define_insn "signed_compare"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (unspec
- [(match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")] UNSPEC_CMP))]
- ""
- "cmp\t%0,%1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "4")])
-
-(define_insn "unsigned_compare"
- [(set (match_operand:SI 0 "register_operand" "=d")
- (unspec
- [(match_operand:SI 1 "register_operand" "d")
- (match_operand:SI 2 "register_operand" "d")] UNSPEC_CMPU))]
- ""
- "cmpu\t%0,%1,%2"
- [(set_attr "type" "arith")
- (set_attr "mode" "SI")
- (set_attr "length" "4")])
-
;;----------------------------------------------------------------
;; Setting a register from an floating point comparison.
;;----------------------------------------------------------------
@@ -1718,6 +1708,47 @@
(set_attr "length" "4")]
)
+(define_insn "branch_compare"
+ [(set (pc)
+ (if_then_else (match_operator:SI 0 "cmp_op"
+ [(match_operand:SI 1 "register_operand" "d")
+ (match_operand:SI 2 "register_operand" "d")
+ ])
+ (label_ref (match_operand 3))
+ (pc)))
+ (clobber(reg:SI R_TMP))]
+ ""
+ {
+ operands[4] = gen_rtx_REG (SImode, MB_ABI_ASM_TEMP_REGNUM);
+ enum rtx_code code = GET_CODE (operands[0]);
+
+ if (code == GT || code == LE)
+ {
+ output_asm_insn ("cmp\tr18,%z1,%z2", operands);
+ code = swap_condition (code);
+ }
+ else if (code == GTU || code == LEU)
+ {
+ output_asm_insn ("cmpu\tr18,%z1,%z2", operands);
+ code = swap_condition (code);
+ }
+ else if (code == GE || code == LT)
+ {
+ output_asm_insn ("cmp\tr18,%z2,%z1", operands);
+ }
+ else if (code == GEU || code == LTU)
+ {
+ output_asm_insn ("cmpu\tr18,%z2,%z1", operands);
+ }
+
+ operands[0] = gen_rtx_fmt_ee (signed_condition (code), SImode, operands[4], const0_rtx);
+ return "b%C0i%?\tr18,%3";
+ }
+ [(set_attr "type" "branch")
+ (set_attr "mode" "none")
+ (set_attr "length" "12")]
+)
+
;;----------------------------------------------------------------
;; Unconditional branches
;;----------------------------------------------------------------
diff --git a/gcc/config/microblaze/predicates.md b/gcc/config/microblaze/predicates.md
index 5fd1bd40372..905d46a9d1f 100644
--- a/gcc/config/microblaze/predicates.md
+++ b/gcc/config/microblaze/predicates.md
@@ -85,6 +85,10 @@
(ior (match_operand 0 "const_0_operand")
(match_operand 0 "register_operand")))
+(define_predicate "reg_or_mem_operand"
+ (ior (match_operand 0 "memory_operand")
+ (match_operand 0 "register_operand")))
+
;; Return if the operand is either the PC or a label_ref.
(define_special_predicate "pc_or_label_operand"
(ior (match_code "pc,label_ref")
@@ -119,3 +123,7 @@
;; Test for valid PIC call operand
(define_predicate "call_insn_plt_operand"
(match_test "PLT_ADDR_P (op)"))
+
+;; Return if the code of this rtx pattern is a comparison.
+(define_predicate "cmp_op"
+ (match_code "gt,ge,gtu,geu,lt,le,ltu,leu"))
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index e9460db9d17..7603858340d 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -912,9 +912,12 @@ static rtx
legitimize_tls_address (rtx addr)
{
rtx ret, insn, tmp, t1, t2, tp;
- enum tls_model model = SYMBOL_REF_TLS_MODEL (addr);
- switch (model)
+ /* Currently, we can't handle anything but a SYMBOL_REF. */
+ if (GET_CODE (addr) != SYMBOL_REF)
+ return addr;
+
+ switch (SYMBOL_REF_TLS_MODEL (addr))
{
case TLS_MODEL_GLOBAL_DYNAMIC:
tmp = gen_reg_rtx (Pmode);
@@ -1035,7 +1038,7 @@ hppa_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
&& !REG_POINTER (XEXP (x, 1)))
return gen_rtx_PLUS (Pmode, XEXP (x, 1), XEXP (x, 0));
- if (PA_SYMBOL_REF_TLS_P (x))
+ if (pa_tls_referenced_p (x))
return legitimize_tls_address (x);
else if (flag_pic)
return legitimize_pic_address (x, mode, gen_reg_rtx (Pmode));
@@ -1916,9 +1919,10 @@ pa_emit_move_sequence (rtx *operands, enum machine_mode mode, rtx scratch_reg)
not consider them legitimate constants. Loop optimizations can
call the emit_move_xxx with one as a source. */
if ((GET_CODE (operand1) != HIGH && immediate_operand (operand1, mode))
- || function_label_operand (operand1, VOIDmode)
|| (GET_CODE (operand1) == HIGH
- && symbolic_operand (XEXP (operand1, 0), mode)))
+ && symbolic_operand (XEXP (operand1, 0), mode))
+ || function_label_operand (operand1, VOIDmode)
+ || pa_tls_referenced_p (operand1))
{
int ishighonly = 0;
@@ -2625,14 +2629,14 @@ pa_output_move_double (rtx *operands)
if (optype0 == REGOP)
latehalf[0] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
else if (optype0 == OFFSOP)
- latehalf[0] = adjust_address (operands[0], SImode, 4);
+ latehalf[0] = adjust_address_nv (operands[0], SImode, 4);
else
latehalf[0] = operands[0];
if (optype1 == REGOP)
latehalf[1] = gen_rtx_REG (SImode, REGNO (operands[1]) + 1);
else if (optype1 == OFFSOP)
- latehalf[1] = adjust_address (operands[1], SImode, 4);
+ latehalf[1] = adjust_address_nv (operands[1], SImode, 4);
else if (optype1 == CNSTOP)
split_double (operands[1], &operands[1], &latehalf[1]);
else
@@ -10398,7 +10402,7 @@ pa_legitimate_constant_p (enum machine_mode mode, rtx x)
/* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not
legitimate constants. The other variants can't be handled by
the move patterns after reload starts. */
- if (PA_SYMBOL_REF_TLS_P (x))
+ if (pa_tls_referenced_p (x))
return false;
if (TARGET_64BIT && GET_CODE (x) == CONST_DOUBLE)
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 620768fb04d..16fa8c54bcb 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -784,9 +784,9 @@ extern int may_call_alloca;
#define MAX_REGS_PER_ADDRESS 2
-/* Non-TLS symbolic references. */
-#define PA_SYMBOL_REF_TLS_P(RTX) \
- (GET_CODE (RTX) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (RTX) != 0)
+/* TLS symbolic reference. */
+#define PA_SYMBOL_REF_TLS_P(X) \
+ (GET_CODE (X) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (X) != 0)
/* Recognize any constant value that is a valid address except
for symbolic addresses. We get better CSE by rejecting them
@@ -796,7 +796,8 @@ extern int may_call_alloca;
#define CONSTANT_ADDRESS_P(X) \
((GET_CODE (X) == LABEL_REF \
|| (GET_CODE (X) == SYMBOL_REF && !SYMBOL_REF_TLS_MODEL (X)) \
- || GET_CODE (X) == CONST_INT || GET_CODE (X) == CONST \
+ || GET_CODE (X) == CONST_INT \
+ || (GET_CODE (X) == CONST && !pa_tls_referenced_p (X)) \
|| GET_CODE (X) == HIGH) \
&& (reload_in_progress || reload_completed \
|| ! pa_symbolic_expression_p (X)))
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 257e33c8469..9ab8352b5fe 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -5482,9 +5482,8 @@ s390_asm_output_function_label (FILE *asm_out_file, const char *fname,
if (hotpatch_trampoline_halfwords >= 0
&& decl_function_context (decl) != NULL_TREE)
{
- warning_at (0, DECL_SOURCE_LOCATION (decl),
- "hotpatch_prologue is not compatible with nested"
- " function");
+ warning_at (DECL_SOURCE_LOCATION (decl), OPT_mhotpatch,
+ "hotpatching is not compatible with nested functions");
hotpatch_trampoline_halfwords = -1;
}
}
diff --git a/gcc/configure b/gcc/configure
index f5315b57dcf..2b2ce1e6264 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -24782,6 +24782,10 @@ fi
# These two are used unconditionally by i386.[ch]; it is to be defined
# to 1 if the feature is present, 0 otherwise.
+ as_ix86_gotoff_in_data_opt=
+ if test x$gas = xyes; then
+ as_ix86_gotoff_in_data_opt="--32"
+ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for GOTOFF in data" >&5
$as_echo_n "checking assembler for GOTOFF in data... " >&6; }
if test "${gcc_cv_as_ix86_gotoff_in_data+set}" = set; then :
@@ -24798,7 +24802,7 @@ fi
nop
.data
.long .L0@GOTOFF' > conftest.s
- if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags $as_ix86_gotoff_in_data_opt -o conftest.o conftest.s >&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -24859,6 +24863,37 @@ $as_echo "#define HAVE_AS_IX86_REP_LOCK_PREFIX 1" >>confdefs.h
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for ud2 mnemonic" >&5
+$as_echo_n "checking assembler for ud2 mnemonic... " >&6; }
+if test "${gcc_cv_as_ix86_ud2+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ gcc_cv_as_ix86_ud2=no
+ if test x$gcc_cv_as != x; then
+ $as_echo 'ud2' > conftest.s
+ if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
+ { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }
+ then
+ gcc_cv_as_ix86_ud2=yes
+ else
+ echo "configure: failed program was" >&5
+ cat conftest.s >&5
+ fi
+ rm -f conftest.o conftest.s
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_ix86_ud2" >&5
+$as_echo "$gcc_cv_as_ix86_ud2" >&6; }
+if test $gcc_cv_as_ix86_ud2 = yes; then
+
+$as_echo "#define HAVE_AS_IX86_UD2 1" >>confdefs.h
+
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for R_386_TLS_GD_PLT reloc" >&5
$as_echo_n "checking assembler for R_386_TLS_GD_PLT reloc... " >&6; }
if test "${gcc_cv_as_ix86_tlsgdplt+set}" = set; then :
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 082995f52a0..68d395d615c 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3761,8 +3761,13 @@ foo: nop
# These two are used unconditionally by i386.[ch]; it is to be defined
# to 1 if the feature is present, 0 otherwise.
+ as_ix86_gotoff_in_data_opt=
+ if test x$gas = xyes; then
+ as_ix86_gotoff_in_data_opt="--32"
+ fi
gcc_GAS_CHECK_FEATURE([GOTOFF in data],
- gcc_cv_as_ix86_gotoff_in_data, [2,11,0],,
+ gcc_cv_as_ix86_gotoff_in_data, [2,11,0],
+ [$as_ix86_gotoff_in_data_opt],
[ .text
.L0:
nop
@@ -3784,6 +3789,12 @@ foo: nop
[AC_DEFINE(HAVE_AS_IX86_REP_LOCK_PREFIX, 1,
[Define if the assembler supports 'rep <insn>, lock <insn>'.])])
+ gcc_GAS_CHECK_FEATURE([ud2 mnemonic],
+ gcc_cv_as_ix86_ud2,,,
+ [ud2],,
+ [AC_DEFINE(HAVE_AS_IX86_UD2, 1,
+ [Define if your assembler supports the 'ud2' mnemonic.])])
+
gcc_GAS_CHECK_FEATURE([R_386_TLS_GD_PLT reloc],
gcc_cv_as_ix86_tlsgdplt,,,
[call tls_gd@tlsgdplt],
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6785033416e..7359cb7d8dc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,67 @@
+2014-02-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/58845
+ * typeck.c (cp_build_binary_op): Sorry on vector&&vector.
+
+2014-02-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/60182
+ * pt.c (unify): Ignore alias templates when deducing a template
+ template parameter.
+
+2014-02-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/60146
+ * pt.c (tsubst_omp_for_iterator): Don't let substitution of the
+ DECL_EXPR initialize a non-class iterator.
+
+2014-02-24 Fabien Chêne <fabien@gcc.gnu.org>
+ PR c++/37140
+ * parser.c (cp_parser_nonclass_name): Call strip_using_decl and
+ move the code handling dependent USING_DECLs...
+ * name-lookup.c (strip_using_decl): ...Here.
+
+2014-02-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/60108
+ * semantics.c (expand_or_defer_fn_1): Check DECL_DEFAULTED_FN.
+
+ PR c++/60187
+ * parser.c (cp_parser_enum_specifier): Call
+ check_for_bare_parameter_packs.
+
+ PR c++/60216
+ * pt.c (register_specialization): Copy DECL_DELETED_FN to clones.
+
+ PR c++/60219
+ * pt.c (coerce_template_parms): Bail if argument packing fails.
+
+ PR c++/60248
+ * mangle.c (mangle_decl): Don't make an alias for a TYPE_DECL.
+
+2014-02-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/60274
+ Revert:
+ PR c++/58606
+ * pt.c (template_parm_to_arg): Call convert_from_reference.
+ (tsubst_template_arg): Don't strip reference refs.
+
+2014-02-20 Kai Tietz <ktietz@redhat.com>
+
+ PR c++/58873
+ * parser.c (cp_parser_functional_cast): Treat NULL_TREE
+ valued type argument as error_mark_node.
+
+ PR c++/58835
+ * semantics.c (finish_fname): Handle error_mark_node.
+
+2014-02-19 Jason Merrill <jason@redhat.com>
+
+ PR c++/60046
+ * pt.c (maybe_instantiate_noexcept): Don't instantiate exception
+ spec from template context.
+
2014-01-31 Jason Merrill <jason@redhat.com>
PR c++/58672
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 4d3799480f9..2941ace484e 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3478,6 +3478,7 @@ mangle_decl (const tree decl)
if (G.need_abi_warning
/* Don't do this for a fake symbol we aren't going to emit anyway. */
+ && TREE_CODE (decl) != TYPE_DECL
&& !DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl)
&& !DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl))
{
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 5763b9b4257..da167ec4158 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -394,7 +394,8 @@ pop_binding (tree id, tree decl)
}
}
-/* Strip non dependent using declarations. */
+/* Strip non dependent using declarations. If DECL is dependent,
+ surreptitiously create a typename_type and return it. */
tree
strip_using_decl (tree decl)
@@ -404,6 +405,23 @@ strip_using_decl (tree decl)
while (TREE_CODE (decl) == USING_DECL && !DECL_DEPENDENT_P (decl))
decl = USING_DECL_DECLS (decl);
+
+ if (TREE_CODE (decl) == USING_DECL && DECL_DEPENDENT_P (decl)
+ && USING_DECL_TYPENAME_P (decl))
+ {
+ /* We have found a type introduced by a using
+ declaration at class scope that refers to a dependent
+ type.
+
+ using typename :: [opt] nested-name-specifier unqualified-id ;
+ */
+ decl = make_typename_type (TREE_TYPE (decl),
+ DECL_NAME (decl),
+ typename_type, tf_error);
+ if (decl != error_mark_node)
+ decl = TYPE_NAME (decl);
+ }
+
return decl;
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index f6fa168d161..c512d69c6a6 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14164,25 +14164,7 @@ cp_parser_nonclass_name (cp_parser* parser)
/* Look up the type-name. */
type_decl = cp_parser_lookup_name_simple (parser, identifier, token->location);
- if (TREE_CODE (type_decl) == USING_DECL)
- {
- if (!DECL_DEPENDENT_P (type_decl))
- type_decl = strip_using_decl (type_decl);
- else if (USING_DECL_TYPENAME_P (type_decl))
- {
- /* We have found a type introduced by a using
- declaration at class scope that refers to a dependent
- type.
-
- using typename :: [opt] nested-name-specifier unqualified-id ;
- */
- type_decl = make_typename_type (TREE_TYPE (type_decl),
- DECL_NAME (type_decl),
- typename_type, tf_error);
- if (type_decl != error_mark_node)
- type_decl = TYPE_NAME (type_decl);
- }
- }
+ type_decl = strip_using_decl (type_decl);
if (TREE_CODE (type_decl) != TYPE_DECL
&& (objc_is_id (identifier) || objc_is_class_name (identifier)))
@@ -14738,7 +14720,8 @@ cp_parser_enum_specifier (cp_parser* parser)
{
underlying_type = grokdeclarator (NULL, &type_specifiers, TYPENAME,
/*initialized=*/0, NULL);
- if (underlying_type == error_mark_node)
+ if (underlying_type == error_mark_node
+ || check_for_bare_parameter_packs (underlying_type))
underlying_type = NULL_TREE;
}
}
@@ -22205,6 +22188,9 @@ cp_parser_functional_cast (cp_parser* parser, tree type)
tree cast;
bool nonconst_p;
+ if (!type)
+ type = error_mark_node;
+
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
{
maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2ac1e66a5c7..724707b5a0d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1419,6 +1419,8 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend,
= DECL_DECLARED_INLINE_P (fn);
DECL_SOURCE_LOCATION (clone)
= DECL_SOURCE_LOCATION (fn);
+ DECL_DELETED_FN (clone)
+ = DECL_DELETED_FN (fn);
}
check_specialization_namespace (tmpl);
@@ -3823,7 +3825,6 @@ template_parm_to_arg (tree t)
SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
(vec, TREE_VEC_LENGTH (vec));
#endif
- t = convert_from_reference (t);
TREE_VEC_ELT (vec, 0) = make_pack_expansion (t);
t = make_node (NONTYPE_ARGUMENT_PACK);
@@ -6678,6 +6679,8 @@ coerce_template_parms (tree parms,
/* Store this argument. */
if (arg == error_mark_node)
lost++;
+ if (lost)
+ break;
TREE_VEC_ELT (new_inner_args, parm_idx) = arg;
/* We are done with all of the arguments. */
@@ -9113,6 +9116,10 @@ tsubst_template_arg (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/*integral_constant_expression_p=*/true);
if (!(complain & tf_warning))
--c_inhibit_evaluation_warnings;
+ /* Preserve the raw-reference nature of T. */
+ if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
+ && REFERENCE_REF_P (r))
+ r = TREE_OPERAND (r, 0);
}
return r;
}
@@ -12696,27 +12703,43 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv,
tsubst_expr ((NODE), args, complain, in_decl, \
integral_constant_expression_p)
tree decl, init, cond, incr;
- bool init_decl;
init = TREE_VEC_ELT (OMP_FOR_INIT (t), i);
gcc_assert (TREE_CODE (init) == MODIFY_EXPR);
decl = TREE_OPERAND (init, 0);
init = TREE_OPERAND (init, 1);
- /* Do this before substituting into decl to handle 'auto'. */
- init_decl = (init && TREE_CODE (init) == DECL_EXPR);
- init = RECUR (init);
- decl = RECUR (decl);
- if (init_decl)
+ tree decl_expr = NULL_TREE;
+ if (init && TREE_CODE (init) == DECL_EXPR)
{
- gcc_assert (!processing_template_decl);
- init = DECL_INITIAL (decl);
- DECL_INITIAL (decl) = NULL_TREE;
+ /* We need to jump through some hoops to handle declarations in the
+ for-init-statement, since we might need to handle auto deduction,
+ but we need to keep control of initialization. */
+ decl_expr = init;
+ init = DECL_INITIAL (DECL_EXPR_DECL (init));
+ decl = tsubst_decl (decl, args, complain);
}
+ else
+ decl = RECUR (decl);
+ init = RECUR (init);
+
+ tree auto_node = type_uses_auto (TREE_TYPE (decl));
+ if (auto_node && init)
+ TREE_TYPE (decl)
+ = do_auto_deduction (TREE_TYPE (decl), init, auto_node);
gcc_assert (!type_dependent_expression_p (decl));
if (!CLASS_TYPE_P (TREE_TYPE (decl)))
{
+ if (decl_expr)
+ {
+ /* Declare the variable, but don't let that initialize it. */
+ tree init_sav = DECL_INITIAL (DECL_EXPR_DECL (decl_expr));
+ DECL_INITIAL (DECL_EXPR_DECL (decl_expr)) = NULL_TREE;
+ RECUR (decl_expr);
+ DECL_INITIAL (DECL_EXPR_DECL (decl_expr)) = init_sav;
+ }
+
cond = RECUR (TREE_VEC_ELT (OMP_FOR_COND (t), i));
incr = TREE_VEC_ELT (OMP_FOR_INCR (t), i);
if (TREE_CODE (incr) == MODIFY_EXPR)
@@ -12733,7 +12756,13 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv,
return;
}
- if (init && !init_decl)
+ if (decl_expr)
+ {
+ /* Declare and initialize the variable. */
+ RECUR (decl_expr);
+ init = NULL_TREE;
+ }
+ else if (init)
{
tree c;
for (c = *clauses; c ; c = OMP_CLAUSE_CHAIN (c))
@@ -16589,9 +16618,11 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
if (TREE_CODE (arg) != BOUND_TEMPLATE_TEMPLATE_PARM
&& !CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P (arg))
return unify_template_deduction_failure (explain_p, parm, arg);
-
{
tree parmvec = TYPE_TI_ARGS (parm);
+ /* An alias template name is never deduced. */
+ if (TYPE_ALIAS_P (arg))
+ arg = strip_typedefs (arg);
tree argvec = INNERMOST_TEMPLATE_ARGS (TYPE_TI_ARGS (arg));
tree full_argvec = add_to_template_args (targs, argvec);
tree parm_parms
@@ -18567,6 +18598,10 @@ maybe_instantiate_noexcept (tree fn)
{
tree fntype, spec, noex, clone;
+ /* Don't instantiate a noexcept-specification from template context. */
+ if (processing_template_decl)
+ return;
+
if (DECL_CLONED_FUNCTION_P (fn))
fn = DECL_CLONED_FUNCTION (fn);
fntype = TREE_TYPE (fn);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 16b50e09698..95186853374 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2501,7 +2501,8 @@ finish_fname (tree id)
tree decl;
decl = fname_decl (input_location, C_RID_CODE (id), id);
- if (processing_template_decl && current_function_decl)
+ if (processing_template_decl && current_function_decl
+ && decl != error_mark_node)
decl = DECL_NAME (decl);
return decl;
}
@@ -3853,7 +3854,7 @@ expand_or_defer_fn_1 (tree fn)
linkage of all functions, and as that causes writes to
the data mapped in from the PCH file, it's advantageous
to mark the functions at this point. */
- if (!DECL_IMPLICIT_INSTANTIATION (fn))
+ if (!DECL_IMPLICIT_INSTANTIATION (fn) || DECL_DEFAULTED_FN (fn))
{
/* This function must have external linkage, as
otherwise DECL_INTERFACE_KNOWN would have been
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 299e1f45352..b8e862cb3c7 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4103,6 +4103,11 @@ cp_build_binary_op (location_t location,
case TRUTH_ORIF_EXPR:
case TRUTH_AND_EXPR:
case TRUTH_OR_EXPR:
+ if (TREE_CODE (type0) == VECTOR_TYPE || TREE_CODE (type1) == VECTOR_TYPE)
+ {
+ sorry ("logical operation on vector type");
+ return error_mark_node;
+ }
result_type = boolean_type_node;
break;
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ded1cbae6a0..62daae2b8d4 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -11256,11 +11256,35 @@ option should only be used if you require compatibility with code for
big-endian ARM processors generated by versions of the compiler prior to
2.8. This option is now deprecated.
-@item -mcpu=@var{name}
-@opindex mcpu
-This specifies the name of the target ARM processor. GCC uses this name
-to determine what kind of instructions it can emit when generating
-assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
+@item -march=@var{name}
+@opindex march
+This specifies the name of the target ARM architecture. GCC uses this
+name to determine what kind of instructions it can emit when generating
+assembly code. This option can be used in conjunction with or instead
+of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
+@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
+@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
+@samp{armv6}, @samp{armv6j},
+@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
+@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
+@samp{armv8-a}, @samp{armv8-a+crc},
+@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
+
+@option{-march=armv8-a+crc} enables code generation for the ARMv8-A
+architecture together with the optional CRC32 extensions.
+
+@option{-march=native} causes the compiler to auto-detect the architecture
+of the build computer. At present, this feature is only supported on
+Linux, and not all architectures are recognized. If the auto-detect is
+unsuccessful the option has no effect.
+
+@item -mtune=@var{name}
+@opindex mtune
+This option specifies the name of the target ARM processor for
+which GCC should tune the performance of the code.
+For some ARM implementations better performance can be obtained by using
+this option.
+Permissible names are: @samp{arm2}, @samp{arm250},
@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
@@ -11288,27 +11312,6 @@ assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
@samp{fa526}, @samp{fa626},
@samp{fa606te}, @samp{fa626te}, @samp{fmp626}, @samp{fa726te}.
-
-@option{-mcpu=generic-@var{arch}} is also permissible, and is
-equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
-See @option{-mtune} for more information.
-
-@option{-mcpu=native} causes the compiler to auto-detect the CPU
-of the build computer. At present, this feature is only supported on
-Linux, and not all architectures are recognized. If the auto-detect is
-unsuccessful the option has no effect.
-
-@item -mtune=@var{name}
-@opindex mtune
-This option is very similar to the @option{-mcpu=} option, except that
-instead of specifying the actual target processor type, and hence
-restricting which instructions can be used, it specifies that GCC should
-tune the performance of the code as if the target were of the type
-specified in this option, but still choosing the instructions it
-generates based on the CPU specified by a @option{-mcpu=} option.
-For some ARM implementations better performance can be obtained by using
-this option.
-
@option{-mtune=generic-@var{arch}} specifies that GCC should tune the
performance for a blend of processors within architecture @var{arch}.
The aim is to generate code that run well on the current most popular
@@ -11321,24 +11324,23 @@ of the build computer. At present, this feature is only supported on
Linux, and not all architectures are recognized. If the auto-detect is
unsuccessful the option has no effect.
-@item -march=@var{name}
-@opindex march
-This specifies the name of the target ARM architecture. GCC uses this
-name to determine what kind of instructions it can emit when generating
-assembly code. This option can be used in conjunction with or instead
-of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
-@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
-@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
-@samp{armv6}, @samp{armv6j},
-@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
-@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
-@samp{armv8-a}, @samp{armv8-a+crc},
-@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
+@item -mcpu=@var{name}
+@opindex mcpu
+This specifies the name of the target ARM processor. GCC uses this name
+to derive the name of the target ARM architecture (as if specified
+by @option{-march}) and the ARM processor type for which to tune for
+performance (as if specified by @option{-mtune}). Where this option
+is used in conjunction with @option{-march} or @option{-mtune},
+those options take precedence over the appropriate part of this option.
-@option{-march=armv8-a+crc} enables code generation for the ARMv8-A
-architecture together with the optional CRC32 extensions.
+Permissible names for this option are the same as those for
+@option{-mtune}.
-@option{-march=native} causes the compiler to auto-detect the architecture
+@option{-mcpu=generic-@var{arch}} is also permissible, and is
+equivalent to @option{-march=@var{arch} -mtune=generic-@var{arch}}.
+See @option{-mtune} for more information.
+
+@option{-mcpu=native} causes the compiler to auto-detect the CPU
of the build computer. At present, this feature is only supported on
Linux, and not all architectures are recognized. If the auto-detect is
unsuccessful the option has no effect.
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 2ec8e7fa5e3..46ae7018d90 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,63 @@
+2014-03-02 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/60341
+ * frontend-passes.c (optimize_comparison): Guard two union accesses
+ with the corresponding tag checks.
+
+2014-02-22 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/59599
+ * trans-intrinsic.c (gfc_conv_intrinsic_ichar): Calculate the
+ number of arguments.
+
+2014-02-19 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/49397
+ * expr.c (gfc_check_pointer_assign): Add check for
+ F2008Cor2, C729.
+ * trans-decl.c (gfc_get_symbol_decl): Correctly generate
+ external decl in a corner case.
+
+2014-02-19 Janus Weil <janus@gcc.gnu.org>
+
+ Backports from mainline:
+ 2014-02-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/55907
+ * resolve.c (build_default_init_expr): Don't initialize character
+ variable if -fno-automatic is given.
+
+ 2014-02-18 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/60231
+ * resolve.c (check_generic_tbp_ambiguity): Check for presence of dummy
+ arguments to prevent ICE.
+
+2014-02-09 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ 2013-10-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58803
+ PR fortran/59395
+ * decl.c (match_ppc_decl): Prevent later double free.
+
+2014-02-08 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/57033
+ * primary.c (gfc_convert_to_structure_constructor): Avoid null pointer
+ dereference.
+
+2014-02-07 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/59906
+ * trans-stmt.c (gfc_add_loop_ss_code): In the case of character
+ SS_REFERENCE, use gfc_conv_string_parameter to ensure that a
+ pointer to the string is stored.
+ * trans-expr.c (gfc_conv_expr_reference): Likewise, use
+ gfc_conv_string_parameter to ensure that a pointer to is passed
+ to the elemental function.
+
2014-02-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/59414
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index b748cfd9561..c6e16c7e366 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5069,7 +5069,14 @@ match_ppc_decl (void)
if (gfc_add_proc (&c->attr, name, NULL) == FAILURE)
return MATCH_ERROR;
- c->tb = tb;
+ if (num == 1)
+ c->tb = tb;
+ else
+ {
+ c->tb = XCNEW (gfc_typebound_proc);
+ c->tb->where = gfc_current_locus;
+ *c->tb = *tb;
+ }
/* Set interface. */
if (proc_if != NULL)
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 7f101ba03d5..c3dbd01684c 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3555,6 +3555,16 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
return FAILURE;
}
+ /* Check F2008Cor2, C729. */
+ if (!s2->attr.intrinsic && s2->attr.if_source == IFSRC_UNKNOWN
+ && !s2->attr.external && !s2->attr.subroutine && !s2->attr.function)
+ {
+ gfc_error ("Procedure pointer target '%s' at %L must be either an "
+ "intrinsic, host or use associated, referenced or have "
+ "the EXTERNAL attribute", s2->name, &rvalue->where);
+ return FAILURE;
+ }
+
return SUCCESS;
}
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index fdfbce09465..3dbe8fe0d99 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -1214,7 +1214,9 @@ optimize_comparison (gfc_expr *e, gfc_intrinsic_op op)
/* Replace A // B < A // C with B < C, and A // B < C // B
with A < C. */
if (op1->ts.type == BT_CHARACTER && op2->ts.type == BT_CHARACTER
+ && op1->expr_type == EXPR_OP
&& op1->value.op.op == INTRINSIC_CONCAT
+ && op2->expr_type == EXPR_OP
&& op2->value.op.op == INTRINSIC_CONCAT)
{
gfc_expr *op1_left = op1->value.op.op1;
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index db288b59a85..a94ae216dd5 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2540,7 +2540,8 @@ gfc_convert_to_structure_constructor (gfc_expr *e, gfc_symbol *sym, gfc_expr **c
if (parent && !comp)
break;
- actual = actual->next;
+ if (actual)
+ actual = actual->next;
}
if (build_actual_constructor (&comp_head, &ctor_head, sym) == FAILURE)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index bdca5300f71..eab98ad95d7 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -11058,7 +11058,7 @@ build_default_init_expr (gfc_symbol *sym)
init_expr = NULL;
}
if (!init_expr && gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON
- && sym->ts.u.cl->length)
+ && sym->ts.u.cl->length && gfc_option.flag_max_stack_var_size != 0)
{
gfc_actual_arglist *arg;
init_expr = gfc_get_expr ();
@@ -11878,6 +11878,7 @@ check_generic_tbp_ambiguity (gfc_tbp_generic* t1, gfc_tbp_generic* t2,
{
gfc_symbol *sym1, *sym2;
const char *pass1, *pass2;
+ gfc_formal_arglist *dummy_args;
gcc_assert (t1->specific && t2->specific);
gcc_assert (!t1->specific->is_generic);
@@ -11900,19 +11901,33 @@ check_generic_tbp_ambiguity (gfc_tbp_generic* t1, gfc_tbp_generic* t2,
return FAILURE;
}
- /* Compare the interfaces. */
+ /* Determine PASS arguments. */
if (t1->specific->nopass)
pass1 = NULL;
else if (t1->specific->pass_arg)
pass1 = t1->specific->pass_arg;
else
- pass1 = gfc_sym_get_dummy_args (t1->specific->u.specific->n.sym)->sym->name;
+ {
+ dummy_args = gfc_sym_get_dummy_args (t1->specific->u.specific->n.sym);
+ if (dummy_args)
+ pass1 = dummy_args->sym->name;
+ else
+ pass1 = NULL;
+ }
if (t2->specific->nopass)
pass2 = NULL;
else if (t2->specific->pass_arg)
pass2 = t2->specific->pass_arg;
else
- pass2 = gfc_sym_get_dummy_args (t2->specific->u.specific->n.sym)->sym->name;
+ {
+ dummy_args = gfc_sym_get_dummy_args (t2->specific->u.specific->n.sym);
+ if (dummy_args)
+ pass2 = dummy_args->sym->name;
+ else
+ pass2 = NULL;
+ }
+
+ /* Compare the interfaces. */
if (gfc_compare_interfaces (sym1, sym2, sym2->name, !t1->is_operator, 0,
NULL, 0, pass1, pass2))
{
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 2927b80d444..8da24a2578f 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2487,6 +2487,11 @@ gfc_add_loop_ss_code (gfc_loopinfo * loop, gfc_ss * ss, bool subscript,
a reference to the value. */
gfc_conv_expr (&se, expr);
}
+
+ /* Ensure that a pointer to the string is stored. */
+ if (expr->ts.type == BT_CHARACTER)
+ gfc_conv_string_parameter (&se);
+
gfc_add_block_to_block (&outer_loop->pre, &se.pre);
gfc_add_block_to_block (&outer_loop->post, &se.post);
if (gfc_is_class_scalar_expr (expr))
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 7806bbbd878..43f918bb2c7 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -1358,9 +1358,10 @@ gfc_get_symbol_decl (gfc_symbol * sym)
if (sym->attr.flavor == FL_PROCEDURE)
{
- /* Catch function declarations. Only used for actual parameters,
+ /* Catch functions. Only used for actual parameters,
procedure pointers and procptr initialization targets. */
- if (sym->attr.external || sym->attr.use_assoc || sym->attr.intrinsic)
+ if (sym->attr.external || sym->attr.use_assoc || sym->attr.intrinsic
+ || sym->attr.if_source != IFSRC_DECL)
{
decl = gfc_get_extern_function_decl (sym);
gfc_set_decl_location (decl, &sym->declared_at);
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index f1452fa423a..891717aca40 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -6342,7 +6342,13 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr)
/* Returns a reference to the scalar evaluated outside the loop
for this case. */
gfc_conv_expr (se, expr);
- se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
+
+ if (expr->ts.type == BT_CHARACTER
+ && expr->expr_type != EXPR_FUNCTION)
+ gfc_conv_string_parameter (se);
+ else
+ se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
+
return;
}
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index ddd9eaea5c2..9f979500211 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -4685,8 +4685,10 @@ static void
gfc_conv_intrinsic_ichar (gfc_se * se, gfc_expr * expr)
{
tree args[2], type, pchartype;
+ int nargs;
- gfc_conv_intrinsic_function_args (se, expr, args, 2);
+ nargs = gfc_intrinsic_argument_list_length (expr);
+ gfc_conv_intrinsic_function_args (se, expr, args, nargs);
gcc_assert (POINTER_TYPE_P (TREE_TYPE (args[1])));
pchartype = gfc_get_pchar_type (expr->value.function.actual->expr->ts.kind);
args[1] = fold_build1_loc (input_location, NOP_EXPR, pchartype, args[1]);
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 7ea66f8cb6f..44a5e17d4a2 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -3119,6 +3119,7 @@ cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs,
struct cgraph_node *node)
{
struct ipa_node_params *orig_caller_info = IPA_NODE_REF (cs->caller);
+ struct ipa_node_params *orig_node_info;
struct ipa_agg_replacement_value *aggval;
int i, ec, count;
@@ -3133,6 +3134,7 @@ cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs,
if (aggval->index >= ec)
return false;
+ orig_node_info = IPA_NODE_REF (IPA_NODE_REF (node)->ipcp_orig_node);
if (orig_caller_info->ipcp_orig_node)
orig_caller_info = IPA_NODE_REF (orig_caller_info->ipcp_orig_node);
@@ -3150,7 +3152,7 @@ cgraph_edge_brings_all_agg_vals_for_node (struct cgraph_edge *cs,
if (!interesting)
continue;
- plats = ipa_get_parm_lattices (orig_caller_info, aggval->index);
+ plats = ipa_get_parm_lattices (orig_node_info, aggval->index);
if (plats->aggs_bottom)
return false;
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 3053aa058b7..1f638442503 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -1061,7 +1061,8 @@ compute_complex_ancestor_jump_func (struct ipa_node_params *info,
return;
parm = TREE_OPERAND (expr, 0);
index = ipa_get_param_decl_index (info, SSA_NAME_VAR (parm));
- gcc_assert (index >= 0);
+ if (index < 0)
+ return;
cond_bb = single_pred (assign_bb);
cond = last_stmt (cond_bb);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 10ada5e10d4..20afe17b34f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,148 @@
+2014-03-02 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/60341
+ * gfortran.dg/str_comp_optimize_1.f90: New test.
+
+2014-02-25 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-02-21 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60276
+ * gcc.dg/vect/pr60276.c: New testcase.
+
+2014-02-25 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-02-14 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60183
+ * gcc.dg/torture/pr60183.c: New testcase.
+
+2014-02-24 Fabien Chêne <fabien@gcc.gnu.org>
+
+ PR c++/37140
+ * g++.dg/template/using27.C: New.
+ * g++.dg/template/using28.C: New.
+ * g++.dg/template/using29.C: New.
+
+2014-02-23 David Holsgrove <david.holsgrove@xilinx.com>
+
+ * gcc/testsuite/gcc.target/microblaze/others/mem_reload.c: New test.
+
+2014-02-22 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/59599
+ * gfortran.dg/ichar_3.f90: New test.
+
+2014-02-21 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from mainline
+ PR fortran/59700
+ * gfortran.dg/pr59700.f90: New test.
+
+2014-02-21 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/55260
+ * gcc.dg/ipa/pr55260.c: New test.
+
+2014-02-19 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/49397
+ * gfortran.dg/proc_ptr_45.f90: New.
+ * gfortran.dg/proc_ptr_46.f90: New.
+
+2014-02-19 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2014-02-19 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/59794
+ * gcc.target/i386/pr39162.c: Add dg-prune-output.
+ (dg-options): Remove -Wno-psabi.
+ * gcc.target/i386/pr59794-2.c: Ditto.
+ * gcc.target/i386/sse-5.c: Ditto.
+
+2014-02-19 Janus Weil <janus@gcc.gnu.org>
+
+ Backports from mainline:
+ 2014-02-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/55907
+ * gfortran.dg/init_flag_12.f90: New.
+
+ 2014-02-18 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/60231
+ * gfortran.dg/typebound_generic_15.f90: New.
+
+2014-02-18 Kai Tietz <ktietz@redhat.com>
+
+ PR target/60193
+ * gcc.target/i386/nest-1.c: New testcase.
+
+2014-02-18 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/opt32.adb: New test.
+
+2014-02-15 Jerry DeLisle <jvdelisle@gcc.gnu>
+ Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ Backport from mainline
+ PR libfortran/59771
+ PR libfortran/59774
+ PR libfortran/59836
+ * gfortran.dg/fmt_g_1.f90: New test.
+ * gfortran.dg/round_3.f08: New cases added.
+
+2014-02-13 Dominik Vogt <vogt@linux.vnet.ibm.com>
+
+ * gcc.target/s390/hotpatch-compile-8.c: New test.
+
+2014-02-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.c-torture/execute/20140212-1.c: New test.
+
+2014-02-10 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2014-01-30 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/59903
+ * gcc.dg/torture/pr59903.c: New testcase.
+
+ 2014-02-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60115
+ * gcc.dg/torture/pr60115.c: New testcase.
+
+2014-02-09 Janus Weil <janus@gcc.gnu.org>
+
+ Backport from mainline
+ 2013-10-21 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58803
+ PR fortran/59395
+ * gfortran.dg/proc_ptr_comp_38.f90: New.
+
+2014-02-08 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/57033
+ * gfortran.dg/default_initialization_7.f90: New test.
+
+2014-02-07 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/59906
+ * gfortran.dg/elemental_subroutine_9.f90 : New test
+
+2014-02-04 Uros Bizjak <ubizjak@gmail.com>
+
+ Backport from mainline
+ 2014-02-02 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/60017
+ * gcc.c-torture/execute/pr60017.c: New test.
+
2014-02-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/59414
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C
new file mode 100644
index 00000000000..c444217b0ee
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-41.C
@@ -0,0 +1,18 @@
+// PR c++/60182
+// { dg-require-effective-target c++11 }
+
+class B {};
+template <typename> using __allocator_base = B;
+template <typename> class F : __allocator_base<int> {};
+class C {};
+template <typename, typename = F<int> > class G : C {};
+template <typename> class D;
+class A {
+ using Container = G<D<char>>;
+ A();
+ A(D<char> const &);
+ Container m_elements;
+};
+template <template <class, class> class C, class A = F<D<int>>>
+void doSomething(C<D<char>, A> &);
+A::A(D<char> const &) : A() { doSomething(m_elements); }
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted48.C b/gcc/testsuite/g++.dg/cpp0x/defaulted48.C
new file mode 100644
index 00000000000..727afc5ca55
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted48.C
@@ -0,0 +1,17 @@
+// PR c++/60108
+// { dg-require-effective-target c++11 }
+
+template<int> struct A
+{
+ virtual ~A();
+};
+
+template<typename> struct B : A<0>, A<1>
+{
+ ~B() = default;
+};
+
+struct C : B<bool>
+{
+ C() {}
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted3.C b/gcc/testsuite/g++.dg/cpp0x/deleted3.C
new file mode 100644
index 00000000000..67836773af3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/deleted3.C
@@ -0,0 +1,11 @@
+// PR c++/60216
+// { dg-require-effective-target c++11 }
+
+struct A
+{
+ template<typename T> A(T) = delete;
+};
+
+template<> A::A<int>(int) {}
+
+A a(0);
diff --git a/gcc/testsuite/g++.dg/cpp0x/enum_base2.C b/gcc/testsuite/g++.dg/cpp0x/enum_base2.C
new file mode 100644
index 00000000000..8c6a9011d31
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/enum_base2.C
@@ -0,0 +1,9 @@
+// PR c++/60187
+// { dg-require-effective-target c++11 }
+
+template<typename... T> struct A
+{
+ enum E : T {}; // { dg-error "parameter pack" }
+};
+
+A<int> a;
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept22.C b/gcc/testsuite/g++.dg/cpp0x/noexcept22.C
new file mode 100644
index 00000000000..7aab0f43c4e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept22.C
@@ -0,0 +1,21 @@
+// PR c++/60046
+// { dg-require-effective-target c++11 }
+
+constexpr bool foo () { return noexcept (true); }
+template <typename T>
+struct V
+{
+ void bar (V &) noexcept (foo ()) {}
+};
+template <typename T>
+struct W : public V <int>
+{
+ void bar (W &x) { V <int>::bar (x); }
+};
+
+int
+main ()
+{
+ W <int> a, b;
+ a.bar (b);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic146.C b/gcc/testsuite/g++.dg/cpp0x/variadic146.C
deleted file mode 100644
index 0c91db581d1..00000000000
--- a/gcc/testsuite/g++.dg/cpp0x/variadic146.C
+++ /dev/null
@@ -1,9 +0,0 @@
-// PR c++/58606
-// { dg-require-effective-target c++11 }
-
-template<int&...I> struct A
-{
- template<typename> struct B;
-
- template<typename T> struct B<T*> {};
-};
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic149.C b/gcc/testsuite/g++.dg/cpp0x/variadic149.C
new file mode 100644
index 00000000000..a250e7c296a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic149.C
@@ -0,0 +1,11 @@
+// PR c++/60248
+// { dg-options "-std=c++11 -g -fabi-version=2" }
+
+template<int...> struct A {};
+
+template<> struct A<0>
+{
+ typedef enum { e } B;
+};
+
+A<0> a;
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic150.C b/gcc/testsuite/g++.dg/cpp0x/variadic150.C
new file mode 100644
index 00000000000..6a30efed92c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic150.C
@@ -0,0 +1,9 @@
+// PR c++/60219
+// { dg-require-effective-target c++11 }
+
+template<typename..., int> void foo();
+
+void bar()
+{
+ foo<0>; // { dg-error "" }
+}
diff --git a/gcc/testsuite/g++.dg/ext/vector27.C b/gcc/testsuite/g++.dg/ext/vector27.C
new file mode 100644
index 00000000000..288e13c558d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector27.C
@@ -0,0 +1,7 @@
+// PR c++/58845
+
+void foo()
+{
+ int v __attribute__((vector_size(8)));
+ v = v || v; // { dg-bogus "" "" { xfail *-*-* } }
+}
diff --git a/gcc/testsuite/g++.dg/gomp/for-20.C b/gcc/testsuite/g++.dg/gomp/for-20.C
new file mode 100644
index 00000000000..7b57b16b85f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/for-20.C
@@ -0,0 +1,16 @@
+// PR c++/60146
+// { dg-do compile }
+// { dg-options -fopenmp }
+
+int foo() { return 0; }
+
+template<typename T> void bar()
+{
+#pragma omp parallel for
+ for (T i = foo(); i < 8; ++i) {}
+}
+
+void baz()
+{
+ bar<int>();
+}
diff --git a/gcc/testsuite/g++.dg/template/ref7.C b/gcc/testsuite/g++.dg/template/ref7.C
new file mode 100644
index 00000000000..432929272e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/ref7.C
@@ -0,0 +1,16 @@
+// PR c++/60274
+
+typedef const char *const& ProtocolIdType;
+
+template <ProtocolIdType protocolId>
+struct C {
+ typedef int ProtocolVersion;
+ struct D {
+ ProtocolVersion GetProtocolVersion();
+ };
+};
+template <ProtocolIdType protocolId>
+typename C<protocolId>::ProtocolVersion C<protocolId>::D::GetProtocolVersion()
+{
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/template/using27.C b/gcc/testsuite/g++.dg/template/using27.C
new file mode 100644
index 00000000000..f1835e17161
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/using27.C
@@ -0,0 +1,33 @@
+// PR c++/37140
+
+struct X
+{
+ typedef int nested_type;
+};
+
+template <class T>
+struct A
+{
+ typedef X type;
+};
+
+template <class T>
+struct B : A<T>
+{
+ using typename A<T>::type;
+ typename type::nested_type x;
+};
+
+template <class T>
+struct C : B<T>
+{
+ using typename B<T>::type;
+ typename type::nested_type y;
+};
+
+struct D : C<int>
+{
+ using C<int>::type;
+ type::nested_type z;
+};
+
diff --git a/gcc/testsuite/g++.dg/template/using28.C b/gcc/testsuite/g++.dg/template/using28.C
new file mode 100644
index 00000000000..52f68cfe467
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/using28.C
@@ -0,0 +1,17 @@
+// PR c++/37140
+
+struct C
+{
+ static const int block_size = 1;
+};
+
+template <typename T> struct A {
+ typedef C type;
+};
+
+template <typename T> struct B : public A<T> {
+ using typename A<T>::type;
+ static const int block_size = type::block_size;
+};
+
+template class B<int>;
diff --git a/gcc/testsuite/g++.dg/template/using29.C b/gcc/testsuite/g++.dg/template/using29.C
new file mode 100644
index 00000000000..8726547efdb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/using29.C
@@ -0,0 +1,21 @@
+// PR c++/58047
+
+template <int N>
+struct print_arg { };
+
+struct const_holder {
+ static const int CONSTANT = 42;
+};
+
+template <typename T>
+struct identity {
+ typedef T type;
+};
+
+template <class T>
+struct test_case : public identity<T> {
+ using typename identity<T>::type;
+ print_arg<type::CONSTANT> printer;
+};
+
+template struct test_case<const_holder>;
diff --git a/gcc/testsuite/gcc.c-torture/execute/20140212-1.c b/gcc/testsuite/gcc.c-torture/execute/20140212-1.c
new file mode 100644
index 00000000000..8f1f84f3e3c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20140212-1.c
@@ -0,0 +1,37 @@
+/* PR rtl-optimization/60116 */
+/* Reported by Zhendong Su <su@cs.ucdavis.edu> */
+
+extern void abort (void);
+
+int a, b, c, d = 1, e, f = 1, h, i, k;
+char g, j;
+
+void
+fn1 (void)
+{
+ int l;
+ e = 0;
+ c = 0;
+ for (;;)
+ {
+ k = a && b;
+ j = k * 54;
+ g = j * 147;
+ l = ~g + (long long) e && 1;
+ if (d)
+ c = l;
+ else
+ h = i = l * 9UL;
+ if (f)
+ return;
+ }
+}
+
+int
+main (void)
+{
+ fn1 ();
+ if (c != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr60017.c b/gcc/testsuite/gcc.c-torture/execute/pr60017.c
new file mode 100644
index 00000000000..d72c12c8a1c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr60017.c
@@ -0,0 +1,33 @@
+/* PR target/60017 */
+
+extern void abort (void);
+
+struct S0
+{
+ short m0;
+ short m1;
+};
+
+struct S1
+{
+ unsigned m0:1;
+ char m1[2][2];
+ struct S0 m2[2];
+};
+
+struct S1 x = { 1, {{2, 3}, {4, 5}}, {{6, 7}, {8, 9}} };
+
+struct S1 func (void)
+{
+ return x;
+}
+
+int main (void)
+{
+ struct S1 ret = func ();
+
+ if (ret.m2[1].m1 != 9)
+ abort ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/ipa/pr55260.c b/gcc/testsuite/gcc.dg/ipa/pr55260.c
new file mode 100644
index 00000000000..ef151b0a208
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr55260.c
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-inline -fipa-cp-clone" } */
+
+typedef struct {
+ int *ptr;
+ int len;
+} string;
+typedef struct {
+ string nantstr;
+ int *nant;
+} malv;
+typedef struct {
+ int *nor;
+} list_heads;
+int b;
+list_heads *fn1(string, int *, unsigned);
+void fn2(malv *p1, list_heads *p2, unsigned p3) {
+ string a = p1->nantstr;
+ fn1(a, p1->nant, p3);
+}
+
+void fn3(unsigned p1) { fn2(0, 0, p1); }
+
+list_heads *fn1(string p1, int *p2, unsigned p3) {
+ while (1) {
+ if (p3)
+ fn3(1);
+ if (b)
+ return 0;
+ fn3(1);
+ }
+}
+
+void fn5() {
+ list_heads c;
+ c.nor = 0;
+ fn2(0, &c, 1);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr59903.c b/gcc/testsuite/gcc.dg/torture/pr59903.c
new file mode 100644
index 00000000000..01772df6111
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr59903.c
@@ -0,0 +1,56 @@
+/* { dg-do compile } */
+
+int a, b, c, d, e, f, g, h, i[3], l, m, n, o, p, q, r;
+
+struct S0
+{
+ int f0;
+ int f1;
+ int f2;
+ int f3;
+} j;
+
+static int
+fn1 (int p1)
+{
+ return p1 || ((p1 > 0) > (e << 1));
+}
+
+static struct S0
+fn2 (struct S0 p1)
+{
+ char s;
+ struct S0 t = {0,0,0,0};
+ int u = 2;
+ for (;;)
+ {
+ if (i[0])
+ break;
+ for (m = 0; m < 4; m++)
+ for (p1.f0 = 0; p1.f0 < 3; p1.f0++)
+ {
+ j = t;
+ t.f3 = i[p1.f0];
+ o = b || 1 >> b ? 0 : a < 0;
+ q = 1 % d;
+ if ((g < fn1 ((1 ^ (q & 1)) | n)) ^ u)
+ j.f3 |= p % 2;
+ s = j.f3 > 0 ? j.f3 : j.f3 << 1;
+ r = l = s && p1.f1 * c;
+ h = p1.f1;
+ }
+ }
+ return p1;
+}
+
+int
+main ()
+{
+ for (;f;)
+ {
+ struct S0 v = {0,0,0,0};
+ fn2 (v);
+ j.f3 = 0;
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr60115.c b/gcc/testsuite/gcc.dg/torture/pr60115.c
new file mode 100644
index 00000000000..cf7f45dfb06
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr60115.c
@@ -0,0 +1,14 @@
+/* { dg-do run } */
+
+int a, b[2];
+
+int
+main ()
+{
+lbl:
+ for (; a; a--)
+ if (b[10000])
+ goto lbl;
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr60183.c b/gcc/testsuite/gcc.dg/torture/pr60183.c
new file mode 100644
index 00000000000..d37b4b80aba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr60183.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+
+/* Large so an out-of-bound read will crash. */
+unsigned char c[0x30001] = { 1 };
+int j = 2;
+
+static void
+foo (unsigned long *x, unsigned char *y)
+{
+ int i;
+ unsigned long w = x[0];
+ for (i = 0; i < j; i++)
+ {
+ w += *y;
+ y += 0x10000;
+ w += *y;
+ y += 0x10000;
+ }
+ x[1] = w;
+}
+
+__attribute__ ((noinline, noclone)) void
+bar (unsigned long *x)
+{
+ foo (x, c);
+}
+
+int
+main ()
+{
+ unsigned long a[2] = { 0, -1UL };
+ asm volatile (""::"r" (c):"memory");
+ c[0] = 0;
+ bar (a);
+ if (a[1] != 0)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/vect/pr60276.c b/gcc/testsuite/gcc.dg/vect/pr60276.c
new file mode 100644
index 00000000000..d4ad2198062
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr60276.c
@@ -0,0 +1,52 @@
+/* { dg-do run } */
+
+extern void abort (void);
+
+static void
+foo (int *out, const int *lp, unsigned samples)
+{
+ int x, target;
+ for (x = 0, target = 0; x < (int)samples; x += 2, target++)
+ {
+ out[x] = lp[target];
+ out[x - 1] = out[x - 2] + out[x];
+ }
+}
+
+static void
+foo_novec (int *out, const int *lp, unsigned samples)
+{
+ int x, target;
+ for (x = 0, target = 0; x < (int)samples; x += 2, target++)
+ {
+ out[x] = lp[target];
+ out[x - 1] = out[x - 2] + out[x];
+ __asm__ volatile ("" : : : "memory");
+ }
+}
+
+int main(void)
+{
+ const int lp[25] = {
+ 0, 2, 4, 6, 8,
+ 10, 12, 14, 16,
+ 18, 20, 22, 24,
+ 26, 28, 30, 32,
+ 34, 36, 38, 40,
+ 42, 44, 46, 48,
+ };
+ int out[49] = {0};
+ int out2[49] = {0};
+ int s;
+
+ foo (out + 2, lp + 1, 48);
+ foo_novec (out2 + 2, lp + 1, 48);
+
+ for (s = 0; s < 49; s++)
+ if (out[s] != out2[s])
+ abort ();
+
+ return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/gcc.target/i386/nest-1.c b/gcc/testsuite/gcc.target/i386/nest-1.c
new file mode 100644
index 00000000000..ba75350fb0b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/nest-1.c
@@ -0,0 +1,14 @@
+/* { dg-do compile { target llp64 } } */
+/* { dg-options "" } */
+
+void foo (int i)
+{
+ void nested (void)
+ {
+ char arr[(1U << 31) + 4U];
+ arr[i] = 0;
+ }
+
+ nested ();
+}
+
diff --git a/gcc/testsuite/gcc.target/i386/pr39162.c b/gcc/testsuite/gcc.target/i386/pr39162.c
index 94f39107db6..efb46deae7c 100644
--- a/gcc/testsuite/gcc.target/i386/pr39162.c
+++ b/gcc/testsuite/gcc.target/i386/pr39162.c
@@ -1,5 +1,6 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -Wno-psabi -msse2 -mno-avx" } */
+/* { dg-prune-output "ABI for passing parameters" } */
+/* { dg-options "-O2 -msse2 -mno-avx" } */
/* { dg-additional-options "-mabi=sysv" { target x86_64-*-mingw* } } */
typedef long long __m256i __attribute__ ((__vector_size__ (32), __may_alias__));
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-1.c b/gcc/testsuite/gcc.target/i386/pr59794-1.c
new file mode 100644
index 00000000000..46bff01817c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-1.c
@@ -0,0 +1,15 @@
+/* PR target/59794 */
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -mno-mmx" } */
+/* { dg-skip-if "no MMX vector" { *-*-mingw* } } */
+
+typedef int __v2si __attribute__ ((__vector_size__ (8)));
+
+extern __v2si x;
+
+extern void bar (__v2si);
+void
+foo (void)
+{
+ bar (x); /* { dg-message "warning: MMX vector argument without MMX enabled changes the ABI" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-2.c b/gcc/testsuite/gcc.target/i386/pr59794-2.c
new file mode 100644
index 00000000000..f13998214e3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-2.c
@@ -0,0 +1,15 @@
+/* PR target/59794 */
+/* { dg-prune-output "ABI for passing parameters" } */
+/* { dg-options "-O2 -mno-sse" } */
+/* { dg-skip-if "no SSE vector" { *-*-mingw* } } */
+
+typedef double __v2df __attribute__ ((__vector_size__ (16)));
+
+extern __v2df x;
+
+extern void bar (__v2df);
+void
+foo (void)
+{
+ bar (x); /* { dg-message "warning: SSE vector argument without SSE enabled changes the ABI" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-3.c b/gcc/testsuite/gcc.target/i386/pr59794-3.c
new file mode 100644
index 00000000000..a65893c63b7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-3.c
@@ -0,0 +1,15 @@
+/* PR target/59794 */
+/* { dg-prune-output "ABI for passing parameters" } */
+/* { dg-options "-O2 -mno-avx" } */
+/* { dg-skip-if "no AVX vector" { *-*-mingw* } } */
+
+typedef int __v8si __attribute__ ((__vector_size__ (32)));
+
+extern __v8si x;
+
+extern void bar (__v8si);
+void
+foo (void)
+{
+ bar (x); /* { dg-message "warning: AVX vector argument without AVX enabled changes the ABI" } */
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-4.c b/gcc/testsuite/gcc.target/i386/pr59794-4.c
new file mode 100644
index 00000000000..5ad0b070ad2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-4.c
@@ -0,0 +1,14 @@
+/* PR target/59794 */
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -mno-mmx" } */
+/* { dg-skip-if "no MMX vector" { *-*-mingw* } } */
+
+typedef int __v2si __attribute__ ((__vector_size__ (8)));
+
+extern __v2si x;
+
+__v2si
+foo (void)
+{ /* { dg-warning "MMX vector return without MMX enabled changes the ABI" } */
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-5.c b/gcc/testsuite/gcc.target/i386/pr59794-5.c
new file mode 100644
index 00000000000..24c88be0944
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-5.c
@@ -0,0 +1,14 @@
+/* PR target/59794 */
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -mno-sse" } */
+/* { dg-skip-if "no SSE vector" { *-*-mingw* } } */
+
+typedef int __v4si __attribute__ ((__vector_size__ (16)));
+
+extern __v4si x;
+
+__v4si
+foo (void)
+{ /* { dg-warning "SSE vector return without SSE enabled changes the ABI" } */
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-6.c b/gcc/testsuite/gcc.target/i386/pr59794-6.c
new file mode 100644
index 00000000000..c809f957927
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-6.c
@@ -0,0 +1,14 @@
+/* PR target/59794 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-sse" } */
+/* { dg-skip-if "no SSE vector" { *-*-mingw* } } */
+
+typedef int __v4si __attribute__ ((__vector_size__ (16)));
+
+extern __v4si x;
+
+__v4si
+foo (void)
+{ /* { dg-error "SSE register return with SSE disabled" } */
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr59794-7.c b/gcc/testsuite/gcc.target/i386/pr59794-7.c
new file mode 100644
index 00000000000..57fd3d276a0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr59794-7.c
@@ -0,0 +1,13 @@
+/* PR target/59794 */
+/* { dg-options "-O2 -mno-avx" } */
+/* { dg-skip-if "no AVX vector" { *-*-mingw* } } */
+
+typedef int __v8si __attribute__ ((__vector_size__ (32)));
+
+extern __v8si x;
+
+__v8si
+foo (void)
+{ /* { dg-warning "AVX vector return without AVX enabled changes the ABI" } */
+ return x;
+}
diff --git a/gcc/testsuite/gcc.target/i386/sse-5.c b/gcc/testsuite/gcc.target/i386/sse-5.c
index af935c2f005..8f5d9bc2448 100644
--- a/gcc/testsuite/gcc.target/i386/sse-5.c
+++ b/gcc/testsuite/gcc.target/i386/sse-5.c
@@ -1,6 +1,7 @@
/* { dg-do compile } */
/* { dg-require-effective-target ia32 } */
-/* { dg-options "-Winline -Wno-psabi -O2 -mno-sse" } */
+/* { dg-prune-output "ABI for passing parameters" } */
+/* { dg-options "-Winline -O2 -mno-sse" } */
typedef double v2df __attribute__ ((vector_size (16)));
v2df p;
diff --git a/gcc/testsuite/gcc.target/microblaze/others/mem_reload.c b/gcc/testsuite/gcc.target/microblaze/others/mem_reload.c
new file mode 100644
index 00000000000..e285fb8212a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/microblaze/others/mem_reload.c
@@ -0,0 +1,74 @@
+/* { dg-options "-O2 -fPIC" } */
+
+typedef struct test_struct
+{
+ unsigned long long h[8];
+ unsigned long long Nl,Nh;
+ union {
+ unsigned long long d[16];
+ unsigned char p[(16*8)];
+ } u;
+ unsigned int num,md_len;
+} TEST_STRUCT;
+
+static const unsigned long long K512[12] = {
+ 0x428a2f98d728ae22,0x7137449123ef65cd,
+ 0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc,
+ 0x3956c25bf348b538,0x59f111f1b605d019,
+ 0x923f82a4af194f9b,0xab1c5ed5da6d8118,
+ 0xd807aa98a3030242,0x12835b0145706fbe,
+ 0x243185be4ee4b28c,0x550c7dc3d5ffb4e2};
+
+#define ROTR(x,s) (((x)>>s) | (x)<<(64-s))
+#define Sigma0(x) (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
+#define Sigma1(x) (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
+#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z)))
+#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
+
+#define ROUND_00_15(i,a,b,c,d,e,f,g,h) do { \
+ T1 += h + Sigma1(e) + Ch(e,f,g) + K512[i]; \
+ h = Sigma0(a) + Maj(a,b,c); \
+ d += T1; h += T1; } while (0)
+
+#define ROUND_16_80(i,a,b,c,d,e,f,g,h,X) do { \
+ T1 = X[(i)&0x0f] += s0 + s1 + X[(i+9)&0x0f]; \
+ ROUND_00_15(i,a,b,c,d,e,f,g,h); } while (0)
+
+static void testfunc1 (TEST_STRUCT *ctx, const void *in, unsigned int num)
+{
+ const unsigned long long *W=in;
+ unsigned long long a,b,c,d,e,f,g,h,s0,s1,T1;
+ unsigned long long X[16];
+ int i;
+
+ while (num--) {
+
+ T1 = X[0] = W[0]; ROUND_00_15(0,a,b,c,d,e,f,g,h);
+ T1 = X[1] = W[1]; ROUND_00_15(1,h,a,b,c,d,e,f,g);
+ T1 = X[2] = W[2]; ROUND_00_15(2,g,h,a,b,c,d,e,f);
+ T1 = X[3] = W[3]; ROUND_00_15(3,f,g,h,a,b,c,d,e);
+ T1 = X[4] = W[4]; ROUND_00_15(4,e,f,g,h,a,b,c,d);
+ T1 = X[5] = W[5]; ROUND_00_15(5,d,e,f,g,h,a,b,c);
+ T1 = X[6] = W[6]; ROUND_00_15(6,c,d,e,f,g,h,a,b);
+ T1 = X[7] = W[7]; ROUND_00_15(7,b,c,d,e,f,g,h,a);
+ T1 = X[8] = W[8]; ROUND_00_15(8,a,b,c,d,e,f,g,h);
+ T1 = X[9] = W[9]; ROUND_00_15(9,h,a,b,c,d,e,f,g);
+
+ for (i=16;i<80;i+=8)
+ {
+ ROUND_16_80(i+0,a,b,c,d,e,f,g,h,X);
+ }
+
+ ctx->h[4] += e; ctx->h[5] += f; ctx->h[6] += g; ctx->h[7] += h;
+ }
+}
+
+int testfunc2 (TEST_STRUCT *c, const void *_data, unsigned int len)
+{
+ const unsigned char *data=(const unsigned char *)_data;
+
+ unsigned char *p=(unsigned char *)c->u.p;
+
+ testfunc1 (c,p,0);
+ testfunc1 (c,data,len/sizeof(c->u));
+}
diff --git a/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c b/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c
new file mode 100644
index 00000000000..489fc5dd9f0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/hotpatch-compile-8.c
@@ -0,0 +1,23 @@
+/* Functional tests for the function hotpatching feature. */
+
+/* { dg-do run } */
+/* { dg-options "-O3 -mzarch -mhotpatch" } */
+
+#include <stdio.h>
+
+int hp1(void)
+{
+ int nested1(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
+ { return 1; }
+
+ __attribute__ ((hotpatch))
+ int nested2(void) /* { dg-warning "hotpatching is not compatible with nested functions" } */
+ { return 1; }
+
+ return nested1() - nested2();
+}
+
+int main (void)
+{
+ return hp1();
+}
diff --git a/gcc/testsuite/gfortran.dg/default_initialization_7.f90 b/gcc/testsuite/gfortran.dg/default_initialization_7.f90
new file mode 100644
index 00000000000..fc8be98b113
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/default_initialization_7.f90
@@ -0,0 +1,22 @@
+! { dg-do compile }
+!
+! PR fortran/57033
+! ICE on a structure constructor of an extended derived type whose parent
+! type last component has a default initializer
+!
+! Contributed by Tilo Schwarz <tilo@tilo-schwarz.de>
+
+program ice
+
+type m
+ integer i
+ logical :: f = .false.
+end type m
+
+type, extends(m) :: me
+end type me
+
+type(me) meo
+
+meo = me(1) ! ICE
+end program ice
diff --git a/gcc/testsuite/gfortran.dg/elemental_subroutine_9.f90 b/gcc/testsuite/gfortran.dg/elemental_subroutine_9.f90
new file mode 100644
index 00000000000..8f574bf595e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/elemental_subroutine_9.f90
@@ -0,0 +1,39 @@
+! { dg-do run }
+!
+! PR fortran/59906
+!
+! Contributed by H Anlauf <anlauf@gmx.de>
+!
+! Failed generate character scalar for scalarized loop for elemantal call.
+!
+program x
+ implicit none
+ call y('bbb')
+contains
+
+ subroutine y(str)
+ character(len=*), intent(in) :: str
+ character(len=len_trim(str)) :: str_aux
+ character(len=3) :: str3 = 'abc'
+
+ str_aux = str
+
+ ! Compiled but did not give correct result
+ if (any (str_cmp((/'aaa','bbb'/), str) .neqv. [.FALSE.,.TRUE.])) call abort
+
+ ! Did not compile
+ if (any (str_cmp((/'bbb', 'aaa'/), str_aux) .neqv. [.TRUE.,.FALSE.])) call abort
+
+ ! Verify patch
+ if (any (str_cmp((/'bbb', 'aaa'/), str3) .neqv. [.FALSE.,.FALSE.])) call abort
+ if (any (str_cmp((/'bbb', 'aaa'/), 'aaa') .neqv. [.FALSE.,.TRUE.])) call abort
+
+ end subroutine y
+
+ elemental logical function str_cmp(str1, str2)
+ character(len=*), intent(in) :: str1
+ character(len=*), intent(in) :: str2
+ str_cmp = (str1 == str2)
+ end function str_cmp
+
+end program x
diff --git a/gcc/testsuite/gfortran.dg/fmt_g_1.f90 b/gcc/testsuite/gfortran.dg/fmt_g_1.f90
new file mode 100644
index 00000000000..715df0dfc09
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/fmt_g_1.f90
@@ -0,0 +1,11 @@
+! { dg-do run }
+! PR59771 Cleanup handling of Gw.0 and Gw.0Ee format
+! Test case prepared by Dominique d'Humieres <dominiq@lps.ens.fr>
+ PROGRAM FOO
+ character(len=60) :: buffer, buffer1
+
+ write (buffer ,'(6(1X,1PG9.0e2))') 0.0, 0.04, 0.06, 0.4, 0.6, 243.0
+ write (buffer1,'(6(1X,1PE9.0e2))') 0.0, 0.04, 0.06, 0.4, 0.6, 243.0
+
+ if (buffer /= buffer1) call abort
+ end
diff --git a/gcc/testsuite/gfortran.dg/ichar_3.f90 b/gcc/testsuite/gfortran.dg/ichar_3.f90
new file mode 100644
index 00000000000..d0f5c8b8cf8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/ichar_3.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+!
+! PR fortran/59599
+! The call to ichar was triggering an ICE.
+!
+! Original testcase from Fran Martinez Fadrique <fmartinez@gmv.com>
+
+character(1) cpk(2)
+integer res(2)
+cpk = 'a'
+res = ichar( cpk, kind=1 )
+print *, ichar( cpk, kind=1 )
+end
diff --git a/gcc/testsuite/gfortran.dg/init_flag_12.f90 b/gcc/testsuite/gfortran.dg/init_flag_12.f90
new file mode 100644
index 00000000000..5844398d534
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/init_flag_12.f90
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-options "-fno-automatic -finit-local-zero" }
+!
+! PR 55907: [4.7/4.8/4.9 Regression] ICE with -fno-automatic -finit-local-zero
+!
+! Contributed by J.R. Garcia <garcia.espinosa.jr@gmail.com>
+
+subroutine cchaine (i)
+ implicit none
+ integer :: i
+ character(len=i) :: chaine
+ write(*,*) chaine
+end subroutine
diff --git a/gcc/testsuite/gfortran.dg/pr59700.f90 b/gcc/testsuite/gfortran.dg/pr59700.f90
new file mode 100644
index 00000000000..579d8a48c9a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr59700.f90
@@ -0,0 +1,40 @@
+! { dg-do run }
+! PR59700 Test case by Steve Kargl
+program foo
+
+ implicit none
+
+ character(len=80) msg
+ integer, parameter :: fd = 10
+ integer i1, i2, i3, i4
+ real x1, x2, x3, x4
+ complex c1, c2
+ logical a
+
+ open(unit=fd, status='scratch')
+ write(fd, '(A)') '1 2 3.4 q'
+
+ rewind(fd)
+ msg = 'ok'
+ read(fd, *, err=10, iomsg=msg) i1, i2, i3, i4
+10 if (msg /= 'Bad integer for item 3 in list input') call abort
+ rewind(fd)
+ msg = 'ok'
+ read(fd, *, err=20, iomsg=msg) x1, x2, x3, x4
+20 if (msg /= 'Bad real number in item 4 of list input') call abort
+ rewind(fd)
+ msg = 'ok'
+ read(fd, *, err=30, iomsg=msg) i1, x2, x1, a
+30 if (msg /= 'Bad logical value while reading item 4') call abort
+ rewind(fd)
+ read(fd, *, err=31, iomsg=msg) i1, x2, a, x1
+31 if (msg /= 'Bad repeat count in item 3 of list input') call abort
+ close(fd)
+ open(unit=fd, status='scratch')
+ write(fd, '(A)') '(1, 2) (3.4, q)'
+ rewind(fd)
+ msg = 'ok'
+ read(fd, *, err=40, iomsg=msg) c1, c2
+40 if (msg /= 'Bad floating point number for item 2') call abort
+ close(fd)
+end program foo
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_45.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_45.f90
new file mode 100644
index 00000000000..a506473ad95
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_45.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+!
+! PR fortran/49397
+!
+! Valid per IR F08/0060 and F2008Corr2, C729
+!
+Program m5
+ Print *,f()
+Contains
+ Subroutine s
+ Procedure(Real),Pointer :: p
+ Print *,g()
+ p => f ! (1)
+ Print *,p()
+ p => g ! (2)
+ Print *,p()
+ End Subroutine
+End Program
+Function f()
+ f = 1
+End Function
+Function g()
+ g = 2
+End Function
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_46.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_46.f90
new file mode 100644
index 00000000000..2c05f59d8a1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_46.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR fortran/49397
+!
+! Invalid per IR F08/0060 and F2008Corr2, C729
+!
+
+! Print *,f() ! << Valid when uncommented
+Contains
+ Subroutine s
+ Procedure(Real),Pointer :: p
+ p => f ! { dg-error "Procedure pointer target 'f' at .1. must be either an intrinsic, host or use associated, referenced or have the EXTERNAL attribute" }
+ End Subroutine
+End
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90
new file mode 100644
index 00000000000..2a71ca052cd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_38.f90
@@ -0,0 +1,12 @@
+! { dg-do compile }
+!
+! PR fortran/58803
+!
+! Contributed by Vittorio Zecca
+!
+! Was before ICEing due to a double free
+!
+ type t
+ procedure(real), pointer, nopass :: f1, f2
+ end type
+ end
diff --git a/gcc/testsuite/gfortran.dg/round_3.f08 b/gcc/testsuite/gfortran.dg/round_3.f08
index 8b03ce562f1..2bb36d9eeef 100644
--- a/gcc/testsuite/gfortran.dg/round_3.f08
+++ b/gcc/testsuite/gfortran.dg/round_3.f08
@@ -16,19 +16,44 @@ program pr48615
call checkfmt("(RU,1P,G6.0E2)", 2.0, "2.E+00")
call checkfmt("(RU,1P,G10.4E2)", 2.3456e5, "2.3456E+05")
- call checkfmt("(RU,F2.0)", 0.09, "1.") ! 0.
+ call checkfmt("(RC,G10.2)", 99.5, " 0.10E+03") ! pr59774
+ call checkfmt("(RC,G10.2)", 995., " 0.10E+04") ! pr59774
+ call checkfmt("(RC,G10.3)", 999.5, " 0.100E+04") ! pr59774
+ call checkfmt("(RC,G10.3)", 9995., " 0.100E+05") ! pr59774
+ call checkfmt("(RU,G10.2)", .099, " 0.10 ") ! pr59774
+ call checkfmt("(RC,G10.1)", .095, " 0.1 ") ! pr59774
+ call checkfmt("(RU,G10.3)", .0999, " 0.100 ") ! pr59774
+ call checkfmt("(RC,G10.2)", .0995, " 0.10 ") ! pr59774
+
+ call checkfmt("(RU,G9.3)", 891.1, " 892.") ! pr59836
+ call checkfmt("(RD,G9.3)", -891.1, "-892.") ! pr59836
+
+ call checkfmt("(RU,F6.4)", 0.00006, "0.0001")! 0.
+ call checkfmt("(RU,F5.3)", 0.0007, "0.001") ! 0.
+ call checkfmt("(RU,F4.2)", 0.008, "0.01") ! 0.
+ call checkfmt("(RU,F3.1)", 0.09, "0.1") ! 0.
+
+ call checkfmt("(RU,F2.0)", 0.09, "1.") ! 0.
call checkfmt("(RD,F3.0)", -0.09, "-1.") ! -0.
- call checkfmt("(RU,F2.0)", 2.0, "2.") ! 3.
- call checkfmt("(RD,F3.0)", -2.0, "-2.") ! -3.
- call checkfmt("(RU,F6.4)", 2.0, "2.0000") ! 2.0001
- call checkfmt("(RD,F7.4)", -2.0, "-2.0000") ! -2.0001
- call checkfmt("(RU,1P,E6.0E2)", 2.0, "2.E+00") ! 3.E+00
+ call checkfmt("(RU,F2.0)", 0.9, "1.") ! pr59836
+ call checkfmt("(RC,F2.0)", 0.4, "0.") ! pr59836
+ call checkfmt("(RC,F2.0)", 0.5, "1.") ! pr59836
+ call checkfmt("(RC,F2.0)", 0.6, "1.") ! pr59836
+ call checkfmt("(RD,F3.0)", -0.9, "-1.") ! pr59836
+ call checkfmt("(RC,F3.0)", -0.4, "-0.") ! pr59836
+ call checkfmt("(RC,F3.0)", -0.5, "-1.") ! pr59836
+ call checkfmt("(RC,F3.0)", -0.6, "-1.") ! pr59836
+ call checkfmt("(RU,F2.0)", 2.0, "2.") ! 3.
+ call checkfmt("(RD,F3.0)", -2.0, "-2.") ! -3.
+ call checkfmt("(RU,F6.4)", 2.0, "2.0000") ! 2.0001
+ call checkfmt("(RD,F7.4)", -2.0, "-2.0000") ! -2.0001
+ call checkfmt("(RU,1P,E6.0E2)", 2.0, "2.E+00") ! 3.E+00
call checkfmt("(RD,1P,E7.0E2)", -2.0, "-2.E+00") ! -3.E+00
- call checkfmt("(RU,1P,E7.1E2)", 2.5, "2.5E+00") ! 2.6E+00
+ call checkfmt("(RU,1P,E7.1E2)", 2.5, "2.5E+00") ! 2.6E+00
call checkfmt("(RD,1P,E8.1E2)", -2.5, "-2.5E+00") ! -2.6E+00
call checkfmt("(RU,1P,E10.4E2)", 2.5, "2.5000E+00") ! 2.5001E+00
call checkfmt("(RD,1P,E11.4E2)", -2.5, "-2.5000E+00") ! -2.5001E+00
- call checkfmt("(RU,1P,G6.0E2)", 2.0, "2.E+00") ! 3.E+00
+ call checkfmt("(RU,1P,G6.0E2)", 2.0, "2.E+00") ! 3.E+00
call checkfmt("(RD,1P,G7.0E2)", -2.0, "-2.E+00") ! -3.E+00
call checkfmt("(RU,1P,G10.4E2)", 2.3456e5, "2.3456E+05") ! 2.3457E+05
call checkfmt("(RD,1P,G11.4E2)", -2.3456e5, "-2.3456E+05") ! -2.3457E+05
diff --git a/gcc/testsuite/gfortran.dg/str_comp_optimize_1.f90 b/gcc/testsuite/gfortran.dg/str_comp_optimize_1.f90
new file mode 100644
index 00000000000..84287b475a5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/str_comp_optimize_1.f90
@@ -0,0 +1,22 @@
+! { dg-do compile }
+! { dg-options "-ffrontend-optimize" }
+!
+! PR fortran/60341
+! An unguarded union access was wrongly enabling a frontend optimization on a
+! string comparison, leading to an ICE.
+!
+! Original testcase from Steve Chapel <steve.chapel@a2pg.com>.
+! Reduced by Steven G. Kargl <kargl@gcc.gnu.org>.
+!
+
+ subroutine modelg(ncm)
+ implicit none
+ integer, parameter :: pc = 30, pm = pc - 1
+ integer i
+ character*4 catt(pm,2)
+ integer ncm,iatt(pm,pc)
+ do i=1,ncm
+ if (catt(i,1)//catt(i,2).eq.'central') exit
+ end do
+ iatt(i,4)=1
+ end
diff --git a/gcc/testsuite/gfortran.dg/typebound_generic_15.f90 b/gcc/testsuite/gfortran.dg/typebound_generic_15.f90
new file mode 100644
index 00000000000..f71ffd9e8a7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_generic_15.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+!
+! PR 60231: [4.8/4.9 Regression] ICE on undefined generic
+!
+! Contributed by Antony Lewis <antony@cosmologist.info>
+
+module Objects
+
+ Type TObjectList
+ contains
+ procedure :: Add1 ! { dg-error "must be a module procedure" }
+ procedure :: Add2 ! { dg-error "must be a module procedure" }
+ generic :: Add => Add1, Add2 ! { dg-error "are ambiguous" }
+ end Type
+
+end module
+
+! { dg-final { cleanup-modules "Objects" } }
diff --git a/gcc/testsuite/gnat.dg/opt32.adb b/gcc/testsuite/gnat.dg/opt32.adb
new file mode 100644
index 00000000000..93f31c2ca52
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/opt32.adb
@@ -0,0 +1,37 @@
+-- { dg-do compile }
+-- { dg-options "-O2" }
+
+with Ada.Containers; use Ada.Containers;
+with Ada.Containers.Vectors;
+
+function Opt32 return Natural is
+
+ package My_Vectors
+ is new Vectors (Index_Type => Natural, Element_Type => Integer);
+ use My_Vectors;
+
+ V : Vector;
+
+ function Sign_Changes return Natural is
+ Cur : Cursor := To_Cursor (V, 0);
+ R : Natural := 0;
+ Negative : Boolean;
+ begin
+ Negative := Element (Cur) < 0;
+
+ loop
+ Cur := Next (Cur);
+ exit when R > 100;
+
+ if (Element (Cur) < 0) /= Negative then
+ Negative := not Negative;
+ R := R + 1;
+ end if;
+ end loop;
+
+ return R;
+ end;
+
+begin
+ return Sign_Changes;
+end;
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f65d8734aaa..b32da2ef6fe 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1534,6 +1534,11 @@ replace_uses_by (tree name, tree val)
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, name)
{
+ /* Mark the block if we change the last stmt in it. */
+ if (cfgcleanup_altered_bbs
+ && stmt_ends_bb_p (stmt))
+ bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index);
+
FOR_EACH_IMM_USE_ON_STMT (use, imm_iter)
{
replace_exp (use, val);
@@ -1558,11 +1563,6 @@ replace_uses_by (tree name, tree val)
gimple orig_stmt = stmt;
size_t i;
- /* Mark the block if we changed the last stmt in it. */
- if (cfgcleanup_altered_bbs
- && stmt_ends_bb_p (stmt))
- bitmap_set_bit (cfgcleanup_altered_bbs, gimple_bb (stmt)->index);
-
/* FIXME. It shouldn't be required to keep TREE_CONSTANT
on ADDR_EXPRs up-to-date on GIMPLE. Propagation will
only change sth from non-invariant to invariant, and only
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 41b55acbc77..87fea6d07cf 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2500,12 +2500,6 @@ tree_could_trap_p (tree expr)
restart:
switch (code)
{
- case TARGET_MEM_REF:
- if (TREE_CODE (TMR_BASE (expr)) == ADDR_EXPR
- && !TMR_INDEX (expr) && !TMR_INDEX2 (expr))
- return false;
- return !TREE_THIS_NOTRAP (expr);
-
case COMPONENT_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
@@ -2532,10 +2526,36 @@ tree_could_trap_p (tree expr)
return false;
return !in_array_bounds_p (expr);
+ case TARGET_MEM_REF:
case MEM_REF:
- if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR)
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR
+ && tree_could_trap_p (TREE_OPERAND (TREE_OPERAND (expr, 0), 0)))
+ return true;
+ if (TREE_THIS_NOTRAP (expr))
return false;
- /* Fallthru. */
+ /* We cannot prove that the access is in-bounds when we have
+ variable-index TARGET_MEM_REFs. */
+ if (code == TARGET_MEM_REF
+ && (TMR_INDEX (expr) || TMR_INDEX2 (expr)))
+ return true;
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR)
+ {
+ tree base = TREE_OPERAND (TREE_OPERAND (expr, 0), 0);
+ double_int off = mem_ref_offset (expr);
+ if (off.is_negative ())
+ return true;
+ if (TREE_CODE (base) == STRING_CST)
+ return double_int::from_uhwi (TREE_STRING_LENGTH (base)).ule (off);
+ else if (DECL_SIZE_UNIT (base) == NULL_TREE
+ || TREE_CODE (DECL_SIZE_UNIT (base)) != INTEGER_CST
+ || tree_to_double_int (DECL_SIZE_UNIT (base)).ule (off))
+ return true;
+ /* Now we are sure the first byte of the access is inside
+ the object. */
+ return false;
+ }
+ return true;
+
case INDIRECT_REF:
return !TREE_THIS_NOTRAP (expr);
@@ -4302,11 +4322,12 @@ execute_cleanup_eh_1 (void)
remove_unreachable_handlers ();
/* Watch out for the region tree vanishing due to all unreachable. */
- if (cfun->eh->region_tree && optimize)
+ if (cfun->eh->region_tree)
{
bool changed = false;
- changed |= unsplit_all_eh ();
+ if (optimize)
+ changed |= unsplit_all_eh ();
changed |= cleanup_all_empty_eh ();
if (changed)
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 27aed49d137..8794569acfa 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -398,7 +398,8 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
/* When a global var becomes used for the first time also walk its
initializer (non global ones don't have any). */
- if (set_is_used (t) && is_global_var (t))
+ if (set_is_used (t) && is_global_var (t)
+ && DECL_CONTEXT (t) == current_function_decl)
mark_all_vars_used (&DECL_INITIAL (t));
}
/* remove_unused_scope_block_p requires information about labels
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index 4da18148782..36b47d7f0d5 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -307,6 +307,12 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
gimple def_stmt;
tree vuse;
+ /* Only replace loads in blocks that post-dominate the PHI node. That
+ makes sure we don't end up speculating loads. */
+ if (!dominated_by_p (CDI_POST_DOMINATORS,
+ bb, gimple_bb (use_stmt)))
+ continue;
+
/* Check whether this is a load of *ptr. */
if (!(is_gimple_assign (use_stmt)
&& TREE_CODE (gimple_assign_lhs (use_stmt)) == SSA_NAME
@@ -378,6 +384,7 @@ tree_ssa_phiprop (void)
size_t n;
calculate_dominance_info (CDI_DOMINATORS);
+ calculate_dominance_info (CDI_POST_DOMINATORS);
n = num_ssa_names;
phivn = XCNEWVEC (struct phiprop_d, n);
@@ -395,6 +402,8 @@ tree_ssa_phiprop (void)
bbs.release ();
free (phivn);
+ free_dominance_info (CDI_POST_DOMINATORS);
+
return 0;
}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 1780758386d..856a383a183 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -739,6 +739,13 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"dependence distance negative.");
+ /* Record a negative dependence distance to later limit the
+ amount of stmt copying / unrolling we can perform.
+ Only need to handle read-after-write dependence. */
+ if (DR_IS_READ (drb)
+ && (STMT_VINFO_MIN_NEG_DIST (stmtinfo_b) == 0
+ || STMT_VINFO_MIN_NEG_DIST (stmtinfo_b) > dist))
+ STMT_VINFO_MIN_NEG_DIST (stmtinfo_b) = dist;
continue;
}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index c12004d2ce8..19d29d53b91 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -5568,8 +5568,9 @@ vect_transform_loop (loop_vec_info loop_vinfo)
&& !STMT_VINFO_LIVE_P (stmt_info))
continue;
- if ((TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info))
- != (unsigned HOST_WIDE_INT) vectorization_factor)
+ if (STMT_VINFO_VECTYPE (stmt_info)
+ && (TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info))
+ != (unsigned HOST_WIDE_INT) vectorization_factor)
&& dump_enabled_p ())
dump_printf_loc (MSG_NOTE, vect_location, "multiple-types.");
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 96dd191691b..361c312d891 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -4369,6 +4369,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
return false;
}
+ /* Invalidate assumptions made by dependence analysis when vectorization
+ on the unrolled body effectively re-orders stmts. */
+ if (ncopies > 1
+ && STMT_VINFO_MIN_NEG_DIST (stmt_info) != 0
+ && ((unsigned)LOOP_VINFO_VECT_FACTOR (loop_vinfo)
+ > STMT_VINFO_MIN_NEG_DIST (stmt_info)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "cannot perform implicit CSE when unrolling "
+ "with negative dependence distance\n");
+ return false;
+ }
+
if (!STMT_VINFO_RELEVANT_P (stmt_info) && !bb_vinfo)
return false;
@@ -4425,6 +4439,20 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
else if (!vect_grouped_load_supported (vectype, group_size))
return false;
}
+
+ /* Invalidate assumptions made by dependence analysis when vectorization
+ on the unrolled body effectively re-orders stmts. */
+ if (!PURE_SLP_STMT (stmt_info)
+ && STMT_VINFO_MIN_NEG_DIST (stmt_info) != 0
+ && ((unsigned)LOOP_VINFO_VECT_FACTOR (loop_vinfo)
+ > STMT_VINFO_MIN_NEG_DIST (stmt_info)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "cannot perform implicit CSE when performing "
+ "group loads with negative dependence distance\n");
+ return false;
+ }
}
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 2334fdfa7a9..7807ed7afb0 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -542,6 +542,10 @@ typedef struct _stmt_vec_info {
is 1. */
unsigned int gap;
+ /* The minimum negative dependence distance this stmt participates in
+ or zero if none. */
+ unsigned int min_neg_dist;
+
/* Not all stmts in the loop need to be vectorized. e.g, the increment
of the loop induction variable and computation of array indexes. relevant
indicates whether the stmt needs to be vectorized. */
@@ -593,6 +597,7 @@ typedef struct _stmt_vec_info {
#define STMT_VINFO_GROUP_READ_WRITE_DEPENDENCE(S) (S)->read_write_dep
#define STMT_VINFO_GROUPED_ACCESS(S) ((S)->first_element != NULL && (S)->data_ref_info)
#define STMT_VINFO_LOOP_PHI_EVOLUTION_PART(S) (S)->loop_phi_evolution_part
+#define STMT_VINFO_MIN_NEG_DIST(S) (S)->min_neg_dist
#define GROUP_FIRST_ELEMENT(S) (S)->first_element
#define GROUP_NEXT_ELEMENT(S) (S)->next_element
diff --git a/libatomic/ChangeLog b/libatomic/ChangeLog
index b4492695bcf..de450dca4b1 100644
--- a/libatomic/ChangeLog
+++ b/libatomic/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-20 Richard Henderson <rth@redhat.com>
+
+ PR c++/60272
+ * cas_n.c (libat_compare_exchange): Conditionalize on failure
+ the store back to EPTR.
+
2013-10-16 Release Manager
* GCC 4.8.2 released.
diff --git a/libatomic/cas_n.c b/libatomic/cas_n.c
index a4702683899..fa5c0ada8c9 100644
--- a/libatomic/cas_n.c
+++ b/libatomic/cas_n.c
@@ -51,10 +51,9 @@ SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
#if !DONE && N <= WORDSIZE && defined(atomic_compare_exchange_w)
bool
SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
- int smodel, int fmodel UNUSED)
+ int smodel, int fmodel)
{
UWORD mask, shift, weval, woldval, wnewval, t, *wptr;
- bool ret = false;
pre_barrier (smodel);
@@ -82,12 +81,13 @@ SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
}
while (!atomic_compare_exchange_w (wptr, &woldval, t, true,
__ATOMIC_RELAXED, __ATOMIC_RELAXED));
- ret = true;
+ post_barrier (smodel);
+ return true;
+
failure:
*eptr = woldval >> shift;
-
- post_barrier (smodel);
- return ret;
+ post_barrier (fmodel);
+ return false;
}
#define DONE 1
@@ -102,18 +102,17 @@ SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
{
UTYPE oldval;
UWORD magic;
- bool ret = false;
+ bool ret;
pre_seq_barrier (smodel);
magic = protect_start (mptr);
oldval = *mptr;
- if (oldval == *eptr)
- {
- *mptr = newval;
- ret = true;
- }
- *eptr = oldval;
+ ret = (oldval == *eptr);
+ if (ret)
+ *mptr = newval;
+ else
+ *eptr = oldval;
protect_end (mptr, magic);
post_seq_barrier (smodel);
diff --git a/libbacktrace/ChangeLog b/libbacktrace/ChangeLog
index 8b35507a152..f27cd404384 100644
--- a/libbacktrace/ChangeLog
+++ b/libbacktrace/ChangeLog
@@ -1,3 +1,10 @@
+2014-02-07 Misty De Meo <misty@brew.sh>
+
+ PR target/58710
+ * configure.ac: Use AC_LINK_IFELSE in check for
+ _Unwind_GetIPInfo.
+ * configure: Regenerate.
+
2013-12-05 Ian Lance Taylor <iant@google.com>
* alloc.c (backtrace_vector_finish): Add error_callback and data
diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in
index 971406bf6da..eff3ba974ee 100644
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -16,7 +16,7 @@
@SET_MAKE@
# Makefile.am -- Backtrace Makefile.
-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 46ad9eec9a6..6ef712589f7 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -11667,12 +11667,13 @@ return _Unwind_GetIPInfo (context, &ip_before_insn);
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"; then :
have_unwind_getipinfo=yes
else
have_unwind_getipinfo=no
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS="$ac_save_CFLAGS"
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_unwind_getipinfo" >&5
$as_echo "$have_unwind_getipinfo" >&6; }
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 28b2a1cd5c7..e0e0e088866 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -144,7 +144,7 @@ else
ac_save_CFFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
AC_MSG_CHECKING([for _Unwind_GetIPInfo])
- AC_COMPILE_IFELSE(
+ AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[#include "unwind.h"
struct _Unwind_Context *context;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 960c8435569..6712a8df101 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,20 @@
+2014-02-28 Joey Ye <joey.ye@arm.com>
+
+ Backport from mainline r208229
+ 2014-02-28 Joey Ye <joey.ye@arm.com>
+
+ PR libgcc/60166
+ * config/arm/sfp-machine.h (_FP_NANFRAC_H,
+ _FP_NANFRAC_S, _FP_NANFRAC_D, _FP_NANFRAC_Q):
+ Set to zero.
+
+2014-02-18 Kai Tietz <ktietz@redhat.com>
+ Jonathan Schleifer <js@webkeks.org>
+
+ PR objc/56870
+ * unwind-seh.c (_GCC_specific_handler): Pass proper
+ value to unwind-handler.
+
2014-01-25 Walter Lee <walt@tilera.com>
Backport from mainline
diff --git a/libgcc/config/arm/sfp-machine.h b/libgcc/config/arm/sfp-machine.h
index a89d05a00ba..8591ab439e9 100644
--- a/libgcc/config/arm/sfp-machine.h
+++ b/libgcc/config/arm/sfp-machine.h
@@ -19,10 +19,12 @@ typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y)
#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y)
-#define _FP_NANFRAC_H ((_FP_QNANBIT_H << 1) - 1)
-#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1)
-#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1
-#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1
+/* According to RTABI, QNAN is only with the most significant bit of the
+ significand set, and all other significand bits zero. */
+#define _FP_NANFRAC_H 0
+#define _FP_NANFRAC_S 0
+#define _FP_NANFRAC_D 0, 0
+#define _FP_NANFRAC_Q 0, 0, 0, 0
#define _FP_NANSIGN_H 0
#define _FP_NANSIGN_S 0
#define _FP_NANSIGN_D 0
diff --git a/libgcc/unwind-seh.c b/libgcc/unwind-seh.c
index 54a86213f9a..9fd5e850da6 100644
--- a/libgcc/unwind-seh.c
+++ b/libgcc/unwind-seh.c
@@ -313,8 +313,9 @@ _GCC_specific_handler (PEXCEPTION_RECORD ms_exc, void *this_frame,
ms_exc->ExceptionInformation[3] = gcc_context.reg[1];
/* Begin phase 2. Perform the unwinding. */
- RtlUnwindEx (this_frame, gcc_context.ra, ms_exc, gcc_exc,
- ms_orig_context, ms_disp->HistoryTable);
+ RtlUnwindEx (this_frame, gcc_context.ra, ms_exc,
+ (PVOID)gcc_context.reg[0], ms_orig_context,
+ ms_disp->HistoryTable);
}
/* In _Unwind_RaiseException we return _URC_FATAL_PHASE1_ERROR. */
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index cd7a210e56c..fa07295f6ed 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,30 @@
+2014-02-21 Jerry DeLisle <jvdelisle@gcc.gnu>
+ Dominique d'Humieres <dominiq@lps.ens.fr>
+ Steven G. Kargl <kargl@gcc.gnu.org>
+
+ Backport from mainline
+ PR libfortran/59700
+ PR libfortran/59764
+ * io/io.h (struct st_parameter_dt): Assign expanded_read flag to
+ unused bit. Define new variable line_buffer_pos.
+ * io/list_read.c (free_saved, next_char, l_push_char,
+ read_logical, read_real): Replace use of item_count with
+ line_buffer_pos for line_buffer look ahead.
+ (read_logical, read_integer, parse_real, read_real, check_type):
+ Adjust location of free_line to after generating error messages
+ to retain the correct item count for the message.
+
+2014-02-15 Jerry DeLisle <jvdelisle@gcc.gnu>
+ Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ Backport from mainline
+ PR libfortran/59771
+ PR libfortran/59774
+ PR libfortran/59836
+ * io/write_float.def (output_float): Fix wrong handling of the
+ Fw.0 format.
+ (output_float_FMT_G_): Fixes rounding issues with -m32.
+
2013-10-16 Release Manager
* GCC 4.8.2 released.
diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h
index 8ea9326670b..10f09855f1f 100644
--- a/libgfortran/io/io.h
+++ b/libgfortran/io/io.h
@@ -424,7 +424,10 @@ typedef struct st_parameter_dt
unsigned g0_no_blanks : 1;
/* Used to signal use of free_format_data. */
unsigned format_not_saved : 1;
- /* 14 unused bits. */
+ /* A flag used to identify when a non-standard expanded namelist read
+ has occurred. */
+ unsigned expanded_read : 1;
+ /* 13 unused bits. */
/* Used for ungetc() style functionality. Possible values
are an unsigned char, EOF, or EOF - 1 used to mark the
@@ -441,9 +444,8 @@ typedef struct st_parameter_dt
char *line_buffer;
struct format_data *fmt;
namelist_info *ionml;
- /* A flag used to identify when a non-standard expanded namelist read
- has occurred. */
- int expanded_read;
+ /* Current position within the look-ahead line buffer. */
+ int line_buffer_pos;
/* Storage area for values except for strings. Must be
large enough to hold a complex value (two reals) of the
largest kind. */
diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c
index 60f4549cd20..7cafad0c55d 100644
--- a/libgfortran/io/list_read.c
+++ b/libgfortran/io/list_read.c
@@ -118,7 +118,7 @@ free_saved (st_parameter_dt *dtp)
static void
free_line (st_parameter_dt *dtp)
{
- dtp->u.p.item_count = 0;
+ dtp->u.p.line_buffer_pos = 0;
dtp->u.p.line_buffer_enabled = 0;
if (dtp->u.p.line_buffer == NULL)
@@ -150,15 +150,15 @@ next_char (st_parameter_dt *dtp)
{
dtp->u.p.at_eol = 0;
- c = dtp->u.p.line_buffer[dtp->u.p.item_count];
- if (c != '\0' && dtp->u.p.item_count < 64)
+ c = dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos];
+ if (c != '\0' && dtp->u.p.line_buffer_pos < 64)
{
- dtp->u.p.line_buffer[dtp->u.p.item_count] = '\0';
- dtp->u.p.item_count++;
+ dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos] = '\0';
+ dtp->u.p.line_buffer_pos++;
goto done;
}
- dtp->u.p.item_count = 0;
+ dtp->u.p.line_buffer_pos = 0;
dtp->u.p.line_buffer_enabled = 0;
}
@@ -640,7 +640,7 @@ l_push_char (st_parameter_dt *dtp, char c)
if (dtp->u.p.line_buffer == NULL)
dtp->u.p.line_buffer = xcalloc (SCRATCH_SIZE, 1);
- dtp->u.p.line_buffer[dtp->u.p.item_count++] = c;
+ dtp->u.p.line_buffer[dtp->u.p.line_buffer_pos++] = c;
}
@@ -750,7 +750,7 @@ read_logical (st_parameter_dt *dtp, int length)
{
dtp->u.p.nml_read_error = 1;
dtp->u.p.line_buffer_enabled = 1;
- dtp->u.p.item_count = 0;
+ dtp->u.p.line_buffer_pos = 0;
return;
}
@@ -758,14 +758,17 @@ read_logical (st_parameter_dt *dtp, int length)
bad_logical:
- free_line (dtp);
-
if (nml_bad_return (dtp, c))
- return;
+ {
+ free_line (dtp);
+ return;
+ }
+
free_saved (dtp);
if (c == EOF)
{
+ free_line (dtp);
hit_eof (dtp);
return;
}
@@ -773,6 +776,7 @@ read_logical (st_parameter_dt *dtp, int length)
eat_line (dtp);
snprintf (message, MSGLEN, "Bad logical value while reading item %d",
dtp->u.p.item_count);
+ free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
return;
@@ -913,9 +917,9 @@ read_integer (st_parameter_dt *dtp, int length)
else if (c != '\n')
eat_line (dtp);
- free_line (dtp);
snprintf (message, MSGLEN, "Bad integer for item %d in list input",
dtp->u.p.item_count);
+ free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
return;
@@ -1298,9 +1302,9 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
else if (c != '\n')
eat_line (dtp);
- free_line (dtp);
snprintf (message, MSGLEN, "Bad floating point number for item %d",
dtp->u.p.item_count);
+ free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
return 1;
@@ -1406,9 +1410,9 @@ eol_4:
else if (c != '\n')
eat_line (dtp);
- free_line (dtp);
snprintf (message, MSGLEN, "Bad complex value in item %d of list input",
dtp->u.p.item_count);
+ free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
}
@@ -1770,7 +1774,7 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
{
dtp->u.p.nml_read_error = 1;
dtp->u.p.line_buffer_enabled = 1;
- dtp->u.p.item_count = 0;
+ dtp->u.p.line_buffer_pos = 0;
return;
}
@@ -1789,9 +1793,9 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
else if (c != '\n')
eat_line (dtp);
- free_line (dtp);
snprintf (message, MSGLEN, "Bad real number in item %d of list input",
dtp->u.p.item_count);
+ free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
}
@@ -1806,11 +1810,10 @@ check_type (st_parameter_dt *dtp, bt type, int len)
if (dtp->u.p.saved_type != BT_UNKNOWN && dtp->u.p.saved_type != type)
{
- free_line (dtp);
snprintf (message, MSGLEN, "Read type %s where %s was expected for item %d",
type_name (dtp->u.p.saved_type), type_name (type),
dtp->u.p.item_count);
-
+ free_line (dtp);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
return 1;
}
@@ -1820,12 +1823,12 @@ check_type (st_parameter_dt *dtp, bt type, int len)
if (dtp->u.p.saved_length != len)
{
- free_line (dtp);
snprintf (message, MSGLEN,
"Read kind %d %s where kind %d is required for item %d",
dtp->u.p.saved_length, type_name (dtp->u.p.saved_type), len,
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
+ free_line (dtp);
return 1;
}
diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 5b76fd59650..cfee29dc193 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -373,7 +373,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
updown:
rchar = '0';
- if (w > 0 && d == 0 && p == 0)
+ if (ft != FMT_F && w > 0 && d == 0 && p == 0)
nbefore = 1;
/* Scan for trailing zeros to see if we really need to round it. */
for(i = nbefore + nafter; i < ndigits; i++)
@@ -386,13 +386,14 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
do_rnd:
if (nbefore + nafter == 0)
+ /* Handle the case Fw.0 and value < 1.0 */
{
ndigits = 0;
- if (nzero_real == d && digits[0] >= rchar)
+ if (digits[0] >= rchar)
{
/* We rounded to zero but shouldn't have */
- nzero--;
- nafter = 1;
+ nbefore = 1;
+ digits--;
digits[0] = '1';
ndigits = 1;
}
@@ -990,13 +991,14 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \
int d = f->u.real.d;\
int w = f->u.real.w;\
fnode newf;\
- GFC_REAL_ ## x rexp_d, r = 0.5;\
+ GFC_REAL_ ## x exp_d, r = 0.5, r_sc;\
int low, high, mid;\
int ubound, lbound;\
char *p, pad = ' ';\
int save_scale_factor, nb = 0;\
try result;\
int nprinted, precision;\
+ volatile GFC_REAL_ ## x temp;\
\
save_scale_factor = dtp->u.p.scale_factor;\
\
@@ -1015,10 +1017,13 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \
break;\
}\
\
- rexp_d = calculate_exp_ ## x (-d);\
- if ((m > 0.0 && ((m < 0.1 - 0.1 * r * rexp_d) || (rexp_d * (m + r) >= 1.0)))\
+ exp_d = calculate_exp_ ## x (d);\
+ r_sc = (1 - r / exp_d);\
+ temp = 0.1 * r_sc;\
+ if ((m > 0.0 && ((m < temp) || (r >= (exp_d - m))))\
|| ((m == 0.0) && !(compile_options.allow_std\
- & (GFC_STD_F2003 | GFC_STD_F2008))))\
+ & (GFC_STD_F2003 | GFC_STD_F2008)))\
+ || d == 0)\
{ \
newf.format = FMT_E;\
newf.u.real.w = w;\
@@ -1038,10 +1043,9 @@ output_float_FMT_G_ ## x (st_parameter_dt *dtp, const fnode *f, \
\
while (low <= high)\
{ \
- volatile GFC_REAL_ ## x temp;\
mid = (low + high) / 2;\
\
- temp = (calculate_exp_ ## x (mid - 1) * (1 - r * rexp_d));\
+ temp = (calculate_exp_ ## x (mid - 1) * r_sc);\
\
if (m < temp)\
{ \