aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-11-30 21:41:00 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-11-30 21:41:00 +0000
commit6924b2850ab1dd6cfbb329b242a97fdd95d03426 (patch)
treeaf388d60fbccb515b0412b2eb67e16a81240830d
parentefa193f5445701953baf279278dc1e6c92d8a99b (diff)
parent24f1d7f80e0bb3fbb9b845300153d367b0cf2f5f (diff)
downloadgcc-6924b2850ab1dd6cfbb329b242a97fdd95d03426.zip
gcc-6924b2850ab1dd6cfbb329b242a97fdd95d03426.tar.gz
gcc-6924b2850ab1dd6cfbb329b242a97fdd95d03426.tar.bz2
Merge from trunk revision 243083.
From-SVN: r243084
-rw-r--r--gcc/ChangeLog156
-rw-r--r--gcc/ada/ChangeLog29
-rw-r--r--gcc/ada/g-sechas.adb2
-rw-r--r--gcc/ada/lib-xref-spark_specific.adb7
-rw-r--r--gcc/ada/lib-xref.adb8
-rw-r--r--gcc/ada/lib-xref.ads2
-rw-r--r--gcc/ada/raise-gcc.c29
-rw-r--r--gcc/ada/sem_attr.adb2
-rw-r--r--gcc/ada/sem_ch6.adb12
-rw-r--r--gcc/ada/sem_ch8.adb6
-rw-r--r--gcc/ada/sem_prag.adb10
-rw-r--r--gcc/ada/sinfo.ads2
-rw-r--r--gcc/asan.c6
-rw-r--r--gcc/cgraph.c9
-rw-r--r--gcc/cgraph.h20
-rw-r--r--gcc/cgraphclones.c44
-rw-r--r--gcc/combine.c3
-rw-r--r--gcc/common/config/arc/arc-common.c2
-rw-r--r--gcc/config/aarch64/aarch64.md6
-rw-r--r--gcc/config/arc/arc-protos.h1
-rw-r--r--gcc/config/arc/arc.c75
-rw-r--r--gcc/config/arc/arc700.md2
-rw-r--r--gcc/config/arm/t-rmprofile2
-rw-r--r--gcc/config/avr/avr-arch.h3
-rw-r--r--gcc/config/avr/avr-devices.c6
-rw-r--r--gcc/config/avr/gen-avr-mmcu-specs.c15
-rw-r--r--gcc/config/avr/specs.h3
-rw-r--r--gcc/config/i386/i386.c2
-rw-r--r--gcc/config/rs6000/rs6000.c4
-rw-r--r--gcc/config/rs6000/vsx.md2
-rw-r--r--gcc/dumpfile.c2
-rw-r--r--gcc/dumpfile.h1
-rw-r--r--gcc/emit-rtl.c6
-rw-r--r--gcc/fortran/ChangeLog99
-rw-r--r--gcc/fortran/check.c11
-rw-r--r--gcc/fortran/decl.c16
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/gfortran.texi66
-rw-r--r--gcc/fortran/interface.c14
-rw-r--r--gcc/fortran/primary.c35
-rw-r--r--gcc/fortran/trans-array.c448
-rw-r--r--gcc/fortran/trans-array.h10
-rw-r--r--gcc/fortran/trans-decl.c24
-rw-r--r--gcc/fortran/trans-expr.c103
-rw-r--r--gcc/fortran/trans-intrinsic.c100
-rw-r--r--gcc/fortran/trans-openmp.c9
-rw-r--r--gcc/fortran/trans-stmt.c57
-rw-r--r--gcc/fortran/trans.c198
-rw-r--r--gcc/fortran/trans.h44
-rw-r--r--gcc/gimple-ssa-sprintf.c31
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/ipa-inline-transform.c3
-rw-r--r--gcc/ira.c7
-rw-r--r--gcc/lra-constraints.c16
-rw-r--r--gcc/lto/ChangeLog6
-rw-r--r--gcc/lto/lto-symtab.c8
-rw-r--r--gcc/real.c2
-rw-r--r--gcc/rtlanal.c2
-rw-r--r--gcc/selftest.c48
-rw-r--r--gcc/simplify-rtx.c1
-rw-r--r--gcc/testsuite/ChangeLog113
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/ref-1.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C2
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C2
-rw-r--r--gcc/testsuite/g++.dg/eh/delete1.C2
-rw-r--r--gcc/testsuite/g++.dg/eh/new1.C1
-rw-r--r--gcc/testsuite/g++.dg/init/new40.C1
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/new2.C1
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr78362.c11
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr78574.c27
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr78610.c14
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr78586.c17
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr78541-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/asan/pr78541.c25
-rw-r--r--gcc/testsuite/gcc.dg/format/pr78498.c12
-rw-r--r--gcc/testsuite/gcc.dg/pr78582.c18
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c29
-rw-r--r--gcc/testsuite/gcc.target/arc/arc700-stld-hazard.c14
-rw-r--r--gcc/testsuite/gcc.target/i386/pr77856.c83
-rw-r--r--gcc/testsuite/gfortran.dg/class_61.f9011
-rw-r--r--gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f902
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_alloc_comp_1.f083
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_allocate_7.f085
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f908
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f908
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f908
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f9046
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f904
-rw-r--r--gcc/testsuite/gfortran.dg/derived_result.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/dtio_18.f9015
-rw-r--r--gcc/testsuite/lib/target-supports.exp50
-rw-r--r--gcc/tree-ssa-loop-ivopts.c5
-rw-r--r--libgfortran/ChangeLog21
-rw-r--r--libgfortran/caf/libcaf.h19
-rw-r--r--libgfortran/caf/single.c130
-rw-r--r--libgo/go/runtime/traceback_gccgo.go9
-rw-r--r--libgomp/ChangeLog21
-rw-r--r--libgomp/Makefile.in133
-rw-r--r--libgomp/aclocal.m474
-rw-r--r--libgomp/config.h.in3
-rw-r--r--libgomp/config/nvptx/env.c0
-rwxr-xr-xlibgomp/configure25
-rw-r--r--libgomp/configure.ac7
-rw-r--r--libgomp/env.c43
-rw-r--r--libgomp/icv.c34
-rw-r--r--libgomp/testsuite/Makefile.in60
-rw-r--r--libiberty/ChangeLog8
-rw-r--r--libiberty/strndup.c7
-rw-r--r--libiberty/xstrndup.c5
-rw-r--r--libobjc/ChangeLog16
-rwxr-xr-xlibobjc/configure4
-rw-r--r--libobjc/configure.ac6
-rw-r--r--libsanitizer/ChangeLog11
-rw-r--r--libsanitizer/LOCAL_PATCHES1
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h11
-rw-r--r--libstdc++-v3/ChangeLog48
-rw-r--r--libstdc++-v3/include/bits/shared_ptr_base.h2
-rw-r--r--libstdc++-v3/include/std/istream35
-rw-r--r--libstdc++-v3/include/std/ostream34
-rw-r--r--libstdc++-v3/testsuite/18_support/50594.cc1
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc96
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc96
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc96
-rw-r--r--libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc96
-rw-r--r--libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc2
-rw-r--r--libstdc++-v3/testsuite/experimental/type_erased_allocator/2.cc1
-rw-r--r--libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pool_allocator/check_new.cc2
130 files changed, 3030 insertions, 533 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b6383aa..7a46cd2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,149 @@
+2016-11-30 Michael Meissner <meissner@linux.vnet.ibm.com>
+
+ PR target/78602
+ * config/rs6000/rs6000.c (rs6000_expand_vector_extract): If the
+ element is not a constant or in a register, force it to a
+ register.
+
+ PR target/78560
+ * config/rs6000/rs6000.c (rs6000_expand_vector_set): Force value
+ that will be set to a vector element to be in a register.
+ * config/rs6000/vsx.md (vsx_set_<mode>_p9): Fix thinko that used
+ the wrong multiplier to convert the element number to a byte
+ offset.
+
+2016-11-30 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR tree-optimization/77856
+ * lra-constraints.c (inherit_in_ebb): Check original regno for
+ invalid invariant regs too. Set only clobbered hard regs for the
+ invalid invariant regs.
+
+2016-11-30 Pitchumani Sivanupandi <pitchumani.sivanupandi@microchip.com>
+
+ Commit files forgotten in r242966.
+
+ * config/avr/avr-arch.h (avr_mcu_t) [flash_size]: New member.
+ * config/avr/avr-devices.c (avr_mcu_types): Add flash size info.
+ * config/avr/gen-avr-mmcu-specs.c (print_mcu): Remove hard-coded
+ prefix check to find wrap-around value, instead use MCU flash size.
+ For 8k flash devices, update link_pmem_wrap spec string to
+ add --pmem-wrap-around=8k.
+ * config/avr/specs.h (LINK_RELAX_SPEC): Move link_pmem_wrap from
+ here...
+ (LINK_SPEC): ...to here.
+
+2016-11-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/78498
+ * selftest.c (selftest::assert_strndup_eq): New function.
+ (selftest::test_strndup): New function.
+ (selftest::test_libiberty): New function.
+ (selftest::selftest_c_tests): Call test_libiberty.
+
+2016-11-30 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/78610
+ * ira.c (combine_and_move_insns): Don't substitute into TRAP_IF
+ instructions.
+
+2016-11-30 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/78574
+ * tree-ssa-loop-ivopts.c (find_deriving_biv_for_expr): Skip loop
+ header PHI that doesn't define biv.
+
+2016-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ * emit-rtl.c (verify_insn_sharing): Call verify_rtx_sharing instead of
+ reset_used_flags.
+
+ * config/i386/i386.c (dimode_scalar_chain::convert_op): Avoid
+ sharing the SUBREG rtx between move and following insn.
+
+ * ira.c (ira_update_equiv_info_by_shuffle_insn): Use copy_rtx
+ for REG_EQUIV argument.
+
+2016-11-30 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/arm/t-rmprofile: Add mappings for Cortex-M23 and Cortex-M33.
+
+2016-11-30 Markus Trippelsdorf <markus@trippelsdorf.de>
+
+ PR ipa/78555
+ * real.c (real_hash): Add cast to avoid left
+ shifting of negative values.
+
+2016-11-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/78362
+ * config/aarch64/aarch64.md (add<mode>3): Extract inner expression
+ from a subreg in operands[1] and don't call REGNO on a non-reg
+ expression when deciding to force operands[2] into a reg.
+
+2016-11-30 Claudiu Zissulescu <claziss@synopsys.com>
+ Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * config/arc/arc-protos.h (arc_store_addr_hazard_p): Declare.
+ * config/arc/arc.c (arc_store_addr_hazard_p): New function.
+ (workaround_arc_anomaly): Call arc_store_addr_hazard_p for ARC700.
+ * config/arc/arc700.md: Add define_bypass for store/load.
+
+2016-11-30 Martin Liska <mliska@suse.cz>
+
+ * cgraph.c (symbol_table::initialize): Initialize
+ ipa_clones_dump_file.
+ (cgraph_node::remove): Report to ipa_clones_dump_file.
+ * cgraph.h: Add new argument (suffix) to cloning methods.
+ * cgraphclones.c (dump_callgraph_transformation): New function.
+ (cgraph_node::create_clone): New argument.
+ (cgraph_node::create_virtual_clone): Likewise.
+ (cgraph_node::create_version_clone): Likewise.
+ * dumpfile.c: Add .ipa-clones dump file.
+ * dumpfile.h (enum tree_dump_index): Add TDI_clones
+ * ipa-inline-transform.c (clone_inlined_nodes): Report operation
+ to dump_callgraph_transformation.
+
+2016-11-30 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/78541
+ * asan.c (asan_expand_mark_ifn): Properly
+ select a VAR_DECL from FRAME.* component reference.
+
+2016-11-30 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/78583
+ * simplify-rtx.c (simplify_truncation): Add check missing from the
+ previous commit.
+
+2016-11-30 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/78590
+ * combine.c (change_zero_ext): Transform zero_extend of subregs only
+ if the subreg_reg is a scalar integer mode.
+
+2016-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/78586
+ * gimple-ssa-sprintf.c (format_integer): Use TYPE_MAX_VALUE or
+ TYPE_MIN_VALUE or build_all_ones_cst instead of folding LSHIFT_EXPR.
+ Don't build_int_cst min/max twice. Formatting fix.
+
+2016-11-30 Markus Trippelsdorf <markus@trippelsdorf.de>
+
+ PR rtl-optimization/78588
+ * combine.c (if_then_else_cond): Also guard against BLKmode.
+ * rtlanal.c (num_sign_bit_copies1): Add assert.
+
+2016-11-29 Jeff Law <law@redhat.com>
+
+ * common/config/arc/arc-common.c (arc_handle_option): Remove unused
+ variables.
+
+ * lra-constraints.c (check_and_process_move): Constrain the
+ range of DCLASS and SCLASS to avoid false positive out of bounds
+ array index warning.
+
2016-11-29 David Malcolm <dmalcolm@redhat.com>
* doc/install.texi (--with-target-bdw-gc): Remove stray '@'.
@@ -79,15 +225,7 @@
2016-11-29 Pitchumani Sivanupandi <pitchumani.s@atmel.com>
- * config/avr/avr-arch.h (avr_mcu_t): Add flash_size member.
- * config/avr/avr-devices.c(avr_mcu_types): Add flash size info.
- * config/avr/avr-mcu.def: Likewise.
- * config/avr/gen-avr-mmcu-specs.c (print_mcu): Remove hard-coded prefix
- check to find wrap-around value, instead use MCU flash size. For 8k
- flash devices, update link_pmem_wrap spec string to add
- --pmem-wrap-around=8k.
- * config/avr/specs.h: Remove link_pmem_wrap from LINK_RELAX_SPEC and
- add to linker specs (LINK_SPEC) directly.
+ * config/avr/avr-mcu.def: (avr_mcu_types): Add flash size info.
2016-11-29 David Malcolm <dmalcolm@redhat.com>
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ca438db..3f221d2 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,32 @@
+2016-11-30 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_prag.adb, sem_ch6.adb: Minor reformatting and typo fixes.
+ * g-sechas.adb: Minor reformatting.
+ * lib-xref.ads: minor grammar fix in comment.
+ * lib-xref-spark_specific.adb
+ (Is_SPARK_Reference): do not ignore references to concurrent
+ objects.
+ * sinfo.ads: Fix of unbalanced parens in comment
+
+2016-11-30 Ed Schonberg <schonberg@adacore.com>
+
+ * lib-xref.adb (Get_Type_Reference): If the entity is a function
+ returning a classwide type, the type reference is obtained right
+ away and does not need further unwinding.
+
+2016-11-30 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch8.adb (Find_Renamed_Entity): For non-overloaded subprogram
+ actuals of generic units check that the spec of the renaming
+ and renamed entities match.
+
+2016-11-30 Tristan Gingold <gingold@adacore.com>
+
+ * raise-gcc.c: For CERT runtimes: do not use gcc includes, simplify
+ the handling.
+ * sem_attr.adb (Analyze_Attribute): Check No_Dynamic_Priorities
+ restriction for Priority Attribute.
+
2016-11-27 Eric Botcazou <ebotcazou@adacore.com>
PR ada/78524
diff --git a/gcc/ada/g-sechas.adb b/gcc/ada/g-sechas.adb
index f2e8d5d..59a598d 100644
--- a/gcc/ada/g-sechas.adb
+++ b/gcc/ada/g-sechas.adb
@@ -253,7 +253,7 @@ package body GNAT.Secure_Hashes is
if Index = First_Index then
-- Message_Length is in bytes, but we need to store it as
- -- a bit count).
+ -- a bit count.
Pad (Index) := Character'Val
(Shift_Left (Message_Length and 16#1f#, 3));
diff --git a/gcc/ada/lib-xref-spark_specific.adb b/gcc/ada/lib-xref-spark_specific.adb
index 95056e0..87d3942 100644
--- a/gcc/ada/lib-xref-spark_specific.adb
+++ b/gcc/ada/lib-xref-spark_specific.adb
@@ -527,13 +527,6 @@ package body SPARK_Specific is
if Ekind (E) in Overloadable_Kind then
return Typ = 's';
- -- Objects of task or protected types are not SPARK references
-
- elsif Present (Etype (E))
- and then Ekind (Etype (E)) in Concurrent_Kind
- then
- return False;
-
-- In all other cases, result is true for reference/modify cases,
-- and false for all other cases.
diff --git a/gcc/ada/lib-xref.adb b/gcc/ada/lib-xref.adb
index b1d5978..ea68232 100644
--- a/gcc/ada/lib-xref.adb
+++ b/gcc/ada/lib-xref.adb
@@ -1508,6 +1508,14 @@ package body Lib.Xref is
Entity (Original_Node (Object_Definition (Decl)));
end if;
end;
+
+ -- For a function that returns a class-wide type, Tref is
+ -- already correct.
+
+ elsif Is_Overloadable (Ent)
+ and then Is_Class_Wide_Type (Tref)
+ then
+ return;
end if;
-- For anything else, exit
diff --git a/gcc/ada/lib-xref.ads b/gcc/ada/lib-xref.ads
index 5325fc0..4694853 100644
--- a/gcc/ada/lib-xref.ads
+++ b/gcc/ada/lib-xref.ads
@@ -691,7 +691,7 @@ package Lib.Xref is
-- the spec. The entity in the body is treated as a reference with type
-- 'b'. Similar handling for references to subprogram formals.
--
- -- The call has no effect if N is not in the extended main source unit
+ -- The call has no effect if N is not in the extended main source unit.
-- This check is omitted for type 'e' references (where it is useful to
-- have structural scoping information for other than the main source),
-- and for 'p' (since we want to pick up inherited primitive operations
diff --git a/gcc/ada/raise-gcc.c b/gcc/ada/raise-gcc.c
index 4a10fbf..a2b6f64 100644
--- a/gcc/ada/raise-gcc.c
+++ b/gcc/ada/raise-gcc.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2014, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2016, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -36,8 +36,13 @@
#error "RTS unit only"
#endif
+#ifndef CERT
#include "tconfig.h"
#include "tsystem.h"
+#else
+#define ATTRIBUTE_UNUSED __attribute__((unused))
+#define HAVE_GETIPINFO 1
+#endif
#include <stdarg.h>
typedef char bool;
@@ -80,6 +85,15 @@ extern struct Exception_Occurrence *__gnat_setup_current_excep
(_Unwind_Exception *);
extern void __gnat_unhandled_except_handler (_Unwind_Exception *);
+#ifdef CERT
+#define abort() __gnat_raise_abort()
+static void __gnat_raise_abort(void)
+{
+ while (1)
+ ;
+}
+#endif
+
#include "unwind-pe.h"
/* The known and handled exception classes. */
@@ -928,9 +942,13 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception)
/* All others and others choice match any foreign exception. */
if (choice == GNAT_ALL_OTHERS
|| choice == GNAT_OTHERS
- || choice == (_Unwind_Ptr) &Foreign_Exception)
+#ifndef CERT
+ || choice == (_Unwind_Ptr) &Foreign_Exception
+#endif
+ )
return handler;
+#ifndef CERT
/* C++ exception occurrences. */
if (exception_class_eq (propagated_exception, CXX_EXCEPTION_CLASS)
&& Language_For (choice) == 'C')
@@ -947,6 +965,7 @@ is_handled_by (_Unwind_Ptr choice, _GNAT_Exception *propagated_exception)
if (choice_typeinfo == except_typeinfo)
return handler;
}
+#endif
return nothing;
}
@@ -1172,6 +1191,7 @@ personality_body (_Unwind_Action uw_phases,
}
else
{
+#ifndef CERT
struct Exception_Occurrence *excep;
/* Trigger the appropriate notification routines before the second
@@ -1182,6 +1202,7 @@ personality_body (_Unwind_Action uw_phases,
__gnat_notify_unhandled_exception (excep);
else
__gnat_notify_handled_exception (excep);
+#endif
return _URC_HANDLER_FOUND;
}
@@ -1195,10 +1216,12 @@ personality_body (_Unwind_Action uw_phases,
setup_to_install
(uw_context, uw_exception, action.landing_pad, action.ttype_filter);
+#ifndef CERT
/* Write current exception, so that it can be retrieved from Ada. It was
already done during phase 1 (just above), but in between, one or several
exceptions may have been raised (in cleanup handlers). */
__gnat_setup_current_excep (uw_exception);
+#endif
return _URC_INSTALL_CONTEXT;
}
@@ -1338,6 +1361,7 @@ PERSONALITY_FUNCTION (_Unwind_State state,
/* Callback routine called by Unwind_ForcedUnwind to execute all the cleanup
before exiting the task. */
+#ifndef CERT
_Unwind_Reason_Code
__gnat_cleanupunwind_handler (int version ATTRIBUTE_UNUSED,
_Unwind_Action phases,
@@ -1362,6 +1386,7 @@ __gnat_cleanupunwind_handler (int version ATTRIBUTE_UNUSED,
and this hook will gain control again. */
return _URC_NO_REASON;
}
+#endif
/* Define the consistently named wrappers imported by Propagate_Exception. */
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 7b31ca1..6695253 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -5158,6 +5158,8 @@ package body Sem_Attr is
Check_E0;
+ Check_Restriction (No_Dynamic_Priorities, N);
+
-- The prefix must be a protected object (AARM D.5.2 (2/2))
Analyze (P);
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 53ca284..ade6f50 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -393,7 +393,7 @@ package body Sem_Ch6 is
Rewrite (N, New_Body);
-- Remove any existing aspects from the original node because the act
- -- of rewriting cases the list to be shared between the two nodes.
+ -- of rewriting causes the list to be shared between the two nodes.
Orig_N := Original_Node (N);
Remove_Aspects (Orig_N);
@@ -405,8 +405,8 @@ package body Sem_Ch6 is
Relocate_Pragmas_To_Body (N);
Analyze (N);
- -- Once the aspects of the generated body has been analyzed, create a
- -- copy for ASIS purposes and assciate it with the original node.
+ -- Once the aspects of the generated body have been analyzed, create
+ -- a copy for ASIS purposes and associate it with the original node.
if Has_Aspects (N) then
Set_Aspect_Specifications (Orig_N,
@@ -459,15 +459,15 @@ package body Sem_Ch6 is
Rewrite (N, Make_Subprogram_Declaration (Loc, Specification => Spec));
-- Remove any existing aspects from the original node because the act
- -- of rewriting cases the list to be shared between the two nodes.
+ -- of rewriting causes the list to be shared between the two nodes.
Orig_N := Original_Node (N);
Remove_Aspects (Orig_N);
Analyze (N);
- -- Once the aspects of the generated spec has been analyzed, create a
- -- copy for ASIS purposes and assciate it with the original node.
+ -- Once the aspects of the generated spec have been analyzed, create
+ -- a copy for ASIS purposes and associate it with the original node.
if Has_Aspects (N) then
Set_Aspect_Specifications (Orig_N,
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 45159c0..54fca50 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6449,7 +6449,10 @@ package body Sem_Ch8 is
-- Non-overloaded case
else
- if Is_Actual and then Present (Enclosing_Instance) then
+ if Is_Actual
+ and then Present (Enclosing_Instance)
+ and then Entity_Matches_Spec (Entity (Nam), New_S)
+ then
Old_S := Entity (Nam);
elsif Entity_Matches_Spec (Entity (Nam), New_S) then
@@ -7757,6 +7760,7 @@ package body Sem_Ch8 is
Next_Formal (New_F);
Next_Formal (Old_F);
end loop;
+ pragma Assert (No (Old_F));
if Ekind_In (Old_S, E_Function, E_Enumeration_Literal) then
Set_Etype (New_S, Etype (Old_S));
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 26a4870..4351f32 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -7019,7 +7019,7 @@ package body Sem_Prag is
function Check_Node (N : Node_Id) return Traverse_Result;
-- Tree visitor that checks if N is an attribute reference that can
- -- be statically computed by the backend. Validation_Needed is set
+ -- be statically computed by the back end. Validation_Needed is set
-- to True if found.
----------------
@@ -7063,10 +7063,10 @@ package body Sem_Prag is
if Compile_Time_Known_Value (Arg1x) then
Process_Compile_Time_Warning_Or_Error (N, Sloc (Arg1));
- -- Register the expression for its validation after the backend has
- -- been called if it has occurrences of attributes size or alignment
- -- (because they may be statically computed by the backend and hence
- -- the whole expression needs to be re-evaluated).
+ -- Register the expression for its validation after the back end has
+ -- been called if it has occurrences of attributes Size or Alignment
+ -- (because they may be statically computed by the back end and hence
+ -- the whole expression needs to be reevaluated).
else
Check_Expression (Arg1x);
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 659e989..75e0846 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -2008,7 +2008,7 @@ package Sinfo is
-- Parent_Spec (Node4-Sem)
-- For a library unit that is a child unit spec (package or subprogram
-- declaration, generic declaration or instantiation, or library level
- -- rename, this field points to the compilation unit node for the parent
+ -- rename) this field points to the compilation unit node for the parent
-- package specification. This field is Empty for library bodies (the
-- parent spec in this case can be found from the corresponding spec).
diff --git a/gcc/asan.c b/gcc/asan.c
index 6e93ea3..cb5d615 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2713,6 +2713,12 @@ asan_expand_mark_ifn (gimple_stmt_iterator *iter)
tree base = gimple_call_arg (g, 1);
gcc_checking_assert (TREE_CODE (base) == ADDR_EXPR);
tree decl = TREE_OPERAND (base, 0);
+
+ /* For a nested function, we can have: ASAN_MARK (2, &FRAME.2.fp_input, 4) */
+ if (TREE_CODE (decl) == COMPONENT_REF
+ && DECL_NONLOCAL_FRAME (TREE_OPERAND (decl, 0)))
+ decl = TREE_OPERAND (decl, 0);
+
gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
if (asan_handled_variables == NULL)
asan_handled_variables = new hash_set<tree> (16);
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index b702a7c..867e371 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -263,6 +263,9 @@ symbol_table::initialize (void)
{
if (!dump_file)
dump_file = dump_begin (TDI_cgraph, NULL);
+
+ if (!ipa_clones_dump_file)
+ ipa_clones_dump_file = dump_begin (TDI_clones, NULL);
}
/* Allocate new callgraph node and insert it into basic data structures. */
@@ -1815,6 +1818,12 @@ cgraph_node::remove (void)
cgraph_node *n;
int uid = this->uid;
+ if (symtab->ipa_clones_dump_file && symtab->cloned_nodes.contains (this))
+ fprintf (symtab->ipa_clones_dump_file,
+ "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), order,
+ DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
+ DECL_SOURCE_COLUMN (decl));
+
symtab->call_cgraph_removal_hooks (this);
remove_callers ();
remove_callees ();
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index cc730d2..3feed7a 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -906,13 +906,14 @@ public:
If the new node is being inlined into another one, NEW_INLINED_TO should be
the outline function the new one is (even indirectly) inlined to.
All hooks will see this in node's global.inlined_to, when invoked.
- Can be NULL if the node is not inlined. */
+ Can be NULL if the node is not inlined. SUFFIX is string that is appended
+ to the original name. */
cgraph_node *create_clone (tree decl, gcov_type count, int freq,
bool update_original,
vec<cgraph_edge *> redirect_callers,
bool call_duplication_hook,
cgraph_node *new_inlined_to,
- bitmap args_to_skip);
+ bitmap args_to_skip, const char *suffix = NULL);
/* Create callgraph node clone with new declaration. The actual body will
be copied later at compilation stage. */
@@ -933,11 +934,14 @@ public:
If non-NULL BLOCK_TO_COPY determine what basic blocks
was copied to prevent duplications of calls that are dead
- in the clone. */
+ in the clone.
+
+ SUFFIX is string that is appended to the original name. */
cgraph_node *create_version_clone (tree new_decl,
vec<cgraph_edge *> redirect_callers,
- bitmap bbs_to_copy);
+ bitmap bbs_to_copy,
+ const char *suffix = NULL);
/* Perform function versioning.
Function versioning includes copying of the tree and
@@ -2223,6 +2227,10 @@ public:
/* Return symbol used to separate symbol name from suffix. */
static char symbol_suffix_separator ();
+ FILE* GTY ((skip)) ipa_clones_dump_file;
+
+ hash_set <const cgraph_node *> GTY ((skip)) cloned_nodes;
+
private:
/* Allocate new callgraph node. */
inline cgraph_node * allocate_cgraph_symbol (void);
@@ -2313,6 +2321,10 @@ tree clone_function_name (tree decl, const char *);
void tree_function_versioning (tree, tree, vec<ipa_replace_map *, va_gc> *,
bool, bitmap, bool, bitmap, basic_block);
+void dump_callgraph_transformation (const cgraph_node *original,
+ const cgraph_node *clone,
+ const char *suffix);
+
/* In cgraphbuild.c */
int compute_call_stmt_bb_frequency (tree, basic_block bb);
void record_references_in_initializer (tree, bool);
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index 686c2890..349892d 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -381,6 +381,28 @@ cgraph_node::expand_all_artificial_thunks ()
e = e->next_caller;
}
+void
+dump_callgraph_transformation (const cgraph_node *original,
+ const cgraph_node *clone,
+ const char *suffix)
+{
+ if (symtab->ipa_clones_dump_file)
+ {
+ fprintf (symtab->ipa_clones_dump_file,
+ "Callgraph clone;%s;%d;%s;%d;%d;%s;%d;%s;%d;%d;%s\n",
+ original->asm_name (), original->order,
+ DECL_SOURCE_FILE (original->decl),
+ DECL_SOURCE_LINE (original->decl),
+ DECL_SOURCE_COLUMN (original->decl), clone->asm_name (),
+ clone->order, DECL_SOURCE_FILE (clone->decl),
+ DECL_SOURCE_LINE (clone->decl), DECL_SOURCE_COLUMN (clone->decl),
+ suffix);
+
+ symtab->cloned_nodes.add (original);
+ symtab->cloned_nodes.add (clone);
+ }
+}
+
/* Create node representing clone of N executed COUNT times. Decrease
the execution counts from original node too.
The new clone will have decl set to DECL that may or may not be the same
@@ -403,13 +425,16 @@ cgraph_node::create_clone (tree new_decl, gcov_type gcov_count, int freq,
vec<cgraph_edge *> redirect_callers,
bool call_duplication_hook,
cgraph_node *new_inlined_to,
- bitmap args_to_skip)
+ bitmap args_to_skip, const char *suffix)
{
cgraph_node *new_node = symtab->create_empty ();
cgraph_edge *e;
gcov_type count_scale;
unsigned i;
+ if (new_inlined_to)
+ dump_callgraph_transformation (this, new_inlined_to, "inlining to");
+
new_node->decl = new_decl;
new_node->register_symbol ();
new_node->origin = origin;
@@ -495,6 +520,10 @@ cgraph_node::create_clone (tree new_decl, gcov_type gcov_count, int freq,
if (call_duplication_hook)
symtab->call_cgraph_duplication_hooks (this, new_node);
+
+ if (!new_inlined_to)
+ dump_callgraph_transformation (this, new_node, suffix);
+
return new_node;
}
@@ -575,7 +604,7 @@ cgraph_node::create_virtual_clone (vec<cgraph_edge *> redirect_callers,
SET_DECL_RTL (new_decl, NULL);
new_node = create_clone (new_decl, count, CGRAPH_FREQ_BASE, false,
- redirect_callers, false, NULL, args_to_skip);
+ redirect_callers, false, NULL, args_to_skip, suffix);
/* Update the properties.
Make clone visible only within this translation unit. Make sure
@@ -863,7 +892,8 @@ update_call_expr (cgraph_node *new_version)
cgraph_node *
cgraph_node::create_version_clone (tree new_decl,
vec<cgraph_edge *> redirect_callers,
- bitmap bbs_to_copy)
+ bitmap bbs_to_copy,
+ const char *suffix)
{
cgraph_node *new_version;
cgraph_edge *e;
@@ -904,6 +934,8 @@ cgraph_node::create_version_clone (tree new_decl,
symtab->call_cgraph_duplication_hooks (this, new_version);
+ dump_callgraph_transformation (this, new_version, suffix);
+
return new_version;
}
@@ -931,7 +963,7 @@ cgraph_node::create_version_clone_with_body
(vec<cgraph_edge *> redirect_callers,
vec<ipa_replace_map *, va_gc> *tree_map, bitmap args_to_skip,
bool skip_return, bitmap bbs_to_copy, basic_block new_entry_block,
- const char *clone_name)
+ const char *suffix)
{
tree old_decl = decl;
cgraph_node *new_version_node = NULL;
@@ -950,7 +982,7 @@ cgraph_node::create_version_clone_with_body
= build_function_decl_skip_args (old_decl, args_to_skip, skip_return);
/* Generate a new name for the new version. */
- DECL_NAME (new_decl) = clone_function_name (old_decl, clone_name);
+ DECL_NAME (new_decl) = clone_function_name (old_decl, suffix);
SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
SET_DECL_RTL (new_decl, NULL);
@@ -961,7 +993,7 @@ cgraph_node::create_version_clone_with_body
/* Create the new version's call-graph node.
and update the edges of the new node. */
new_version_node = create_version_clone (new_decl, redirect_callers,
- bbs_to_copy);
+ bbs_to_copy, suffix);
if (ipa_transforms_to_apply.exists ())
new_version_node->ipa_transforms_to_apply
diff --git a/gcc/combine.c b/gcc/combine.c
index 22fb7a9..a8dae89 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -9176,7 +9176,7 @@ if_then_else_cond (rtx x, rtx *ptrue, rtx *pfalse)
/* If X is known to be either 0 or -1, those are the true and
false values when testing X. */
else if (x == constm1_rtx || x == const0_rtx
- || (mode != VOIDmode
+ || (mode != VOIDmode && mode != BLKmode
&& num_sign_bit_copies (x, mode) == GET_MODE_PRECISION (mode)))
{
*ptrue = constm1_rtx, *pfalse = const0_rtx;
@@ -11251,6 +11251,7 @@ change_zero_ext (rtx pat)
else if (GET_CODE (x) == ZERO_EXTEND
&& SCALAR_INT_MODE_P (mode)
&& GET_CODE (XEXP (x, 0)) == SUBREG
+ && SCALAR_INT_MODE_P (GET_MODE (SUBREG_REG (XEXP (x, 0))))
&& !paradoxical_subreg_p (XEXP (x, 0))
&& subreg_lowpart_p (XEXP (x, 0)))
{
diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c
index 1dbddae..9f87122 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -69,9 +69,7 @@ arc_handle_option (struct gcc_options *opts,
{
size_t code = decoded->opt_index;
int value = decoded->value;
- const char *arg = decoded->arg;
static int mcpu_seen = PROCESSOR_NONE;
- char *p;
switch (code)
{
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 26982f6..bc6d8a2 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -1611,11 +1611,15 @@
(match_operand:GPI 2 "aarch64_pluslong_operand" "")))]
""
{
+ /* If operands[1] is a subreg extract the inner RTX. */
+ rtx op1 = REG_P (operands[1]) ? operands[1] : SUBREG_REG (operands[1]);
+
/* If the constant is too large for a single instruction and isn't frame
based, split off the immediate so it is available for CSE. */
if (!aarch64_plus_immediate (operands[2], <MODE>mode)
&& can_create_pseudo_p ()
- && !REGNO_PTR_FRAME_P (REGNO (operands[1])))
+ && (!REG_P (op1)
+ || !REGNO_PTR_FRAME_P (REGNO (op1))))
operands[2] = force_reg (<MODE>mode, operands[2]);
})
diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h
index d1266b4..83a0b73 100644
--- a/gcc/config/arc/arc-protos.h
+++ b/gcc/config/arc/arc-protos.h
@@ -123,3 +123,4 @@ extern bool arc_legitimize_reload_address (rtx *, machine_mode, int, int);
extern void arc_secondary_reload_conv (rtx, rtx, rtx, bool);
extern bool insn_is_tls_gd_dispatch (rtx_insn *);
extern void arc_cpu_cpp_builtins (cpp_reader *);
+extern bool arc_store_addr_hazard_p (rtx_insn *, rtx_insn *);
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index dce66a1..832f567 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -6504,6 +6504,58 @@ arc_invalid_within_doloop (const rtx_insn *insn)
return NULL;
}
+/* Return true if a load instruction (CONSUMER) uses the same address as a
+ store instruction (PRODUCER). This function is used to avoid st/ld
+ address hazard in ARC700 cores. */
+bool
+arc_store_addr_hazard_p (rtx_insn* producer, rtx_insn* consumer)
+{
+ rtx in_set, out_set;
+ rtx out_addr, in_addr;
+
+ if (!producer)
+ return false;
+
+ if (!consumer)
+ return false;
+
+ /* Peel the producer and the consumer for the address. */
+ out_set = single_set (producer);
+ if (out_set)
+ {
+ out_addr = SET_DEST (out_set);
+ if (!out_addr)
+ return false;
+ if (GET_CODE (out_addr) == ZERO_EXTEND
+ || GET_CODE (out_addr) == SIGN_EXTEND)
+ out_addr = XEXP (out_addr, 0);
+
+ if (!MEM_P (out_addr))
+ return false;
+
+ in_set = single_set (consumer);
+ if (in_set)
+ {
+ in_addr = SET_SRC (in_set);
+ if (!in_addr)
+ return false;
+ if (GET_CODE (in_addr) == ZERO_EXTEND
+ || GET_CODE (in_addr) == SIGN_EXTEND)
+ in_addr = XEXP (in_addr, 0);
+
+ if (!MEM_P (in_addr))
+ return false;
+ /* Get rid of the MEM and check if the addresses are
+ equivalent. */
+ in_addr = XEXP (in_addr, 0);
+ out_addr = XEXP (out_addr, 0);
+
+ return exp_equiv_p (in_addr, out_addr, 0, true);
+ }
+ }
+ return false;
+}
+
/* The same functionality as arc_hazard. It is called in machine
reorg before any other optimization. Hence, the NOP size is taken
into account when doing branch shortening. */
@@ -6522,6 +6574,29 @@ workaround_arc_anomaly (void)
emit_insn_before (gen_nopv (), succ0);
}
}
+
+ if (TARGET_ARC700)
+ {
+ rtx_insn *succ1;
+
+ for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+ {
+ succ0 = next_real_insn (insn);
+ if (arc_store_addr_hazard_p (insn, succ0))
+ {
+ emit_insn_after (gen_nopv (), insn);
+ emit_insn_after (gen_nopv (), insn);
+ continue;
+ }
+
+ /* Avoid adding nops if the instruction between the ST and LD is
+ a call or jump. */
+ succ1 = next_real_insn (succ0);
+ if (succ0 && !JUMP_P (succ0) && !CALL_P (succ0)
+ && arc_store_addr_hazard_p (insn, succ1))
+ emit_insn_after (gen_nopv (), insn);
+ }
+ }
}
static int arc_reorg_in_progress = 0;
diff --git a/gcc/config/arc/arc700.md b/gcc/config/arc/arc700.md
index 4d9bddf..3eb5199 100644
--- a/gcc/config/arc/arc700.md
+++ b/gcc/config/arc/arc700.md
@@ -168,3 +168,5 @@
(eq_attr "type" "store")
(not (match_operand:DI 0 "" "")))
"issue+dmp_write_port")
+
+(define_bypass 3 "data_store" "data_load" "arc_store_addr_hazard_p")
diff --git a/gcc/config/arm/t-rmprofile b/gcc/config/arm/t-rmprofile
index c8b5c9c..93aa909 100644
--- a/gcc/config/arm/t-rmprofile
+++ b/gcc/config/arm/t-rmprofile
@@ -102,6 +102,8 @@ MULTILIB_MATCHES += march?armv6s-m=mcpu?cortex-m1.small-multiply
MULTILIB_MATCHES += march?armv7-m=mcpu?cortex-m3
MULTILIB_MATCHES += march?armv7e-m=mcpu?cortex-m4
MULTILIB_MATCHES += march?armv7e-m=mcpu?cortex-m7
+MULTILIB_MATCHES += march?armv8-m.base=mcpu?cortex-m23
+MULTILIB_MATCHES += march?armv8-m.main=mcpu?cortex-m33
MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4
MULTILIB_MATCHES += march?armv7=mcpu?cortex-r4f
MULTILIB_MATCHES += march?armv7=mcpu?cortex-r5
diff --git a/gcc/config/avr/avr-arch.h b/gcc/config/avr/avr-arch.h
index a740a15..e6a2d75 100644
--- a/gcc/config/avr/avr-arch.h
+++ b/gcc/config/avr/avr-arch.h
@@ -122,6 +122,9 @@ typedef struct
/* Number of 64k segments in the flash. */
int n_flash;
+
+ /* Flash size in bytes. */
+ int flash_size;
} avr_mcu_t;
/* AVR device specific features.
diff --git a/gcc/config/avr/avr-devices.c b/gcc/config/avr/avr-devices.c
index 7d13ba4..cef3b9a 100644
--- a/gcc/config/avr/avr-devices.c
+++ b/gcc/config/avr/avr-devices.c
@@ -111,12 +111,12 @@ avr_texinfo[] =
const avr_mcu_t
avr_mcu_types[] =
{
-#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH)\
- { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH },
+#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, FLASH_SIZE)\
+ { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH, FLASH_SIZE },
#include "avr-mcus.def"
#undef AVR_MCU
/* End of list. */
- { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0 }
+ { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0, 0 }
};
diff --git a/gcc/config/avr/gen-avr-mmcu-specs.c b/gcc/config/avr/gen-avr-mmcu-specs.c
index 9ea987f..ee75b1e 100644
--- a/gcc/config/avr/gen-avr-mmcu-specs.c
+++ b/gcc/config/avr/gen-avr-mmcu-specs.c
@@ -215,17 +215,16 @@ print_mcu (const avr_mcu_t *mcu)
// avr-specific specs for linking / the linker.
int wrap_k =
- str_prefix_p (mcu->name, "at90usb8") ? 8
- : str_prefix_p (mcu->name, "atmega16") ? 16
- : (str_prefix_p (mcu->name, "atmega32")
- || str_prefix_p (mcu->name, "at90can32")) ? 32
- : (str_prefix_p (mcu->name, "atmega64")
- || str_prefix_p (mcu->name, "at90can64")
- || str_prefix_p (mcu->name, "at90usb64")) ? 64
+ mcu->flash_size == 0x2000 ? 8
+ : mcu->flash_size == 0x4000 ? 16
+ : mcu->flash_size == 0x8000 ? 32
+ : mcu->flash_size == 0x10000 ? 64
: 0;
fprintf (f, "*link_pmem_wrap:\n");
- if (wrap_k)
+ if (wrap_k == 8)
+ fprintf (f, "\t%%{!mno-pmem-wrap-around: --pmem-wrap-around=8k}");
+ else if (wrap_k > 8)
fprintf (f, "\t%%{mpmem-wrap-around: --pmem-wrap-around=%dk}", wrap_k);
fprintf (f, "\n\n");
diff --git a/gcc/config/avr/specs.h b/gcc/config/avr/specs.h
index 222ad5b..b5fef33 100644
--- a/gcc/config/avr/specs.h
+++ b/gcc/config/avr/specs.h
@@ -58,7 +58,7 @@ along with GCC; see the file COPYING3. If not see
"%{mmcu=*:-m%*} "
#define LINK_RELAX_SPEC \
- "%{mrelax:--relax %(link_pmem_wrap)} "
+ "%{mrelax:--relax} "
#undef LINK_SPEC
#define LINK_SPEC \
@@ -66,6 +66,7 @@ along with GCC; see the file COPYING3. If not see
"%(link_data_start) " \
"%(link_text_start) " \
"%(link_relax) " \
+ "%(link_pmem_wrap) " \
"%{shared:%eshared is not supported} "
#undef LIB_SPEC
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 5018ccb..a5f5339 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -3723,7 +3723,7 @@ dimode_scalar_chain::convert_op (rtx *op, rtx_insn *insn)
emit_insn_before (seq, insn);
}
- emit_insn_before (gen_move_insn (tmp, vec_cst), insn);
+ emit_insn_before (gen_move_insn (copy_rtx (tmp), vec_cst), insn);
*op = tmp;
}
else
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 0a6a784..9fe98b7 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -7105,6 +7105,8 @@ rs6000_expand_vector_set (rtx target, rtx val, int elt)
int width = GET_MODE_SIZE (inner_mode);
int i;
+ val = force_reg (GET_MODE (val), val);
+
if (VECTOR_MEM_VSX_P (mode))
{
rtx insn = NULL_RTX;
@@ -7257,6 +7259,8 @@ rs6000_expand_vector_extract (rtx target, rtx vec, rtx elt)
convert_move (tmp, elt, 0);
elt = tmp;
}
+ else if (!REG_P (elt))
+ elt = force_reg (DImode, elt);
switch (mode)
{
diff --git a/gcc/config/rs6000/vsx.md b/gcc/config/rs6000/vsx.md
index 75c1625..01d275d 100644
--- a/gcc/config/rs6000/vsx.md
+++ b/gcc/config/rs6000/vsx.md
@@ -2856,7 +2856,7 @@
if (!VECTOR_ELT_ORDER_BIG)
ele = nunits - 1 - ele;
- operands[3] = GEN_INT (nunits * ele);
+ operands[3] = GEN_INT (GET_MODE_SIZE (<VS_scalar>mode) * ele);
if (<MODE>mode == V4SImode)
return "xxinsertw %x0,%x2,%3";
else
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index 5b23c3f..291d2ef 100644
--- a/gcc/dumpfile.c
+++ b/gcc/dumpfile.c
@@ -55,6 +55,8 @@ static struct dump_file_info dump_files[TDI_end] =
0, 0, 0, 0, 0, false, false},
{".type-inheritance", "ipa-type-inheritance", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
0, 0, 0, 0, 0, false, false},
+ {".ipa-clones", "ipa-clones", NULL, NULL, NULL, NULL, NULL, TDF_IPA,
+ 0, 0, 0, 0, 0, false, false},
{".tu", "translation-unit", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
0, 0, 0, 0, 1, false, false},
{".class", "class-hierarchy", NULL, NULL, NULL, NULL, NULL, TDF_TREE,
diff --git a/gcc/dumpfile.h b/gcc/dumpfile.h
index f366228..9ef4570 100644
--- a/gcc/dumpfile.h
+++ b/gcc/dumpfile.h
@@ -29,6 +29,7 @@ enum tree_dump_index
TDI_none, /* No dump */
TDI_cgraph, /* dump function call graph. */
TDI_inheritance, /* dump type inheritance graph. */
+ TDI_clones, /* dump IPA cloning decisions. */
TDI_tu, /* dump the whole translation unit. */
TDI_class, /* dump class hierarchy. */
TDI_original, /* dump each function before optimizing it */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 04ce2d1..02512d3 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -2826,10 +2826,10 @@ static void
verify_insn_sharing (rtx insn)
{
gcc_assert (INSN_P (insn));
- reset_used_flags (PATTERN (insn));
- reset_used_flags (REG_NOTES (insn));
+ verify_rtx_sharing (PATTERN (insn), insn);
+ verify_rtx_sharing (REG_NOTES (insn), insn);
if (CALL_P (insn))
- reset_used_flags (CALL_INSN_FUNCTION_USAGE (insn));
+ verify_rtx_sharing (CALL_INSN_FUNCTION_USAGE (insn), insn);
}
/* Go through all the RTL insn bodies and check that there is no unexpected
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index d0dd306..278c08f 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,102 @@
+2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ * check.c (gfc_check_allocated): By pass the caf_get call and check on
+ the array.
+ * gfortran.h: Add optional flag to gfc_caf_attr.
+ * gfortran.texi: Document new enum values and _caf_is_present function.
+ * primary.c (caf_variable_attr): Add optional flag to indicate that the
+ expression is reffing a component.
+ (gfc_caf_attr): Likewise.
+ * trans-array.c (gfc_array_deallocate): Handle deallocation mode for
+ coarray deregistration.
+ (gfc_trans_dealloc_allocated): Likewise.
+ (duplicate_allocatable): Use constants instead of
+ creating custom constant tree node of zero or one. Use gfc_add_modify
+ convenience function.
+ (duplicate_allocatable_coarray): This function is similar to
+ duplicate_allocatable but tailored to handle coarrays.
+ (caf_enabled): Check whether in-derived-type coarray processing is
+ enabled.
+ (caf_in_coarray): Check that in-derived-type coarray processing is
+ enabled and currently in a derived-typed coarray.
+ (gfc_caf_is_dealloc_only): Return true, when deallocate only is
+ desired for components in derived typed coarrays.
+ (structure_alloc_comps): A mode for handling coarrays, that is no
+ longer encode in the purpose. This makes the use cases of the
+ routine more flexible without repeating. Allocatable components in
+ derived type coarrays are now registered only when nullifying an
+ object and allocated before copying data into them.
+ (gfc_nullify_alloc_comp): Use the caf_mode of structure_alloc_comps
+ now.
+ (gfc_deallocate_alloc_comp): Likewise.
+ (gfc_deallocate_alloc_comp_no_caf): Likewise.
+ (gfc_reassign_alloc_comp_caf): Likewise.
+ (gfc_copy_alloc_comp): Likewise.
+ (gfc_copy_only_alloc_comp): Likewise.
+ (gfc_alloc_allocatable_for_assignment): Make use to the cheaper way of
+ reallocating a coarray without deregistering and reregistering it.
+ (gfc_trans_deferred_array): Initialize the coarray token correctly for
+ deferred variables and tear them down on exit.
+ * trans-array.h: Change some prototypes to add the coarray (de-)
+ registration modes. Add prototype for checking if deallocate only is
+ selected for components in derived typed coarrays.
+ * trans-decl.c (gfc_build_builtin_function_decls): Generate the
+ declarations for the changed/new caf-lib routines.
+ (gfc_trans_deferred_vars): Ensure deferred variables are (de-)
+ registered correctly on procedure entry/exit.
+ (generate_coarray_sym_init): Use constants.
+ * trans-expr.c (gfc_conv_procedure_call): Propagate coarray allocation
+ modes accordingly.
+ (gfc_trans_alloc_subarray_assign): Likewise.
+ (gfc_trans_subcomponent_assign): Likewise.
+ (gfc_trans_structure_assign): Generate code to register the components
+ of a derived type coarray prior to initialization.
+ (gfc_conv_structure): Set flag that the structure is in a coarray.
+ (gfc_trans_scalar_assign): Add flag to indicate being in a coarray and
+ set the structure_alloc_comps modes correctly.
+ (gfc_trans_assignment_1): Figure being in a coarray expression.
+ * trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Adapt to new
+ structure_alloc_comps interface.
+ (conv_caf_send): Use the old API as long as possible.
+ (trans_caf_is_present): Generate code to check whether an allocatable
+ component in a derived typed coarray is allocated on a remote image.
+ (caf_this_image_ref): Return true, when only reffing this image.
+ (gfc_conv_allocated): Convert allocated queries on allocatable
+ components to the library API.
+ (conv_intrinsic_move_alloc): Adapt to new interface of
+ structure_alloc_comps.
+ * trans-openmp.c (gfc_walk_alloc_comps): Likewise.
+ (gfc_omp_clause_assign_op): Likewise.
+ (gfc_omp_clause_dtor): Likewise.
+ * trans-stmt.c (gfc_trans_deallocate): Figure which mode to use when
+ deallocating allocatable components in derived type coarras.
+ * trans.c (gfc_allocate_using_lib): Renamed to
+ gfc_allcate_using_caf_lib.
+ (gfc_allocate_allocatable): Set the registration mode/type of caf-
+ register calls adapting to all the possible allocatable objects.
+ (gfc_deallocate_with_status): Add deregistration mode for allocatable
+ components in derived type coarrays.
+ (gfc_deallocate_scalar_with_status): Likewise.
+ * trans.h (enum gfc_coarray_type): Renamed to gfc_coarray_regtype to
+ avoid collision with gfc_coarray_deregtype.
+
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78593
+ * primary.c (gfc_match_varspec): Check if sym is non-null to avoid ICE.
+
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78592
+ * interface.c (gfc_find_specific_dtio_proc): Rearrange code to avoid
+ dereferencing a null pointer.
+
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78573
+ * decl.c (build_struct): On error, return directly and do not build
+ class symbol.
+
2016-11-29 Tobias Burnus <burnus@net-b.de>
PR fortran/58175
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 265fe22..3b80156 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -851,6 +851,17 @@ gfc_check_all_any (gfc_expr *mask, gfc_expr *dim)
bool
gfc_check_allocated (gfc_expr *array)
{
+ /* Tests on allocated components of coarrays need to detour the check to
+ argument of the _caf_get. */
+ if (flag_coarray == GFC_FCOARRAY_LIB && array->expr_type == EXPR_FUNCTION
+ && array->value.function.isym
+ && array->value.function.isym->id == GFC_ISYM_CAF_GET)
+ {
+ array = array->value.function.actual->expr;
+ if (!array->ref)
+ return false;
+ }
+
if (!variable_check (array, 0, false))
return false;
if (!allocatable_check (array, 0))
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 21eaafe..411d496d 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1850,7 +1850,6 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_state_data *s;
gfc_component *c;
- bool t = true;
/* F03:C438/C439. If the current symbol is of the same derived type that we're
constructing, it must have the pointer attribute. */
@@ -1952,7 +1951,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_error ("Pointer array component of structure at %C must have a "
"deferred shape");
- t = false;
+ return false;
}
}
else if (c->attr.allocatable)
@@ -1961,7 +1960,7 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_error ("Allocatable component of structure at %C must have a "
"deferred shape");
- t = false;
+ return false;
}
}
else
@@ -1970,20 +1969,15 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
{
gfc_error ("Array component of structure at %C must have an "
"explicit shape");
- t = false;
+ return false;
}
}
scalar:
if (c->ts.type == BT_CLASS)
- {
- bool t2 = gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
+ return gfc_build_class_symbol (&c->ts, &c->attr, &c->as);
- if (t)
- t = t2;
- }
-
- return t;
+ return true;
}
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 7956630..370b2a0 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -3274,7 +3274,7 @@ const char *gfc_dt_upper_string (const char *);
/* primary.c */
symbol_attribute gfc_variable_attr (gfc_expr *, gfc_typespec *);
symbol_attribute gfc_expr_attr (gfc_expr *);
-symbol_attribute gfc_caf_attr (gfc_expr *, bool in_allocate = false);
+symbol_attribute gfc_caf_attr (gfc_expr *, bool i = false, bool *r = NULL);
match gfc_match_rvalue (gfc_expr **);
match gfc_match_varspec (gfc_expr*, int, bool, bool);
int gfc_check_digit (char, int);
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 6d8805c..5e2a750 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -3871,6 +3871,7 @@ of such a type
@menu
* caf_token_t::
* caf_register_t::
+* caf_deregister_t::
* caf_reference_t::
@end menu
@@ -3893,11 +3894,39 @@ typedef enum caf_register_t {
CAF_REGTYPE_LOCK_ALLOC,
CAF_REGTYPE_CRITICAL,
CAF_REGTYPE_EVENT_STATIC,
- CAF_REGTYPE_EVENT_ALLOC
+ CAF_REGTYPE_EVENT_ALLOC,
+ CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY,
+ CAF_REGTYPE_COARRAY_ALLOC_ALLOCATE_ONLY
}
caf_register_t;
@end verbatim
+The values @code{CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY} and
+@code{CAF_REGTYPE_COARRAY_ALLOC_ALLOCATE_ONLY} are for allocatable components
+in derived type coarrays only. The first one sets up the token without
+allocating memory for allocatable component. The latter one only allocates the
+memory for an allocatable component in a derived type coarray. The token
+needs to be setup previously by the REGISTER_ONLY. This allows to have
+allocatable components un-allocated on some images. The status whether an
+allocatable component is allocated on a remote image can be queried by
+@code{_caf_is_present} which used internally by the @code{ALLOCATED}
+intrinsic.
+
+@node caf_deregister_t
+@subsection @code{caf_deregister_t}
+
+@verbatim
+typedef enum caf_deregister_t {
+ CAF_DEREGTYPE_COARRAY_DEREGISTER,
+ CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY
+}
+caf_deregister_t;
+@end verbatim
+
+Allows to specifiy the type of deregistration of a coarray object. The
+@code{CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY} flag is only allowed for
+allocatable components in derived type coarrays.
+
@node caf_reference_t
@subsection @code{caf_reference_t}
@@ -4017,6 +4046,7 @@ descriptor-less arrays. The library caf_single has untested support for it.
* _gfortran_caf_num_images:: Querying the maximal number of images
* _gfortran_caf_register:: Registering coarrays
* _gfortran_caf_deregister:: Deregistering coarrays
+* _gfortran_caf_is_present:: Query whether an allocatable component in a derived type coarray is allocated
* _gfortran_caf_send:: Sending data from a local image to a remote image
* _gfortran_caf_get:: Getting data from a remote image
* _gfortran_caf_sendget:: Sending data between remote images
@@ -4218,6 +4248,7 @@ section) such as the value false; for event types, the initial state should
be no event, e.g. zero.
@end table
+
@node _gfortran_caf_deregister
@subsection @code{_gfortran_caf_deregister} --- Deregistering coarrays
@cindex Coarray, _gfortran_caf_deregister
@@ -4231,12 +4262,16 @@ library is only expected to free memory it allocated itself during a call to
@code{_gfortran_caf_register}.
@item @emph{Syntax}:
-@code{void caf_deregister (caf_token_t *token, int *stat, char *errmsg,
-int errmsg_len)}
+@code{void caf_deregister (caf_token_t *token, caf_deregister_t type,
+int *stat, char *errmsg, int errmsg_len)}
@item @emph{Arguments}:
@multitable @columnfractions .15 .70
@item @var{token} @tab the token to free.
+@item @var{type} @tab the type of action to take for the coarray. A
+@code{CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY} is allowed only for allocatable
+components of derived type coarrays. The action only deallocates the local
+memory without deleting the token.
@item @var{stat} @tab intent(out) Stores the STAT=; may be NULL
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set
to an error message; may be NULL
@@ -4250,6 +4285,31 @@ and via destructors.
@end table
+@node _gfortran_caf_is_present
+@subsection @code{_gfortran_caf_is_present} --- Query whether an allocatable component in a derived type coarray is allocated
+@cindex Coarray, _gfortran_caf_is_present
+
+@table @asis
+@item @emph{Description}:
+Used to query the coarray library whether an allocatable component in a derived
+type coarray is allocated on a remote image.
+
+@item @emph{Syntax}:
+@code{void _gfortran_caf_is_present (caf_token_t token, int image_index,
+gfc_reference_t *ref)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{token} @tab An opaque pointer identifying the coarray.
+@item @var{image_index} @tab The ID of the remote image; must be a positive
+number.
+@item @var{ref} @tab A chain of references to address the allocatable component
+in the derived type coarray. The object reffed needs to be a scalar or a full
+array ref, respectively.
+@end multitable
+
+@end table
+
@node _gfortran_caf_send
@subsection @code{_gfortran_caf_send} --- Sending data from a local image to a remote image
@cindex Coarray, _gfortran_caf_send
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c
index f5d3f77..8afba84 100644
--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -4933,15 +4933,15 @@ gfc_find_specific_dtio_proc (gfc_symbol *derived, bool write, bool formatted)
&& tb_io_st->n.sym
&& tb_io_st->n.sym->generic)
{
- gfc_interface *intr;
- for (intr = tb_io_st->n.sym->generic; intr; intr = intr->next)
+ for (gfc_interface *intr = tb_io_st->n.sym->generic;
+ intr && intr->sym && intr->sym->formal;
+ intr = intr->next)
{
gfc_symbol *fsym = intr->sym->formal->sym;
- if (intr->sym && intr->sym->formal
- && ((fsym->ts.type == BT_CLASS
- && CLASS_DATA (fsym)->ts.u.derived == extended)
- || (fsym->ts.type == BT_DERIVED
- && fsym->ts.u.derived == extended)))
+ if ((fsym->ts.type == BT_CLASS
+ && CLASS_DATA (fsym)->ts.u.derived == extended)
+ || (fsym->ts.type == BT_DERIVED
+ && fsym->ts.u.derived == extended))
{
dtio_sub = intr->sym;
break;
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 50d7072..eb2d780 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2050,7 +2050,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag,
if (m != MATCH_YES)
return MATCH_ERROR;
- if (sym->f2k_derived)
+ if (sym && sym->f2k_derived)
tbp = gfc_find_typebound_proc (sym, &t, name, false, &gfc_current_locus);
else
tbp = NULL;
@@ -2418,10 +2418,15 @@ gfc_expr_attr (gfc_expr *e)
attribute is. This routine is similar to gfc_variable_attr with
parts of gfc_expr_attr, but focuses more on the needs of
coarrays. For coarrays a codimension attribute is kind of
- "infectious" being propagated once set and never cleared. */
+ "infectious" being propagated once set and never cleared.
+ The coarray_comp is only set, when the expression refs a coarray
+ component. REFS_COMP is set when present to true only, when this EXPR
+ refs a (non-_data) component. To check whether EXPR refs an allocatable
+ component in a derived type coarray *refs_comp needs to be set and
+ coarray_comp has to false. */
static symbol_attribute
-caf_variable_attr (gfc_expr *expr, bool in_allocate)
+caf_variable_attr (gfc_expr *expr, bool in_allocate, bool *refs_comp)
{
int dimension, codimension, pointer, allocatable, target, coarray_comp,
alloc_comp;
@@ -2436,13 +2441,15 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate)
sym = expr->symtree->n.sym;
gfc_clear_attr (&attr);
+ if (refs_comp)
+ *refs_comp = 0;
+
if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
{
dimension = CLASS_DATA (sym)->attr.dimension;
codimension = CLASS_DATA (sym)->attr.codimension;
pointer = CLASS_DATA (sym)->attr.class_pointer;
allocatable = CLASS_DATA (sym)->attr.allocatable;
- coarray_comp = CLASS_DATA (sym)->attr.coarray_comp;
alloc_comp = CLASS_DATA (sym)->ts.u.derived->attr.alloc_comp;
}
else
@@ -2451,12 +2458,11 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate)
codimension = sym->attr.codimension;
pointer = sym->attr.pointer;
allocatable = sym->attr.allocatable;
- coarray_comp = sym->attr.coarray_comp;
alloc_comp = sym->ts.type == BT_DERIVED
? sym->ts.u.derived->attr.alloc_comp : 0;
}
- target = attr.target;
+ target = coarray_comp = 0;
if (pointer || attr.proc_pointer)
target = 1;
@@ -2494,19 +2500,26 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate)
if (comp->ts.type == BT_CLASS)
{
+ /* Set coarray_comp only, when this component introduces the
+ coarray. */
+ coarray_comp = !codimension && CLASS_DATA (comp)->attr.codimension;
codimension |= CLASS_DATA (comp)->attr.codimension;
pointer = CLASS_DATA (comp)->attr.class_pointer;
allocatable = CLASS_DATA (comp)->attr.allocatable;
- coarray_comp |= CLASS_DATA (comp)->attr.coarray_comp;
}
else
{
+ /* Set coarray_comp only, when this component introduces the
+ coarray. */
+ coarray_comp = !codimension && comp->attr.codimension;
codimension |= comp->attr.codimension;
pointer = comp->attr.pointer;
allocatable = comp->attr.allocatable;
- coarray_comp |= comp->attr.coarray_comp;
}
+ if (refs_comp && strcmp (comp->name, "_data") != 0)
+ *refs_comp = 1;
+
if (pointer || attr.proc_pointer)
target = 1;
@@ -2531,14 +2544,14 @@ caf_variable_attr (gfc_expr *expr, bool in_allocate)
symbol_attribute
-gfc_caf_attr (gfc_expr *e, bool in_allocate)
+gfc_caf_attr (gfc_expr *e, bool in_allocate, bool *refs_comp)
{
symbol_attribute attr;
switch (e->expr_type)
{
case EXPR_VARIABLE:
- attr = caf_variable_attr (e, in_allocate);
+ attr = caf_variable_attr (e, in_allocate, refs_comp);
break;
case EXPR_FUNCTION:
@@ -2557,7 +2570,7 @@ gfc_caf_attr (gfc_expr *e, bool in_allocate)
}
}
else if (e->symtree)
- attr = caf_variable_attr (e, in_allocate);
+ attr = caf_variable_attr (e, in_allocate, refs_comp);
else
gfc_clear_attr (&attr);
break;
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 1708f7c..803462a4 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -5633,12 +5633,13 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
tree
gfc_array_deallocate (tree descriptor, tree pstat, tree errmsg, tree errlen,
- tree label_finish, gfc_expr* expr)
+ tree label_finish, gfc_expr* expr,
+ int coarray_dealloc_mode)
{
tree var;
tree tmp;
stmtblock_t block;
- bool coarray = gfc_caf_attr (expr).codimension;
+ bool coarray = coarray_dealloc_mode != GFC_CAF_COARRAY_NOCOARRAY;
gfc_start_block (&block);
@@ -5648,7 +5649,8 @@ gfc_array_deallocate (tree descriptor, tree pstat, tree errmsg, tree errlen,
/* Parameter is the address of the data component. */
tmp = gfc_deallocate_with_status (coarray ? descriptor : var, pstat, errmsg,
- errlen, label_finish, false, expr, coarray);
+ errlen, label_finish, false, expr,
+ coarray_dealloc_mode);
gfc_add_expr_to_block (&block, tmp);
/* Zero the data pointer; only for coarrays an error can occur and then
@@ -7782,11 +7784,13 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
/* Generate code to deallocate an array, if it is allocated. */
tree
-gfc_trans_dealloc_allocated (tree descriptor, bool coarray, gfc_expr *expr)
+gfc_trans_dealloc_allocated (tree descriptor, gfc_expr *expr,
+ int coarray_dealloc_mode)
{
tree tmp;
tree var;
stmtblock_t block;
+ bool coarray = coarray_dealloc_mode != GFC_CAF_COARRAY_NOCOARRAY;
gfc_start_block (&block);
@@ -7797,8 +7801,8 @@ gfc_trans_dealloc_allocated (tree descriptor, bool coarray, gfc_expr *expr)
Although it is ignored here, it's presence ensures that arrays that
are already deallocated are ignored. */
tmp = gfc_deallocate_with_status (coarray ? descriptor : var, NULL_TREE,
- NULL_TREE, NULL_TREE, NULL_TREE, true,
- expr, coarray);
+ NULL_TREE, NULL_TREE, NULL_TREE, true, expr,
+ coarray_dealloc_mode);
gfc_add_expr_to_block (&block, tmp);
/* Zero the data pointer. */
@@ -7855,9 +7859,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank,
if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest)))
{
- tmp = null_pointer_node;
- tmp = fold_build2_loc (input_location, MODIFY_EXPR, type, dest, tmp);
- gfc_add_expr_to_block (&block, tmp);
+ gfc_add_modify (&block, dest, fold_convert (type, null_pointer_node));
null_data = gfc_finish_block (&block);
gfc_init_block (&block);
@@ -7869,9 +7871,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank,
if (!no_malloc)
{
tmp = gfc_call_malloc (&block, type, size);
- tmp = fold_build2_loc (input_location, MODIFY_EXPR, void_type_node,
- dest, fold_convert (type, tmp));
- gfc_add_expr_to_block (&block, tmp);
+ gfc_add_modify (&block, dest, fold_convert (type, tmp));
}
if (!no_memcpy)
@@ -7967,17 +7967,152 @@ gfc_duplicate_allocatable_nocopy (tree dest, tree src, tree type, int rank)
}
+static tree
+duplicate_allocatable_coarray (tree dest, tree dest_tok, tree src,
+ tree type, int rank)
+{
+ tree tmp;
+ tree size;
+ tree nelems;
+ tree null_cond;
+ tree null_data;
+ stmtblock_t block, globalblock;
+
+ /* If the source is null, set the destination to null. Then,
+ allocate memory to the destination. */
+ gfc_init_block (&block);
+ gfc_init_block (&globalblock);
+
+ if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (dest)))
+ {
+ gfc_se se;
+ symbol_attribute attr;
+ tree dummy_desc;
+
+ gfc_init_se (&se, NULL);
+ dummy_desc = gfc_conv_scalar_to_descriptor (&se, dest, attr);
+ gfc_add_block_to_block (&globalblock, &se.pre);
+ size = TYPE_SIZE_UNIT (TREE_TYPE (type));
+
+ gfc_add_modify (&block, dest, fold_convert (type, null_pointer_node));
+ gfc_allocate_using_caf_lib (&block, dummy_desc, size,
+ gfc_build_addr_expr (NULL_TREE, dest_tok),
+ NULL_TREE, NULL_TREE, NULL_TREE,
+ GFC_CAF_COARRAY_ALLOC_REGISTER_ONLY);
+ null_data = gfc_finish_block (&block);
+
+ gfc_init_block (&block);
+
+ gfc_allocate_using_caf_lib (&block, dummy_desc,
+ fold_convert (size_type_node, size),
+ gfc_build_addr_expr (NULL_TREE, dest_tok),
+ NULL_TREE, NULL_TREE, NULL_TREE,
+ GFC_CAF_COARRAY_ALLOC);
+
+ tmp = builtin_decl_explicit (BUILT_IN_MEMCPY);
+ tmp = build_call_expr_loc (input_location, tmp, 3, dest, src,
+ fold_convert (size_type_node, size));
+ gfc_add_expr_to_block (&block, tmp);
+ }
+ else
+ {
+ /* Set the rank or unitialized memory access may be reported. */
+ tmp = gfc_conv_descriptor_dtype (dest);
+ gfc_add_modify (&globalblock, tmp, build_int_cst (TREE_TYPE (tmp), rank));
+
+ if (rank)
+ nelems = gfc_full_array_size (&block, src, rank);
+ else
+ nelems = integer_one_node;
+
+ tmp = fold_convert (size_type_node,
+ TYPE_SIZE_UNIT (gfc_get_element_type (type)));
+ size = fold_build2_loc (input_location, MULT_EXPR, size_type_node,
+ fold_convert (size_type_node, nelems), tmp);
+
+ gfc_conv_descriptor_data_set (&block, dest, null_pointer_node);
+ gfc_allocate_using_caf_lib (&block, dest, fold_convert (size_type_node,
+ size),
+ gfc_build_addr_expr (NULL_TREE, dest_tok),
+ NULL_TREE, NULL_TREE, NULL_TREE,
+ GFC_CAF_COARRAY_ALLOC_REGISTER_ONLY);
+ null_data = gfc_finish_block (&block);
+
+ gfc_init_block (&block);
+ gfc_allocate_using_caf_lib (&block, dest,
+ fold_convert (size_type_node, size),
+ gfc_build_addr_expr (NULL_TREE, dest_tok),
+ NULL_TREE, NULL_TREE, NULL_TREE,
+ GFC_CAF_COARRAY_ALLOC);
+
+ tmp = builtin_decl_explicit (BUILT_IN_MEMCPY);
+ tmp = build_call_expr_loc (input_location, tmp, 3,
+ gfc_conv_descriptor_data_get (dest),
+ gfc_conv_descriptor_data_get (src),
+ fold_convert (size_type_node, size));
+ gfc_add_expr_to_block (&block, tmp);
+ }
+
+ tmp = gfc_finish_block (&block);
+
+ /* Null the destination if the source is null; otherwise do
+ the register and copy. */
+ if (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (src)))
+ null_cond = src;
+ else
+ null_cond = gfc_conv_descriptor_data_get (src);
+
+ null_cond = convert (pvoid_type_node, null_cond);
+ null_cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ null_cond, null_pointer_node);
+ gfc_add_expr_to_block (&globalblock, build3_v (COND_EXPR, null_cond, tmp,
+ null_data));
+ return gfc_finish_block (&globalblock);
+}
+
+
+/* Helper function to abstract whether coarray processing is enabled. */
+
+static bool
+caf_enabled (int caf_mode)
+{
+ return (caf_mode & GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY)
+ == GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY;
+}
+
+
+/* Helper function to abstract whether coarray processing is enabled
+ and we are in a derived type coarray. */
+
+static bool
+caf_in_coarray (int caf_mode)
+{
+ static const int pat = GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY
+ | GFC_STRUCTURE_CAF_MODE_IN_COARRAY;
+ return (caf_mode & pat) == pat;
+}
+
+
+/* Helper function to abstract whether coarray is to deallocate only. */
+
+bool
+gfc_caf_is_dealloc_only (int caf_mode)
+{
+ return (caf_mode & GFC_STRUCTURE_CAF_MODE_DEALLOC_ONLY)
+ == GFC_STRUCTURE_CAF_MODE_DEALLOC_ONLY;
+}
+
+
/* Recursively traverse an object of derived type, generating code to
deallocate, nullify or copy allocatable components. This is the work horse
function for the functions named in this enum. */
-enum {DEALLOCATE_ALLOC_COMP = 1, DEALLOCATE_ALLOC_COMP_NO_CAF,
- NULLIFY_ALLOC_COMP, COPY_ALLOC_COMP, COPY_ONLY_ALLOC_COMP,
- COPY_ALLOC_COMP_CAF};
+enum {DEALLOCATE_ALLOC_COMP = 1, NULLIFY_ALLOC_COMP,
+ COPY_ALLOC_COMP, COPY_ONLY_ALLOC_COMP, REASSIGN_CAF_COMP};
static tree
structure_alloc_comps (gfc_symbol * der_type, tree decl,
- tree dest, int rank, int purpose)
+ tree dest, int rank, int purpose, int caf_mode)
{
gfc_component *c;
gfc_loopinfo loop;
@@ -8011,10 +8146,10 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
/* Deref dest in sync with decl, but only when it is not NULL. */
if (dest)
dest = build_fold_indirect_ref_loc (input_location, dest);
- }
- /* Just in case it gets dereferenced. */
- decl_type = TREE_TYPE (decl);
+ /* Update the decl_type because it got dereferenced. */
+ decl_type = TREE_TYPE (decl);
+ }
/* If this is an array of derived types with allocatable components
build a loop and recursively call this function. */
@@ -8056,16 +8191,18 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
vref = gfc_build_array_ref (var, index, NULL);
- if (purpose == COPY_ALLOC_COMP || purpose == COPY_ONLY_ALLOC_COMP)
- {
+ if ((purpose == COPY_ALLOC_COMP || purpose == COPY_ONLY_ALLOC_COMP)
+ && !caf_enabled (caf_mode))
+ {
tmp = build_fold_indirect_ref_loc (input_location,
gfc_conv_array_data (dest));
dref = gfc_build_array_ref (tmp, index, NULL);
tmp = structure_alloc_comps (der_type, vref, dref, rank,
- COPY_ALLOC_COMP);
+ COPY_ALLOC_COMP, 0);
}
else
- tmp = structure_alloc_comps (der_type, vref, NULL_TREE, rank, purpose);
+ tmp = structure_alloc_comps (der_type, vref, NULL_TREE, rank, purpose,
+ caf_mode);
gfc_add_expr_to_block (&loopbody, tmp);
@@ -8111,7 +8248,6 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
switch (purpose)
{
case DEALLOCATE_ALLOC_COMP:
- case DEALLOCATE_ALLOC_COMP_NO_CAF:
/* gfc_deallocate_scalar_with_status calls gfc_deallocate_alloc_comp
(i.e. this function) so generate all the calls and suppress the
@@ -8128,21 +8264,57 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
/* The finalizer frees allocatable components. */
called_dealloc_with_status
= gfc_add_comp_finalizer_call (&tmpblock, comp, c,
- purpose == DEALLOCATE_ALLOC_COMP);
+ purpose == DEALLOCATE_ALLOC_COMP
+ && caf_enabled (caf_mode));
}
else
comp = NULL_TREE;
- if (c->attr.allocatable && !c->attr.proc_pointer
+ if (c->attr.allocatable && !c->attr.proc_pointer && !same_type
&& (c->attr.dimension
- || (c->attr.codimension
- && purpose != DEALLOCATE_ALLOC_COMP_NO_CAF))
- && !same_type)
+ || (caf_enabled (caf_mode)
+ && (caf_in_coarray (caf_mode) || c->attr.codimension))))
{
+ /* Allocatable arrays or coarray'ed components (scalar or
+ array). */
+ int caf_dereg_mode
+ = (caf_in_coarray (caf_mode) || c->attr.codimension)
+ ? (gfc_caf_is_dealloc_only (caf_mode)
+ ? GFC_CAF_COARRAY_DEALLOCATE_ONLY
+ : GFC_CAF_COARRAY_DEREGISTER)
+ : GFC_CAF_COARRAY_NOCOARRAY;
if (comp == NULL_TREE)
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
- tmp = gfc_trans_dealloc_allocated (comp, c->attr.codimension, NULL);
+
+ if (c->attr.dimension || c->attr.codimension)
+ /* Deallocate array. */
+ tmp = gfc_trans_dealloc_allocated (comp, NULL, caf_dereg_mode);
+ else
+ {
+ /* Deallocate scalar. */
+ tree cond = fold_build2_loc (input_location, NE_EXPR,
+ boolean_type_node, comp,
+ build_int_cst (TREE_TYPE (comp),
+ 0));
+
+ tmp = fold_build3_loc (input_location, COMPONENT_REF,
+ pvoid_type_node, decl, c->caf_token,
+ NULL_TREE);
+ tmp = build_call_expr_loc (input_location,
+ gfor_fndecl_caf_deregister, 5,
+ gfc_build_addr_expr (NULL_TREE,
+ tmp),
+ build_int_cst (integer_type_node,
+ caf_dereg_mode),
+ null_pointer_node,
+ null_pointer_node,
+ integer_zero_node);
+ tmp = fold_build3_loc (input_location, COND_EXPR,
+ void_type_node, cond, tmp,
+ build_empty_stmt (input_location));
+ }
+
gfc_add_expr_to_block (&tmpblock, tmp);
}
else if (c->attr.allocatable && !c->attr.codimension && !same_type)
@@ -8152,7 +8324,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
- tmp = gfc_deallocate_scalar_with_status (comp, NULL, true, NULL,
+ tmp = gfc_deallocate_scalar_with_status (comp, NULL_TREE,
+ NULL_TREE, true, NULL,
c->ts);
gfc_add_expr_to_block (&tmpblock, tmp);
called_dealloc_with_status = true;
@@ -8168,8 +8341,6 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
tree is_allocated;
tree ubound;
tree cdesc;
- tree zero = build_int_cst (gfc_array_index_type, 0);
- tree unity = build_int_cst (gfc_array_index_type, 1);
tree data;
stmtblock_t dealloc_block;
@@ -8191,8 +8362,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
ubound = build_int_cst (gfc_array_index_type, 1);
}
- cdesc = gfc_get_array_type_bounds (tmp, 1, 0,
- &unity, &ubound, 1,
+ cdesc = gfc_get_array_type_bounds (tmp, 1, 0, &gfc_index_one_node,
+ &ubound, 1,
GFC_ARRAY_ALLOCATABLE, false);
cdesc = gfc_create_var (cdesc, "cdesc");
@@ -8201,11 +8372,13 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_add_modify (&dealloc_block, gfc_conv_descriptor_dtype (cdesc),
gfc_get_dtype_rank_type (1, tmp));
gfc_conv_descriptor_lbound_set (&dealloc_block, cdesc,
- zero, unity);
+ gfc_index_zero_node,
+ gfc_index_one_node);
gfc_conv_descriptor_stride_set (&dealloc_block, cdesc,
- zero, unity);
+ gfc_index_zero_node,
+ gfc_index_one_node);
gfc_conv_descriptor_ubound_set (&dealloc_block, cdesc,
- zero, ubound);
+ gfc_index_zero_node, ubound);
if (c->attr.dimension)
data = gfc_conv_descriptor_data_get (comp);
@@ -8247,7 +8420,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
else if (c->ts.type == BT_CLASS && CLASS_DATA (c)->attr.allocatable
&& (!CLASS_DATA (c)->attr.codimension
- || purpose != DEALLOCATE_ALLOC_COMP_NO_CAF))
+ || !caf_enabled (caf_mode)))
{
/* Allocatable CLASS components. */
@@ -8257,11 +8430,15 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
TREE_TYPE (tmp), comp, tmp, NULL_TREE);
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (comp)))
- tmp = gfc_trans_dealloc_allocated (comp,
- CLASS_DATA (c)->attr.codimension, NULL);
+ tmp = gfc_trans_dealloc_allocated (comp, NULL,
+ CLASS_DATA (c)->attr.codimension
+ ? GFC_CAF_COARRAY_DEREGISTER
+ : GFC_CAF_COARRAY_NOCOARRAY);
else
{
- tmp = gfc_deallocate_scalar_with_status (comp, NULL_TREE, true, NULL,
+ tmp = gfc_deallocate_scalar_with_status (comp, NULL_TREE,
+ NULL_TREE, true,
+ NULL,
CLASS_DATA (c)->ts);
gfc_add_expr_to_block (&tmpblock, tmp);
called_dealloc_with_status = true;
@@ -8317,7 +8494,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
decl, cdecl, NULL_TREE);
rank = c->as ? c->as->rank : 0;
tmp = structure_alloc_comps (c->ts.u.derived, comp, NULL_TREE,
- rank, purpose);
+ rank, purpose, caf_mode);
gfc_add_expr_to_block (&fnblock, tmp);
}
@@ -8326,14 +8503,20 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
break;
case NULLIFY_ALLOC_COMP:
- if (c->attr.pointer || c->attr.proc_pointer)
+ if (c->attr.pointer || c->attr.proc_pointer
+ || !(c->attr.allocatable || (c->ts.type == BT_CLASS
+ && CLASS_DATA (c)->attr.allocatable)
+ || cmp_has_alloc_comps))
continue;
- else if (c->attr.allocatable
- && (c->attr.dimension|| c->attr.codimension))
+
+ /* Coarrays need the component to be initialized before the api-call
+ is made. */
+ if (c->attr.allocatable && (c->attr.dimension || c->attr.codimension))
{
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
gfc_conv_descriptor_data_set (&fnblock, comp, null_pointer_node);
+ cmp_has_alloc_comps = false;
}
else if (c->attr.allocatable)
{
@@ -8354,6 +8537,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
build_int_cst (TREE_TYPE (comp), 0));
gfc_add_expr_to_block (&fnblock, tmp);
}
+ cmp_has_alloc_comps = false;
}
else if (c->ts.type == BT_CLASS && CLASS_DATA (c)->attr.allocatable)
{
@@ -8371,46 +8555,92 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
build_int_cst (TREE_TYPE (comp), 0));
gfc_add_expr_to_block (&fnblock, tmp);
}
+ cmp_has_alloc_comps = false;
+ }
+
+ if (flag_coarray == GFC_FCOARRAY_LIB
+ && (caf_in_coarray (caf_mode) || c->attr.codimension))
+ {
+ /* Register the component with the coarray library. */
+ tree token;
+
+ comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+ decl, cdecl, NULL_TREE);
+ if (c->attr.dimension || c->attr.codimension)
+ {
+ tmp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+ decl, cdecl, NULL_TREE);
+ token = gfc_conv_descriptor_token (tmp);
+ }
+ else
+ {
+ gfc_se se;
+ symbol_attribute attr;
+
+ gfc_init_se (&se, NULL);
+ gfc_clear_attr (&attr);
+ token = fold_build3_loc (input_location, COMPONENT_REF,
+ pvoid_type_node, decl, c->caf_token,
+ NULL_TREE);
+ comp = gfc_conv_scalar_to_descriptor (&se, comp, attr);
+ gfc_add_block_to_block (&fnblock, &se.pre);
+ }
+
+ /* NULL the member-token before registering it or uninitialized
+ memory accesses may occur. */
+ gfc_add_modify (&fnblock, token, fold_convert (TREE_TYPE (token),
+ null_pointer_node));
+ gfc_allocate_using_caf_lib (&fnblock, comp, size_zero_node,
+ gfc_build_addr_expr (NULL_TREE,
+ token),
+ NULL_TREE, NULL_TREE, NULL_TREE,
+ GFC_CAF_COARRAY_ALLOC_REGISTER_ONLY);
}
- else if (cmp_has_alloc_comps)
+
+ if (cmp_has_alloc_comps)
{
comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
decl, cdecl, NULL_TREE);
rank = c->as ? c->as->rank : 0;
tmp = structure_alloc_comps (c->ts.u.derived, comp, NULL_TREE,
- rank, purpose);
+ rank, purpose, caf_mode);
gfc_add_expr_to_block (&fnblock, tmp);
}
break;
- case COPY_ALLOC_COMP_CAF:
- if (!c->attr.codimension
- && (c->ts.type != BT_CLASS || CLASS_DATA (c)->attr.coarray_comp)
- && (c->ts.type != BT_DERIVED
- || !c->ts.u.derived->attr.coarray_comp))
- continue;
-
- comp = fold_build3_loc (input_location, COMPONENT_REF, ctype, decl,
- cdecl, NULL_TREE);
- dcmp = fold_build3_loc (input_location, COMPONENT_REF, ctype, dest,
- cdecl, NULL_TREE);
-
- if (c->attr.codimension)
+ case REASSIGN_CAF_COMP:
+ if (caf_enabled (caf_mode)
+ && (c->attr.codimension
+ || (c->ts.type == BT_CLASS
+ && (CLASS_DATA (c)->attr.coarray_comp
+ || caf_in_coarray (caf_mode)))
+ || (c->ts.type == BT_DERIVED
+ && (c->ts.u.derived->attr.coarray_comp
+ || caf_in_coarray (caf_mode))))
+ && !same_type)
{
- if (c->ts.type == BT_CLASS)
+ comp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+ decl, cdecl, NULL_TREE);
+ dcmp = fold_build3_loc (input_location, COMPONENT_REF, ctype,
+ dest, cdecl, NULL_TREE);
+
+ if (c->attr.codimension)
{
- comp = gfc_class_data_get (comp);
- dcmp = gfc_class_data_get (dcmp);
- }
- gfc_conv_descriptor_data_set (&fnblock, dcmp,
+ if (c->ts.type == BT_CLASS)
+ {
+ comp = gfc_class_data_get (comp);
+ dcmp = gfc_class_data_get (dcmp);
+ }
+ gfc_conv_descriptor_data_set (&fnblock, dcmp,
gfc_conv_descriptor_data_get (comp));
- }
- else
- {
- tmp = structure_alloc_comps (c->ts.u.derived, comp, dcmp,
- rank, purpose);
- gfc_add_expr_to_block (&fnblock, tmp);
-
+ }
+ else
+ {
+ tmp = structure_alloc_comps (c->ts.u.derived, comp, dcmp,
+ rank, purpose, caf_mode
+ | GFC_STRUCTURE_CAF_MODE_IN_COARRAY);
+ gfc_add_expr_to_block (&fnblock, tmp);
+ }
}
break;
@@ -8503,7 +8733,8 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_add_modify (&fnblock, dcmp, tmp);
add_when_allocated = structure_alloc_comps (c->ts.u.derived,
comp, dcmp,
- rank, purpose);
+ rank, purpose,
+ caf_mode);
}
else
add_when_allocated = NULL_TREE;
@@ -8530,11 +8761,24 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
gfc_add_expr_to_block (&fnblock, tmp);
}
else if (c->attr.allocatable && !c->attr.proc_pointer && !same_type
- && (!(cmp_has_alloc_comps && c->as) || c->attr.codimension))
+ && (!(cmp_has_alloc_comps && c->as) || c->attr.codimension
+ || caf_in_coarray (caf_mode)))
{
rank = c->as ? c->as->rank : 0;
if (c->attr.codimension)
tmp = gfc_copy_allocatable_data (dcmp, comp, ctype, rank);
+ else if (flag_coarray == GFC_FCOARRAY_LIB
+ && caf_in_coarray (caf_mode))
+ {
+ tree dst_tok = c->as ? gfc_conv_descriptor_token (dcmp)
+ : fold_build3_loc (input_location,
+ COMPONENT_REF,
+ pvoid_type_node, dest,
+ c->caf_token,
+ NULL_TREE);
+ tmp = duplicate_allocatable_coarray (dcmp, dst_tok, comp,
+ ctype, rank);
+ }
else
tmp = gfc_duplicate_allocatable (dcmp, comp, ctype, rank,
add_when_allocated);
@@ -8562,7 +8806,8 @@ tree
gfc_nullify_alloc_comp (gfc_symbol * der_type, tree decl, int rank)
{
return structure_alloc_comps (der_type, decl, NULL_TREE, rank,
- NULLIFY_ALLOC_COMP);
+ NULLIFY_ALLOC_COMP,
+ GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY);
}
@@ -8570,10 +8815,12 @@ gfc_nullify_alloc_comp (gfc_symbol * der_type, tree decl, int rank)
deallocate allocatable components. */
tree
-gfc_deallocate_alloc_comp (gfc_symbol * der_type, tree decl, int rank)
+gfc_deallocate_alloc_comp (gfc_symbol * der_type, tree decl, int rank,
+ int caf_mode)
{
return structure_alloc_comps (der_type, decl, NULL_TREE, rank,
- DEALLOCATE_ALLOC_COMP);
+ DEALLOCATE_ALLOC_COMP,
+ GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY | caf_mode);
}
@@ -8586,14 +8833,15 @@ tree
gfc_deallocate_alloc_comp_no_caf (gfc_symbol * der_type, tree decl, int rank)
{
return structure_alloc_comps (der_type, decl, NULL_TREE, rank,
- DEALLOCATE_ALLOC_COMP_NO_CAF);
+ DEALLOCATE_ALLOC_COMP, 0);
}
tree
gfc_reassign_alloc_comp_caf (gfc_symbol *der_type, tree decl, tree dest)
{
- return structure_alloc_comps (der_type, decl, dest, 0, COPY_ALLOC_COMP_CAF);
+ return structure_alloc_comps (der_type, decl, dest, 0, REASSIGN_CAF_COMP,
+ GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY);
}
@@ -8601,9 +8849,11 @@ gfc_reassign_alloc_comp_caf (gfc_symbol *der_type, tree decl, tree dest)
copy it and its allocatable components. */
tree
-gfc_copy_alloc_comp (gfc_symbol * der_type, tree decl, tree dest, int rank)
+gfc_copy_alloc_comp (gfc_symbol * der_type, tree decl, tree dest, int rank,
+ int caf_mode)
{
- return structure_alloc_comps (der_type, decl, dest, rank, COPY_ALLOC_COMP);
+ return structure_alloc_comps (der_type, decl, dest, rank, COPY_ALLOC_COMP,
+ caf_mode);
}
@@ -8613,7 +8863,8 @@ gfc_copy_alloc_comp (gfc_symbol * der_type, tree decl, tree dest, int rank)
tree
gfc_copy_only_alloc_comp (gfc_symbol * der_type, tree decl, tree dest, int rank)
{
- return structure_alloc_comps (der_type, decl, dest, rank, COPY_ONLY_ALLOC_COMP);
+ return structure_alloc_comps (der_type, decl, dest, rank,
+ COPY_ONLY_ALLOC_COMP, 0);
}
@@ -9205,15 +9456,17 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
else
{
tmp = build_call_expr_loc (input_location,
- gfor_fndecl_caf_deregister,
- 4, token, null_pointer_node,
- null_pointer_node, integer_zero_node);
+ gfor_fndecl_caf_deregister, 5, token,
+ build_int_cst (integer_type_node,
+ GFC_CAF_COARRAY_DEALLOCATE_ONLY),
+ null_pointer_node, null_pointer_node,
+ integer_zero_node);
gfc_add_expr_to_block (&realloc_block, tmp);
tmp = build_call_expr_loc (input_location,
gfor_fndecl_caf_register,
7, size2,
build_int_cst (integer_type_node,
- GFC_CAF_COARRAY_ALLOC),
+ GFC_CAF_COARRAY_ALLOC_ALLOCATE_ONLY),
token, gfc_build_addr_expr (NULL_TREE, desc),
null_pointer_node, null_pointer_node,
integer_zero_node);
@@ -9398,7 +9651,20 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block)
/* NULLIFY the data pointer, for non-saved allocatables. */
if (GFC_DESCRIPTOR_TYPE_P (type) && !sym->attr.save && sym->attr.allocatable)
- gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node);
+ {
+ gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node);
+ if (flag_coarray == GFC_FCOARRAY_LIB && sym->attr.codimension)
+ {
+ /* Declare the variable static so its array descriptor stays present
+ after leaving the scope. It may still be accessed through another
+ image. This may happen, for example, with the caf_mpi
+ implementation. */
+ TREE_STATIC (descriptor) = 1;
+ tmp = gfc_conv_descriptor_token (descriptor);
+ gfc_add_modify (&init, tmp, fold_convert (TREE_TYPE (tmp),
+ null_pointer_node));
+ }
+ }
gfc_restore_backend_locus (&loc);
gfc_init_block (&cleanup);
@@ -9432,8 +9698,10 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block)
{
gfc_expr *e;
e = has_finalizer ? gfc_lval_expr_from_sym (sym) : NULL;
- tmp = gfc_trans_dealloc_allocated (sym->backend_decl,
- sym->attr.codimension, e);
+ tmp = gfc_trans_dealloc_allocated (sym->backend_decl, e,
+ sym->attr.codimension
+ ? GFC_CAF_COARRAY_DEREGISTER
+ : GFC_CAF_COARRAY_NOCOARRAY);
if (e)
gfc_free_expr (e);
gfc_add_expr_to_block (&cleanup, tmp);
diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h
index d0309b2..0a6621b 100644
--- a/gcc/fortran/trans-array.h
+++ b/gcc/fortran/trans-array.h
@@ -19,7 +19,7 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Generate code to free an array. */
-tree gfc_array_deallocate (tree, tree, tree, tree, tree, gfc_expr*);
+tree gfc_array_deallocate (tree, tree, tree, tree, tree, gfc_expr*, int c = -2);
/* Generate code to initialize and allocate an array. Statements are added to
se, which should contain an expression for the array descriptor. */
@@ -42,7 +42,7 @@ void gfc_trans_dummy_array_bias (gfc_symbol *, tree, gfc_wrapped_block *);
/* Generate entry and exit code for g77 calling convention arrays. */
void gfc_trans_g77_array (gfc_symbol *, gfc_wrapped_block *);
/* Generate code to deallocate an array, if it is allocated. */
-tree gfc_trans_dealloc_allocated (tree, bool, gfc_expr *);
+tree gfc_trans_dealloc_allocated (tree, gfc_expr *, int);
tree gfc_full_array_size (stmtblock_t *, tree, int);
@@ -52,13 +52,15 @@ tree gfc_copy_allocatable_data (tree dest, tree src, tree type, int rank);
tree gfc_duplicate_allocatable_nocopy (tree, tree, tree, int);
+bool gfc_caf_is_dealloc_only (int);
+
tree gfc_nullify_alloc_comp (gfc_symbol *, tree, int);
-tree gfc_deallocate_alloc_comp (gfc_symbol *, tree, int);
+tree gfc_deallocate_alloc_comp (gfc_symbol *, tree, int, int cm = 0);
tree gfc_deallocate_alloc_comp_no_caf (gfc_symbol *, tree, int);
tree gfc_reassign_alloc_comp_caf (gfc_symbol *, tree, tree);
-tree gfc_copy_alloc_comp (gfc_symbol *, tree, tree, int);
+tree gfc_copy_alloc_comp (gfc_symbol *, tree, tree, int, int);
tree gfc_copy_only_alloc_comp (gfc_symbol *, tree, tree, int);
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index ba71a21..2e6ef2a 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -159,6 +159,7 @@ tree gfor_fndecl_co_max;
tree gfor_fndecl_co_min;
tree gfor_fndecl_co_reduce;
tree gfor_fndecl_co_sum;
+tree gfor_fndecl_caf_is_present;
/* Math functions. Many other math functions are handled in
@@ -3573,8 +3574,9 @@ gfc_build_builtin_function_decls (void)
pint_type, pchar_type_node, integer_type_node);
gfor_fndecl_caf_deregister = gfc_build_library_function_decl_with_spec (
- get_identifier (PREFIX("caf_deregister")), "WWWR", void_type_node, 4,
- ppvoid_type_node, pint_type, pchar_type_node, integer_type_node);
+ get_identifier (PREFIX("caf_deregister")), "WRWWR", void_type_node, 5,
+ ppvoid_type_node, integer_type_node, pint_type, pchar_type_node,
+ integer_type_node);
gfor_fndecl_caf_get = gfc_build_library_function_decl_with_spec (
get_identifier (PREFIX("caf_get")), ".R.RRWRRRW", void_type_node, 10,
@@ -3726,6 +3728,11 @@ gfc_build_builtin_function_decls (void)
get_identifier (PREFIX("caf_co_sum")), "W.WW",
void_type_node, 5, pvoid_type_node, integer_type_node,
pint_type, pchar_type_node, integer_type_node);
+
+ gfor_fndecl_caf_is_present = gfc_build_library_function_decl_with_spec (
+ get_identifier (PREFIX("caf_is_present")), "RRR",
+ integer_type_node, 3, pvoid_type_node, integer_type_node,
+ pvoid_type_node);
}
gfc_build_intrinsic_function_decls ();
@@ -4447,12 +4454,15 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
tmp = gfc_deallocate_with_status (descriptor, NULL_TREE,
NULL_TREE, NULL_TREE,
NULL_TREE, true, NULL,
- true);
+ GFC_CAF_COARRAY_ANALYZE);
else
{
gfc_expr *expr = gfc_lval_expr_from_sym (sym);
- tmp = gfc_deallocate_scalar_with_status (se.expr, NULL_TREE,
- true, expr, sym->ts);
+ tmp = gfc_deallocate_scalar_with_status (se.expr,
+ NULL_TREE,
+ NULL_TREE,
+ true, expr,
+ sym->ts);
gfc_free_expr (expr);
}
}
@@ -5093,8 +5103,8 @@ generate_coarray_sym_init (gfc_symbol *sym)
build_int_cst (integer_type_node, reg_type),
token, gfc_build_addr_expr (pvoid_type_node, desc),
null_pointer_node, /* stat. */
- null_pointer_node, /* errgmsg, errmsg_len. */
- build_int_cst (integer_type_node, 0));
+ null_pointer_node, /* errgmsg. */
+ integer_zero_node); /* errmsg_len. */
gfc_add_expr_to_block (&caf_init_block, tmp);
gfc_add_modify (&caf_init_block, decl, fold_convert (TREE_TYPE (decl),
gfc_conv_descriptor_data_get (desc)));
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 1c2d5e1..78bff87 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5208,7 +5208,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
ptr = gfc_class_data_get (ptr);
tmp = gfc_deallocate_scalar_with_status (ptr, NULL_TREE,
- true, e, e->ts);
+ NULL_TREE, true,
+ e, e->ts);
gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2_loc (input_location, MODIFY_EXPR,
void_type_node, ptr,
@@ -5317,7 +5318,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
tmp = gfc_deallocate_with_status (ptr, NULL_TREE,
NULL_TREE, NULL_TREE,
NULL_TREE, true, e,
- false);
+ GFC_CAF_COARRAY_NOCOARRAY);
gfc_add_expr_to_block (&block, tmp);
tmp = fold_build2_loc (input_location, MODIFY_EXPR,
void_type_node, ptr,
@@ -5440,7 +5441,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
tmp = build_fold_indirect_ref_loc (input_location,
parmse.expr);
- tmp = gfc_trans_dealloc_allocated (tmp, false, e);
+ tmp = gfc_trans_dealloc_allocated (tmp, e,
+ GFC_CAF_COARRAY_NOCOARRAY);
if (fsym->attr.optional
&& e->expr_type == EXPR_VARIABLE
&& e->symtree->n.sym->attr.optional)
@@ -5552,7 +5554,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
{
tree local_tmp;
local_tmp = gfc_evaluate_now (tmp, &se->pre);
- local_tmp = gfc_copy_alloc_comp (e->ts.u.derived, local_tmp, tmp, parm_rank);
+ local_tmp = gfc_copy_alloc_comp (e->ts.u.derived, local_tmp, tmp,
+ parm_rank, 0);
gfc_add_expr_to_block (&se->post, local_tmp);
}
@@ -6207,7 +6210,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
from being corrupted. */
tmp2 = gfc_evaluate_now (result, &se->pre);
tmp = gfc_copy_alloc_comp (arg->expr->ts.u.derived,
- result, tmp2, expr->rank);
+ result, tmp2, expr->rank, 0);
gfc_add_expr_to_block (&se->pre, tmp);
tmp = gfc_copy_allocatable_data (result, tmp2, TREE_TYPE(tmp2),
expr->rank);
@@ -6217,7 +6220,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
tmp = gfc_conv_descriptor_data_get (tmp2);
tmp = gfc_deallocate_with_status (tmp, NULL_TREE, NULL_TREE,
NULL_TREE, NULL_TREE, true,
- NULL, false);
+ NULL, GFC_CAF_COARRAY_NOCOARRAY);
gfc_add_expr_to_block (&se->pre, tmp);
}
}
@@ -6932,16 +6935,18 @@ gfc_trans_alloc_subarray_assign (tree dest, gfc_component * cm,
/* Deal with arrays of derived types with allocatable components. */
if (gfc_bt_struct (cm->ts.type)
&& cm->ts.u.derived->attr.alloc_comp)
+ // TODO: Fix caf_mode
tmp = gfc_copy_alloc_comp (cm->ts.u.derived,
se.expr, dest,
- cm->as->rank);
+ cm->as->rank, 0);
else if (cm->ts.type == BT_CLASS && expr->ts.type == BT_DERIVED
&& CLASS_DATA(cm)->attr.allocatable)
{
if (cm->ts.u.derived->attr.alloc_comp)
+ // TODO: Fix caf_mode
tmp = gfc_copy_alloc_comp (expr->ts.u.derived,
se.expr, dest,
- expr->rank);
+ expr->rank, 0);
else
{
tmp = TREE_TYPE (dest);
@@ -7367,8 +7372,9 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr,
if (cm->ts.u.derived->attr.alloc_comp
&& expr->expr_type != EXPR_NULL)
{
+ // TODO: Fix caf_mode
tmp = gfc_copy_alloc_comp (cm->ts.u.derived, se.expr,
- dest, expr->rank);
+ dest, expr->rank, 0);
gfc_add_expr_to_block (&block, tmp);
if (dealloc != NULL_TREE)
gfc_add_expr_to_block (&block, dealloc);
@@ -7434,13 +7440,14 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr,
/* Assign a derived type constructor to a variable. */
tree
-gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init)
+gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init, bool coarray)
{
gfc_constructor *c;
gfc_component *cm;
stmtblock_t block;
tree field;
tree tmp;
+ gfc_se se;
gfc_start_block (&block);
cm = expr->ts.u.derived->components;
@@ -7449,7 +7456,7 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init)
&& (expr->ts.u.derived->intmod_sym_id == ISOCBINDING_PTR
|| expr->ts.u.derived->intmod_sym_id == ISOCBINDING_FUNPTR))
{
- gfc_se se, lse;
+ gfc_se lse;
gfc_init_se (&se, NULL);
gfc_init_se (&lse, NULL);
@@ -7461,6 +7468,9 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init)
return gfc_finish_block (&block);
}
+ if (coarray)
+ gfc_init_se (&se, NULL);
+
for (c = gfc_constructor_first (expr->value.constructor);
c; c = gfc_constructor_next (c), cm = cm->next)
{
@@ -7468,6 +7478,62 @@ gfc_trans_structure_assign (tree dest, gfc_expr * expr, bool init)
if (!c->expr && !cm->attr.allocatable)
continue;
+ /* Register the component with the caf-lib before it is initialized.
+ Register only allocatable components, that are not coarray'ed
+ components (%comp[*]). Only register when the constructor is not the
+ null-expression. */
+ if (coarray && !cm->attr.codimension && cm->attr.allocatable
+ && (!c->expr || c->expr->expr_type == EXPR_NULL))
+ {
+ tree token, desc, size;
+ symbol_attribute attr;
+ bool is_array = cm->ts.type == BT_CLASS
+ ? CLASS_DATA (cm)->attr.dimension : cm->attr.dimension;
+
+ field = cm->backend_decl;
+ field = fold_build3_loc (input_location, COMPONENT_REF,
+ TREE_TYPE (field), dest, field, NULL_TREE);
+ if (cm->ts.type == BT_CLASS)
+ field = gfc_class_data_get (field);
+
+ token = is_array ? gfc_conv_descriptor_token (field)
+ : fold_build3_loc (input_location, COMPONENT_REF,
+ TREE_TYPE (cm->caf_token), dest,
+ cm->caf_token, NULL_TREE);
+
+ if (is_array)
+ {
+ /* The _caf_register routine looks at the rank of the array
+ descriptor to decide whether the data registered is an array
+ or not. */
+ int rank = cm->ts.type == BT_CLASS ? CLASS_DATA (cm)->as->rank
+ : cm->as->rank;
+ /* When the rank is not known just set a positive rank, which
+ suffices to recognize the data as array. */
+ if (rank < 0)
+ rank = 1;
+ size = integer_zero_node;
+ desc = field;
+ gfc_add_modify (&block, gfc_conv_descriptor_dtype (desc),
+ build_int_cst (gfc_array_index_type, rank));
+ }
+ else
+ {
+ desc = gfc_conv_scalar_to_descriptor (&se, field, attr);
+ size = TYPE_SIZE_UNIT (TREE_TYPE (field));
+ }
+ gfc_add_block_to_block (&block, &se.pre);
+ tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_register,
+ 7, size, build_int_cst (
+ integer_type_node,
+ GFC_CAF_COARRAY_ALLOC_REGISTER_ONLY),
+ gfc_build_addr_expr (pvoid_type_node,
+ token),
+ gfc_build_addr_expr (NULL_TREE, desc),
+ null_pointer_node, null_pointer_node,
+ integer_zero_node);
+ gfc_add_expr_to_block (&block, tmp);
+ }
field = cm->backend_decl;
tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field),
dest, field, NULL_TREE);
@@ -7546,7 +7612,8 @@ gfc_conv_structure (gfc_se * se, gfc_expr * expr, int init)
se->expr = gfc_create_var (type, expr->ts.u.derived->name);
/* The symtree in expr is NULL, if the code to generate is for
initializing the static members only. */
- tmp = gfc_trans_structure_assign (se->expr, expr, expr->symtree != NULL);
+ tmp = gfc_trans_structure_assign (se->expr, expr, expr->symtree != NULL,
+ se->want_coarray);
gfc_add_expr_to_block (&se->pre, tmp);
return;
}
@@ -8540,7 +8607,7 @@ gfc_conv_string_parameter (gfc_se * se)
tree
gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
- bool deep_copy, bool dealloc)
+ bool deep_copy, bool dealloc, bool in_coarray)
{
stmtblock_t block;
tree tmp;
@@ -8617,7 +8684,10 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts,
same as the lhs. */
if (deep_copy)
{
- tmp = gfc_copy_alloc_comp (ts.u.derived, rse->expr, lse->expr, 0);
+ int caf_mode = in_coarray ? (GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY
+ | GFC_STRUCTURE_CAF_MODE_IN_COARRAY) : 0;
+ tmp = gfc_copy_alloc_comp (ts.u.derived, rse->expr, lse->expr, 0,
+ caf_mode);
tmp = build3_v (COND_EXPR, cond, build_empty_stmt (input_location),
tmp);
gfc_add_expr_to_block (&block, tmp);
@@ -9746,6 +9816,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
l_is_temp = (lss != gfc_ss_terminator && loop.temp_ss != NULL);
/* Translate the expression. */
+ rse.want_coarray = flag_coarray == GFC_FCOARRAY_LIB && init_flag
+ && lhs_caf_attr.codimension;
gfc_conv_expr (&rse, expr2);
/* Deal with the case of a scalar class function assigned to a derived type. */
@@ -9882,7 +9954,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
gfc_expr_is_variable (expr2)
|| scalar_to_array
|| expr2->expr_type == EXPR_ARRAY,
- !(l_is_temp || init_flag) && dealloc);
+ !(l_is_temp || init_flag) && dealloc,
+ expr1->symtree->n.sym->attr.codimension);
/* Add the pre blocks to the body. */
gfc_add_block_to_block (&body, &rse.pre);
gfc_add_block_to_block (&body, &lse.pre);
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 463bb58..d7612f6 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1674,7 +1674,8 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind,
tmp = gfc_deallocate_with_status (tmp, NULL_TREE,
NULL_TREE, NULL_TREE,
NULL_TREE, true,
- NULL, false);
+ NULL,
+ GFC_CAF_COARRAY_NOCOARRAY);
gfc_add_expr_to_block (&se->post, tmp);
}
}
@@ -1764,6 +1765,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind,
ar->as = ar2.as;
ar->type = AR_FULL;
}
+ // TODO: Check whether argse.want_coarray = 1 can help with the below.
gfc_conv_expr_descriptor (&argse, array_expr);
/* Using gfc_conv_expr_descriptor, we only get the descriptor, but that
has the wrong type if component references are done. */
@@ -1926,7 +1928,9 @@ conv_caf_send (gfc_code *code) {
/* Special case: RHS is a coarray but LHS is not; this code path avoids a
temporary and a loop. */
- if (!gfc_is_coindexed (lhs_expr) && !lhs_caf_attr.codimension)
+ if (!gfc_is_coindexed (lhs_expr)
+ && (!lhs_caf_attr.codimension
+ || !(lhs_expr->rank > 0 && lhs_caf_attr.allocatable)))
{
bool lhs_may_realloc = lhs_expr->rank > 0 && lhs_caf_attr.allocatable;
gcc_assert (gfc_is_coindexed (rhs_expr));
@@ -1957,7 +1961,7 @@ conv_caf_send (gfc_code *code) {
gfc_add_block_to_block (&block, &lhs_se.pre);
gfc_conv_intrinsic_caf_get (&rhs_se, rhs_expr, lhs_se.expr, lhs_kind,
may_require_tmp, lhs_may_realloc,
- &lhs_caf_attr);
+ &rhs_caf_attr);
gfc_add_block_to_block (&block, &rhs_se.pre);
gfc_add_block_to_block (&block, &rhs_se.post);
gfc_add_block_to_block (&block, &lhs_se.post);
@@ -2059,7 +2063,7 @@ conv_caf_send (gfc_code *code) {
gfc_add_block_to_block (&block, &stat_se.post);
}
- if (!gfc_is_coindexed (rhs_expr) && !rhs_caf_attr.codimension)
+ if (!gfc_is_coindexed (rhs_expr))
{
if (lhs_caf_attr.alloc_comp)
{
@@ -7318,6 +7322,42 @@ scalar_transfer:
}
+/* Generate a call to caf_is_present. */
+
+static tree
+trans_caf_is_present (gfc_se *se, gfc_expr *expr)
+{
+ tree caf_reference, caf_decl, token, image_index;
+
+ /* Compile the reference chain. */
+ caf_reference = conv_expr_ref_to_caf_ref (&se->pre, expr);
+ gcc_assert (caf_reference != NULL_TREE);
+
+ caf_decl = gfc_get_tree_for_caf_expr (expr);
+ if (TREE_CODE (TREE_TYPE (caf_decl)) == REFERENCE_TYPE)
+ caf_decl = build_fold_indirect_ref_loc (input_location, caf_decl);
+ image_index = gfc_caf_get_image_index (&se->pre, expr, caf_decl);
+ gfc_get_caf_token_offset (se, &token, NULL, caf_decl, NULL,
+ expr);
+
+ return build_call_expr_loc (input_location, gfor_fndecl_caf_is_present,
+ 3, token, image_index, caf_reference);
+}
+
+
+/* Test whether this ref-chain refs this image only. */
+
+static bool
+caf_this_image_ref (gfc_ref *ref)
+{
+ for ( ; ref; ref = ref->next)
+ if (ref->type == REF_ARRAY && ref->u.ar.codimen)
+ return ref->u.ar.dimen_type[ref->u.ar.dimen] == DIMEN_THIS_IMAGE;
+
+ return false;
+}
+
+
/* Generate code for the ALLOCATED intrinsic.
Generate inline code that directly check the address of the argument. */
@@ -7327,6 +7367,7 @@ gfc_conv_allocated (gfc_se *se, gfc_expr *expr)
gfc_actual_arglist *arg1;
gfc_se arg1se;
tree tmp;
+ symbol_attribute caf_attr;
gfc_init_se (&arg1se, NULL);
arg1 = expr->value.function.actual;
@@ -7342,23 +7383,37 @@ gfc_conv_allocated (gfc_se *se, gfc_expr *expr)
gfc_add_data_component (arg1->expr);
}
- if (arg1->expr->rank == 0)
- {
- /* Allocatable scalar. */
- arg1se.want_pointer = 1;
- gfc_conv_expr (&arg1se, arg1->expr);
- tmp = arg1se.expr;
- }
+ /* When arg1 references an allocatable component in a coarray, then call
+ the caf-library function caf_is_present (). */
+ if (flag_coarray == GFC_FCOARRAY_LIB && arg1->expr->expr_type == EXPR_FUNCTION
+ && arg1->expr->value.function.isym
+ && arg1->expr->value.function.isym->id == GFC_ISYM_CAF_GET)
+ caf_attr = gfc_caf_attr (arg1->expr->value.function.actual->expr);
+ else
+ gfc_clear_attr (&caf_attr);
+ if (flag_coarray == GFC_FCOARRAY_LIB && caf_attr.codimension
+ && !caf_this_image_ref (arg1->expr->value.function.actual->expr->ref))
+ tmp = trans_caf_is_present (se, arg1->expr->value.function.actual->expr);
else
{
- /* Allocatable array. */
- arg1se.descriptor_only = 1;
- gfc_conv_expr_descriptor (&arg1se, arg1->expr);
- tmp = gfc_conv_descriptor_data_get (arg1se.expr);
- }
+ if (arg1->expr->rank == 0)
+ {
+ /* Allocatable scalar. */
+ arg1se.want_pointer = 1;
+ gfc_conv_expr (&arg1se, arg1->expr);
+ tmp = arg1se.expr;
+ }
+ else
+ {
+ /* Allocatable array. */
+ arg1se.descriptor_only = 1;
+ gfc_conv_expr_descriptor (&arg1se, arg1->expr);
+ tmp = gfc_conv_descriptor_data_get (arg1se.expr);
+ }
- tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, tmp,
- fold_convert (TREE_TYPE (tmp), null_pointer_node));
+ tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, tmp,
+ fold_convert (TREE_TYPE (tmp), null_pointer_node));
+ }
se->expr = convert (gfc_typenode_for_spec (&expr->ts), tmp);
}
@@ -10270,8 +10325,8 @@ conv_intrinsic_move_alloc (gfc_code *code)
gfc_add_block_to_block (&block, &to_se.pre);
/* Deallocate "to". */
- tmp = gfc_deallocate_scalar_with_status (to_se.expr, NULL_TREE, true,
- to_expr, to_expr->ts);
+ tmp = gfc_deallocate_scalar_with_status (to_se.expr, NULL_TREE, NULL_TREE,
+ true, to_expr, to_expr->ts);
gfc_add_expr_to_block (&block, tmp);
/* Assign (_data) pointers. */
@@ -10429,7 +10484,7 @@ conv_intrinsic_move_alloc (gfc_code *code)
tmp = gfc_deallocate_with_status (to_se.expr, NULL_TREE, NULL_TREE,
NULL_TREE, NULL_TREE, true, to_expr,
- true);
+ GFC_CAF_COARRAY_DEALLOCATE_ONLY);
gfc_add_expr_to_block (&block, tmp);
tmp = gfc_conv_descriptor_data_get (to_se.expr);
@@ -10457,7 +10512,8 @@ conv_intrinsic_move_alloc (gfc_code *code)
tmp = gfc_conv_descriptor_data_get (to_se.expr);
tmp = gfc_deallocate_with_status (tmp, NULL_TREE, NULL_TREE, NULL_TREE,
- NULL_TREE, true, to_expr, false);
+ NULL_TREE, true, to_expr,
+ GFC_CAF_COARRAY_NOCOARRAY);
gfc_add_expr_to_block (&block, tmp);
}
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index 59fd6b3..d460048 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -420,8 +420,8 @@ gfc_walk_alloc_comps (tree decl, tree dest, tree var,
if (GFC_DESCRIPTOR_TYPE_P (ftype)
&& GFC_TYPE_ARRAY_AKIND (ftype) == GFC_ARRAY_ALLOCATABLE)
{
- tem = gfc_trans_dealloc_allocated (unshare_expr (declf),
- false, NULL);
+ tem = gfc_trans_dealloc_allocated (unshare_expr (declf), NULL,
+ GFC_CAF_COARRAY_NOCOARRAY);
gfc_add_expr_to_block (&block, gfc_omp_unshare_expr (tem));
}
else if (GFC_DECL_GET_SCALAR_ALLOCATABLE (field))
@@ -812,7 +812,8 @@ gfc_omp_clause_assign_op (tree clause, tree dest, tree src)
if (GFC_DESCRIPTOR_TYPE_P (type))
gfc_add_expr_to_block (&cond_block,
gfc_trans_dealloc_allocated (unshare_expr (dest),
- false, NULL));
+ NULL,
+ GFC_CAF_COARRAY_NOCOARRAY));
else
{
destptr = gfc_evaluate_now (destptr, &cond_block);
@@ -988,7 +989,7 @@ gfc_omp_clause_dtor (tree clause, tree decl)
if (GFC_DESCRIPTOR_TYPE_P (type))
/* Allocatable arrays in FIRSTPRIVATE/LASTPRIVATE etc. clauses need
to be deallocated if they were allocated. */
- tem = gfc_trans_dealloc_allocated (decl, false, NULL);
+ tem = gfc_trans_dealloc_allocated (decl, NULL, GFC_CAF_COARRAY_NOCOARRAY);
else
tem = gfc_call_free (decl);
tem = gfc_omp_unshare_expr (tem);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 19ecf68..514db28 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -6409,6 +6409,9 @@ gfc_trans_deallocate (gfc_code *code)
for (al = code->ext.alloc.list; al != NULL; al = al->next)
{
gfc_expr *expr = gfc_copy_expr (al->expr);
+ bool is_coarray = false, is_coarray_array = false;
+ int caf_mode = 0;
+
gcc_assert (expr->expr_type == EXPR_VARIABLE);
if (expr->ts.type == BT_CLASS)
@@ -6421,11 +6424,32 @@ gfc_trans_deallocate (gfc_code *code)
se.descriptor_only = 1;
gfc_conv_expr (&se, expr);
- if (expr->rank || gfc_caf_attr (expr).codimension)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
+ {
+ bool comp_ref;
+ symbol_attribute caf_attr = gfc_caf_attr (expr, false, &comp_ref);
+ if (caf_attr.codimension)
+ {
+ is_coarray = true;
+ is_coarray_array = caf_attr.dimension || !comp_ref
+ || caf_attr.coarray_comp;
+
+ /* When the expression to deallocate is referencing a
+ component, then only deallocate it, but do not deregister. */
+ caf_mode = GFC_STRUCTURE_CAF_MODE_IN_COARRAY
+ | (comp_ref && !caf_attr.coarray_comp
+ ? GFC_STRUCTURE_CAF_MODE_DEALLOC_ONLY : 0);
+ }
+ }
+ else if (flag_coarray == GFC_FCOARRAY_SINGLE)
+ is_coarray = is_coarray_array = gfc_caf_attr (expr).codimension;
+
+ if (expr->rank || is_coarray_array)
{
gfc_ref *ref;
- if (gfc_bt_struct (expr->ts.type) && expr->ts.u.derived->attr.alloc_comp
+ if (gfc_bt_struct (expr->ts.type)
+ && expr->ts.u.derived->attr.alloc_comp
&& !gfc_is_finalizable (expr->ts.u.derived, NULL))
{
gfc_ref *last = NULL;
@@ -6439,16 +6463,34 @@ gfc_trans_deallocate (gfc_code *code)
if (!(last && last->u.c.component->attr.pointer)
&& !(!last && expr->symtree->n.sym->attr.pointer))
{
- tmp = gfc_deallocate_alloc_comp (expr->ts.u.derived, se.expr,
- expr->rank);
+ if (is_coarray && expr->rank == 0
+ && (!last || !last->u.c.component->attr.dimension))
+ {
+ /* Add the ref to the data member only, when this is not
+ a regular array or deallocate_alloc_comp will try to
+ add another one. */
+ tmp = gfc_conv_descriptor_data_get (se.expr);
+ }
+ else
+ tmp = se.expr;
+ tmp = gfc_deallocate_alloc_comp (expr->ts.u.derived, tmp,
+ expr->rank, caf_mode);
gfc_add_expr_to_block (&se.pre, tmp);
}
}
if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (se.expr)))
{
+ gfc_coarray_deregtype caf_dtype;
+
+ if (is_coarray)
+ caf_dtype = gfc_caf_is_dealloc_only (caf_mode)
+ ? GFC_CAF_COARRAY_DEALLOCATE_ONLY
+ : GFC_CAF_COARRAY_DEREGISTER;
+ else
+ caf_dtype = GFC_CAF_COARRAY_NOCOARRAY;
tmp = gfc_array_deallocate (se.expr, pstat, errmsg, errlen,
- label_finish, expr);
+ label_finish, expr, caf_dtype);
gfc_add_expr_to_block (&se.pre, tmp);
}
else if (TREE_CODE (se.expr) == COMPONENT_REF
@@ -6491,8 +6533,9 @@ gfc_trans_deallocate (gfc_code *code)
}
else
{
- tmp = gfc_deallocate_scalar_with_status (se.expr, pstat, false,
- al->expr, al->expr->ts);
+ tmp = gfc_deallocate_scalar_with_status (se.expr, pstat, label_finish,
+ false, al->expr,
+ al->expr->ts, is_coarray);
gfc_add_expr_to_block (&se.pre, tmp);
/* Set to zero after deallocation. */
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index aaec1c22..6a1d481 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -709,10 +709,10 @@ gfc_allocate_using_malloc (stmtblock_t * block, tree pointer,
newmem = _caf_register (size, regtype, token, &stat, errmsg, errlen);
return newmem;
} */
-static void
-gfc_allocate_using_lib (stmtblock_t * block, tree pointer, tree size,
- tree token, tree status, tree errmsg, tree errlen,
- bool lock_var, bool event_var)
+void
+gfc_allocate_using_caf_lib (stmtblock_t * block, tree pointer, tree size,
+ tree token, tree status, tree errmsg, tree errlen,
+ gfc_coarray_regtype alloc_type)
{
tree tmp, pstat;
@@ -735,12 +735,8 @@ gfc_allocate_using_lib (stmtblock_t * block, tree pointer, tree size,
tmp = build_call_expr_loc (input_location,
gfor_fndecl_caf_register, 7,
fold_build2_loc (input_location,
- MAX_EXPR, size_type_node, size,
- build_int_cst (size_type_node, 1)),
- build_int_cst (integer_type_node,
- lock_var ? GFC_CAF_LOCK_ALLOC
- : event_var ? GFC_CAF_EVENT_ALLOC
- : GFC_CAF_COARRAY_ALLOC),
+ MAX_EXPR, size_type_node, size, size_one_node),
+ build_int_cst (integer_type_node, alloc_type),
token, gfc_build_addr_expr (pvoid_type_node, pointer),
pstat, errmsg, errlen);
@@ -787,7 +783,8 @@ gfc_allocate_allocatable (stmtblock_t * block, tree mem, tree size,
tree tmp, null_mem, alloc, error;
tree type = TREE_TYPE (mem);
symbol_attribute caf_attr;
- bool need_assign = false;
+ bool need_assign = false, refs_comp = false;
+ gfc_coarray_regtype caf_alloc_type = GFC_CAF_COARRAY_ALLOC;
size = fold_convert (size_type_node, size);
null_mem = gfc_unlikely (fold_build2_loc (input_location, NE_EXPR,
@@ -800,27 +797,36 @@ gfc_allocate_allocatable (stmtblock_t * block, tree mem, tree size,
gfc_start_block (&alloc_block);
if (flag_coarray == GFC_FCOARRAY_LIB)
- caf_attr = gfc_caf_attr (expr, true);
+ caf_attr = gfc_caf_attr (expr, true, &refs_comp);
if (flag_coarray == GFC_FCOARRAY_LIB
&& (corank > 0 || caf_attr.codimension))
{
- tree cond;
- bool lock_var = expr->ts.type == BT_DERIVED
- && expr->ts.u.derived->from_intmod
- == INTMOD_ISO_FORTRAN_ENV
- && expr->ts.u.derived->intmod_sym_id
- == ISOFORTRAN_LOCK_TYPE;
- bool event_var = expr->ts.type == BT_DERIVED
- && expr->ts.u.derived->from_intmod
- == INTMOD_ISO_FORTRAN_ENV
- && expr->ts.u.derived->intmod_sym_id
- == ISOFORTRAN_EVENT_TYPE;
+ tree cond, sub_caf_tree;
gfc_se se;
- gfc_init_se (&se, NULL);
+ bool compute_special_caf_types_size = false;
- tree sub_caf_tree = gfc_get_ultimate_alloc_ptr_comps_caf_token (&se,
- expr);
+ if (expr->ts.type == BT_DERIVED
+ && expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
+ && expr->ts.u.derived->intmod_sym_id == ISOFORTRAN_LOCK_TYPE)
+ {
+ compute_special_caf_types_size = true;
+ caf_alloc_type = GFC_CAF_LOCK_ALLOC;
+ }
+ else if (expr->ts.type == BT_DERIVED
+ && expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
+ && expr->ts.u.derived->intmod_sym_id == ISOFORTRAN_EVENT_TYPE)
+ {
+ compute_special_caf_types_size = true;
+ caf_alloc_type = GFC_CAF_EVENT_ALLOC;
+ }
+ else if (!caf_attr.coarray_comp && refs_comp)
+ /* Only allocatable components in a derived type coarray can be
+ allocate only. */
+ caf_alloc_type = GFC_CAF_COARRAY_ALLOC_ALLOCATE_ONLY;
+
+ gfc_init_se (&se, NULL);
+ sub_caf_tree = gfc_get_ultimate_alloc_ptr_comps_caf_token (&se, expr);
if (sub_caf_tree == NULL_TREE)
sub_caf_tree = token;
@@ -847,12 +853,12 @@ gfc_allocate_allocatable (stmtblock_t * block, tree mem, tree size,
the FE only passes the pointer around and leaves the actual
representation to the library. Hence, we have to convert back to the
number of elements. */
- if (lock_var || event_var)
+ if (compute_special_caf_types_size)
size = fold_build2_loc (input_location, TRUNC_DIV_EXPR, size_type_node,
size, TYPE_SIZE_UNIT (ptr_type_node));
- gfc_allocate_using_lib (&alloc_block, tmp, size, sub_caf_tree,
- status, errmsg, errlen, lock_var, event_var);
+ gfc_allocate_using_caf_lib (&alloc_block, tmp, size, sub_caf_tree,
+ status, errmsg, errlen, caf_alloc_type);
if (need_assign)
gfc_add_modify (&alloc_block, mem, fold_convert (TREE_TYPE (mem),
gfc_conv_descriptor_data_get (tmp)));
@@ -1265,23 +1271,40 @@ gfc_add_finalizer_call (stmtblock_t *block, gfc_expr *expr2)
expression being deallocated for its locus and variable name.
For coarrays, "pointer" must be the array descriptor and not its
- "data" component. */
+ "data" component.
+
+ COARRAY_DEALLOC_MODE gives the mode unregister coarrays. Available modes are
+ the ones of GFC_CAF_DEREGTYPE, -1 when the mode for deregistration is to be
+ analyzed and set by this routine, and -2 to indicate that a non-coarray is to
+ be deallocated. */
tree
gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
tree errlen, tree label_finish,
- bool can_fail, gfc_expr* expr, bool coarray)
+ bool can_fail, gfc_expr* expr,
+ int coarray_dealloc_mode)
{
stmtblock_t null, non_null;
tree cond, tmp, error;
tree status_type = NULL_TREE;
tree caf_decl = NULL_TREE;
+ gfc_coarray_deregtype caf_dereg_type = GFC_CAF_COARRAY_DEREGISTER;
- if (coarray)
+ if (coarray_dealloc_mode >= GFC_CAF_COARRAY_ANALYZE)
{
gcc_assert (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (pointer)));
caf_decl = pointer;
pointer = gfc_conv_descriptor_data_get (caf_decl);
STRIP_NOPS (pointer);
+ if (coarray_dealloc_mode == GFC_CAF_COARRAY_ANALYZE)
+ {
+ bool comp_ref;
+ if (expr && !gfc_caf_attr (expr, false, &comp_ref).coarray_comp
+ && comp_ref)
+ caf_dereg_type = GFC_CAF_COARRAY_DEALLOCATE_ONLY;
+ // else do a deregister as set by default.
+ }
+ else
+ caf_dereg_type = (enum gfc_coarray_deregtype) coarray_dealloc_mode;
}
cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, pointer,
@@ -1326,7 +1349,8 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
/* When POINTER is not NULL, we free it. */
gfc_start_block (&non_null);
gfc_add_finalizer_call (&non_null, expr);
- if (!coarray || flag_coarray != GFC_FCOARRAY_LIB)
+ if (coarray_dealloc_mode == GFC_CAF_COARRAY_NOCOARRAY
+ || flag_coarray != GFC_FCOARRAY_LIB)
{
tmp = build_call_expr_loc (input_location,
builtin_decl_explicit (BUILT_IN_FREE), 1,
@@ -1392,9 +1416,12 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
}
token = gfc_build_addr_expr (NULL_TREE, token);
+ gcc_assert (caf_dereg_type > GFC_CAF_COARRAY_ANALYZE);
tmp = build_call_expr_loc (input_location,
- gfor_fndecl_caf_deregister, 4,
- token, pstat, errmsg, errlen);
+ gfor_fndecl_caf_deregister, 5,
+ token, build_int_cst (integer_type_node,
+ caf_dereg_type),
+ pstat, errmsg, errlen);
gfc_add_expr_to_block (&non_null, tmp);
/* It guarantees memory consistency within the same segment */
@@ -1431,12 +1458,18 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg,
subcomponents are being deallocated. */
tree
-gfc_deallocate_scalar_with_status (tree pointer, tree status, bool can_fail,
- gfc_expr* expr, gfc_typespec ts)
+gfc_deallocate_scalar_with_status (tree pointer, tree status, tree label_finish,
+ bool can_fail, gfc_expr* expr,
+ gfc_typespec ts, bool coarray)
{
stmtblock_t null, non_null;
tree cond, tmp, error;
- bool finalizable;
+ bool finalizable, comp_ref;
+ gfc_coarray_deregtype caf_dereg_type = GFC_CAF_COARRAY_DEREGISTER;
+
+ if (coarray && expr && !gfc_caf_attr (expr, false, &comp_ref).coarray_comp
+ && comp_ref)
+ caf_dereg_type = GFC_CAF_COARRAY_DEALLOCATE_ONLY;
cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, pointer,
build_int_cst (TREE_TYPE (pointer), 0));
@@ -1474,7 +1507,6 @@ gfc_deallocate_scalar_with_status (tree pointer, tree status, bool can_fail,
error = fold_build3_loc (input_location, COND_EXPR, void_type_node,
cond2, tmp, error);
}
-
gfc_add_expr_to_block (&null, error);
/* When POINTER is not NULL, we free it. */
@@ -1484,31 +1516,84 @@ gfc_deallocate_scalar_with_status (tree pointer, tree status, bool can_fail,
finalizable = gfc_add_finalizer_call (&non_null, expr);
if (!finalizable && ts.type == BT_DERIVED && ts.u.derived->attr.alloc_comp)
{
- tmp = build_fold_indirect_ref_loc (input_location, pointer);
+ if (coarray)
+ tmp = gfc_conv_descriptor_data_get (pointer);
+ else
+ tmp = build_fold_indirect_ref_loc (input_location, pointer);
tmp = gfc_deallocate_alloc_comp (ts.u.derived, tmp, 0);
gfc_add_expr_to_block (&non_null, tmp);
}
- tmp = build_call_expr_loc (input_location,
- builtin_decl_explicit (BUILT_IN_FREE), 1,
- fold_convert (pvoid_type_node, pointer));
- gfc_add_expr_to_block (&non_null, tmp);
+ if (!coarray)
+ {
+ tmp = build_call_expr_loc (input_location,
+ builtin_decl_explicit (BUILT_IN_FREE), 1,
+ fold_convert (pvoid_type_node, pointer));
+ gfc_add_expr_to_block (&non_null, tmp);
- if (status != NULL_TREE && !integer_zerop (status))
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ /* We set STATUS to zero if it is present. */
+ tree status_type = TREE_TYPE (TREE_TYPE (status));
+ tree cond2;
+
+ cond2 = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ status,
+ build_int_cst (TREE_TYPE (status), 0));
+ tmp = fold_build2_loc (input_location, MODIFY_EXPR, status_type,
+ fold_build1_loc (input_location, INDIRECT_REF,
+ status_type, status),
+ build_int_cst (status_type, 0));
+ tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node,
+ cond2, tmp, build_empty_stmt (input_location));
+ gfc_add_expr_to_block (&non_null, tmp);
+ }
+ }
+ else
{
- /* We set STATUS to zero if it is present. */
- tree status_type = TREE_TYPE (TREE_TYPE (status));
- tree cond2;
+ tree token;
+ tree pstat = null_pointer_node;
+ gfc_se se;
- cond2 = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
- status, build_int_cst (TREE_TYPE (status), 0));
- tmp = fold_build2_loc (input_location, MODIFY_EXPR, status_type,
- fold_build1_loc (input_location, INDIRECT_REF,
- status_type, status),
- build_int_cst (status_type, 0));
- tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, cond2,
- tmp, build_empty_stmt (input_location));
+ gfc_init_se (&se, NULL);
+ token = gfc_get_ultimate_alloc_ptr_comps_caf_token (&se, expr);
+ gcc_assert (token != NULL_TREE);
+
+ if (status != NULL_TREE && !integer_zerop (status))
+ {
+ gcc_assert (TREE_TYPE (TREE_TYPE (status)) == integer_type_node);
+ pstat = status;
+ }
+
+ tmp = build_call_expr_loc (input_location,
+ gfor_fndecl_caf_deregister, 5,
+ token, build_int_cst (integer_type_node,
+ caf_dereg_type),
+ pstat, null_pointer_node, integer_zero_node);
gfc_add_expr_to_block (&non_null, tmp);
+
+ /* It guarantees memory consistency within the same segment. */
+ tmp = gfc_build_string_const (strlen ("memory")+1, "memory"),
+ tmp = build5_loc (input_location, ASM_EXPR, void_type_node,
+ gfc_build_string_const (1, ""), NULL_TREE, NULL_TREE,
+ tree_cons (NULL_TREE, tmp, NULL_TREE), NULL_TREE);
+ ASM_VOLATILE_P (tmp) = 1;
+ gfc_add_expr_to_block (&non_null, tmp);
+
+ if (status != NULL_TREE)
+ {
+ tree stat = build_fold_indirect_ref_loc (input_location, status);
+ tree cond2;
+
+ TREE_USED (label_finish) = 1;
+ tmp = build1_v (GOTO_EXPR, label_finish);
+ cond2 = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ stat, build_zero_cst (TREE_TYPE (stat)));
+ tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node,
+ gfc_unlikely (cond2, PRED_FORTRAN_REALLOC),
+ tmp, build_empty_stmt (input_location));
+ gfc_add_expr_to_block (&non_null, tmp);
+ }
}
return fold_build3_loc (input_location, COND_EXPR, void_type_node, cond,
@@ -1516,7 +1601,6 @@ gfc_deallocate_scalar_with_status (tree pointer, tree status, bool can_fail,
gfc_finish_block (&non_null));
}
-
/* Reallocate MEM so it has SIZE bytes of data. This behaves like the
following pseudo-code:
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index 02a8a56..ae1f156 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -107,7 +107,7 @@ gfc_se;
/* Denotes different types of coarray.
Please keep in sync with libgfortran/caf/libcaf.h. */
-enum gfc_coarray_type
+enum gfc_coarray_regtype
{
GFC_CAF_COARRAY_STATIC,
GFC_CAF_COARRAY_ALLOC,
@@ -115,7 +115,22 @@ enum gfc_coarray_type
GFC_CAF_LOCK_ALLOC,
GFC_CAF_CRITICAL,
GFC_CAF_EVENT_STATIC,
- GFC_CAF_EVENT_ALLOC
+ GFC_CAF_EVENT_ALLOC,
+ GFC_CAF_COARRAY_ALLOC_REGISTER_ONLY,
+ GFC_CAF_COARRAY_ALLOC_ALLOCATE_ONLY
+};
+
+
+/* Describes the action to take on _caf_deregister. Keep in sync with
+ gcc/fortran/trans.h. The negative values are not valid for the library and
+ are used by the drivers for building the correct call. */
+enum gfc_coarray_deregtype {
+ /* This is no coarray, i.e. build a call to a free (). */
+ GFC_CAF_COARRAY_NOCOARRAY = -2,
+ /* The driver is to analyze which _caf_deregister ()-call to generate. */
+ GFC_CAF_COARRAY_ANALYZE = -1,
+ GFC_CAF_COARRAY_DEREGISTER = 0,
+ GFC_CAF_COARRAY_DEALLOCATE_ONLY
};
@@ -140,6 +155,15 @@ enum gfc_caf_array_ref_t {
GFC_CAF_ARR_REF_OPEN_START
};
+
+/* trans-array (structure_alloc_comps) caf_mode bits. */
+enum gfc_structure_caf_mode_t {
+ GFC_STRUCTURE_CAF_MODE_ENABLE_COARRAY = 1 << 0,
+ GFC_STRUCTURE_CAF_MODE_IN_COARRAY = 1 << 1,
+ GFC_STRUCTURE_CAF_MODE_DEALLOC_ONLY = 1 << 2
+};
+
+
/* The array-specific scalarization information. The array members of
this struct are indexed by actual array index, and thus can be sparse. */
@@ -506,7 +530,8 @@ int gfc_conv_procedure_call (gfc_se *, gfc_symbol *, gfc_actual_arglist *,
void gfc_conv_subref_array_arg (gfc_se *, gfc_expr *, int, sym_intent, bool);
/* Generate code for a scalar assignment. */
-tree gfc_trans_scalar_assign (gfc_se *, gfc_se *, gfc_typespec, bool, bool);
+tree gfc_trans_scalar_assign (gfc_se *, gfc_se *, gfc_typespec, bool, bool,
+ bool c = false);
/* Translate COMMON blocks. */
void gfc_trans_common (gfc_namespace *);
@@ -681,6 +706,10 @@ tree gfc_call_malloc (stmtblock_t *, tree, tree);
/* Build a memcpy call. */
tree gfc_build_memcpy_call (tree, tree, tree);
+/* Register memory with the coarray library. */
+void gfc_allocate_using_caf_lib (stmtblock_t *, tree, tree, tree, tree, tree,
+ tree, gfc_coarray_regtype);
+
/* Allocate memory for allocatable variables, with optional status variable. */
void gfc_allocate_allocatable (stmtblock_t*, tree, tree, tree, tree,
tree, tree, tree, gfc_expr*, int);
@@ -690,14 +719,15 @@ void gfc_allocate_using_malloc (stmtblock_t *, tree, tree, tree);
/* Generate code to deallocate an array. */
tree gfc_deallocate_with_status (tree, tree, tree, tree, tree, bool,
- gfc_expr *, bool);
-tree gfc_deallocate_scalar_with_status (tree, tree, bool, gfc_expr*, gfc_typespec);
+ gfc_expr *, int);
+tree gfc_deallocate_scalar_with_status (tree, tree, tree, bool, gfc_expr*,
+ gfc_typespec, bool c = false);
/* Generate code to call realloc(). */
tree gfc_call_realloc (stmtblock_t *, tree, tree);
/* Assign a derived type constructor to a variable. */
-tree gfc_trans_structure_assign (tree, gfc_expr *, bool);
+tree gfc_trans_structure_assign (tree, gfc_expr *, bool, bool c = false);
/* Generate code for an assignment, includes scalarization. */
tree gfc_trans_assignment (gfc_expr *, gfc_expr *, bool, bool, bool p = false,
@@ -808,7 +838,7 @@ extern GTY(()) tree gfor_fndecl_co_max;
extern GTY(()) tree gfor_fndecl_co_min;
extern GTY(()) tree gfor_fndecl_co_reduce;
extern GTY(()) tree gfor_fndecl_co_sum;
-
+extern GTY(()) tree gfor_fndecl_caf_is_present;
/* Math functions. Many other math functions are handled in
trans-intrinsic.c. */
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 732bc42..99a635a 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -995,7 +995,8 @@ format_integer (const conversion_spec &spec, tree arg)
tree argmin = NULL_TREE;
tree argmax = NULL_TREE;
- if (arg && TREE_CODE (arg) == SSA_NAME
+ if (arg
+ && TREE_CODE (arg) == SSA_NAME
&& TREE_CODE (argtype) == INTEGER_TYPE)
{
/* Try to determine the range of values of the integer argument
@@ -1017,12 +1018,8 @@ format_integer (const conversion_spec &spec, tree arg)
the upper bound for %i but -3 for %u. */
if (wi::neg_p (min) && !wi::neg_p (max))
{
- argmin = build_int_cst (argtype, wi::fits_uhwi_p (min)
- ? min.to_uhwi () : min.to_shwi ());
-
- argmax = build_int_cst (argtype, wi::fits_uhwi_p (max)
- ? max.to_uhwi () : max.to_shwi ());
-
+ argmin = res.argmin;
+ argmax = res.argmax;
int minbytes = format_integer (spec, res.argmin).range.min;
int maxbytes = format_integer (spec, res.argmax).range.max;
if (maxbytes < minbytes)
@@ -1081,21 +1078,25 @@ format_integer (const conversion_spec &spec, tree arg)
int typeprec = TYPE_PRECISION (dirtype);
int argprec = TYPE_PRECISION (argtype);
- if (argprec < typeprec || POINTER_TYPE_P (argtype))
+ if (argprec < typeprec)
{
- if (TYPE_UNSIGNED (argtype))
+ if (POINTER_TYPE_P (argtype))
argmax = build_all_ones_cst (argtype);
+ else if (TYPE_UNSIGNED (argtype))
+ argmax = TYPE_MAX_VALUE (argtype);
else
- argmax = fold_build2 (LSHIFT_EXPR, argtype, integer_one_node,
- build_int_cst (integer_type_node,
- argprec - 1));
+ argmax = TYPE_MIN_VALUE (argtype);
}
else
{
- argmax = fold_build2 (LSHIFT_EXPR, dirtype, integer_one_node,
- build_int_cst (integer_type_node,
- typeprec - 1));
+ if (POINTER_TYPE_P (dirtype))
+ argmax = build_all_ones_cst (dirtype);
+ else if (TYPE_UNSIGNED (dirtype))
+ argmax = TYPE_MAX_VALUE (dirtype);
+ else
+ argmax = TYPE_MIN_VALUE (dirtype);
}
+
res.argmin = argmin;
res.argmax = argmax;
}
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index ead134c..323b07c 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-1d3e0ceee45012a1c3b4ff7f5119a72f90bfcf6a
+9be198d960e4bc46e21e4da1e3d4a1619266b8ab
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/ipa-inline-transform.c b/gcc/ipa-inline-transform.c
index efe7421..6875080 100644
--- a/gcc/ipa-inline-transform.c
+++ b/gcc/ipa-inline-transform.c
@@ -209,6 +209,9 @@ clone_inlined_nodes (struct cgraph_edge *e, bool duplicate,
duplicate = false;
e->callee->externally_visible = false;
update_noncloned_frequencies (e->callee, e->frequency);
+
+ dump_callgraph_transformation (e->callee, inlining_into,
+ "inlining to");
}
else
{
diff --git a/gcc/ira.c b/gcc/ira.c
index d20ec99..ab32288 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -2647,7 +2647,7 @@ ira_update_equiv_info_by_shuffle_insn (int to_regno, int from_regno, rtx_insn *i
}
if (find_reg_note (insn, REG_EQUIV, x) == NULL_RTX)
{
- note = set_unique_reg_note (insn, REG_EQUIV, x);
+ note = set_unique_reg_note (insn, REG_EQUIV, copy_rtx (x));
gcc_assert (note != NULL_RTX);
if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
{
@@ -3669,6 +3669,11 @@ combine_and_move_insns (void)
if (JUMP_P (use_insn))
continue;
+ /* Also don't substitute into a conditional trap insn -- it can become
+ an unconditional trap, and that is a flow control insn. */
+ if (GET_CODE (PATTERN (use_insn)) == TRAP_IF)
+ continue;
+
df_ref def = DF_REG_DEF_CHAIN (regno);
gcc_assert (DF_REG_DEF_COUNT (regno) == 1 && DF_REF_INSN_INFO (def));
rtx_insn *def_insn = DF_REF_INSN (def);
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 133b55c..260591a 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -1150,6 +1150,7 @@ check_and_process_move (bool *change_p, bool *sec_mem_p ATTRIBUTE_UNUSED)
sclass = dclass = NO_REGS;
if (REG_P (dreg))
dclass = get_reg_class (REGNO (dreg));
+ gcc_assert (dclass < LIM_REG_CLASSES);
if (dclass == ALL_REGS)
/* ALL_REGS is used for new pseudos created by transformations
like reload of SUBREG_REG (see function
@@ -1161,6 +1162,7 @@ check_and_process_move (bool *change_p, bool *sec_mem_p ATTRIBUTE_UNUSED)
return false;
if (REG_P (sreg))
sclass = get_reg_class (REGNO (sreg));
+ gcc_assert (sclass < LIM_REG_CLASSES);
if (sclass == ALL_REGS)
/* See comments above. */
return false;
@@ -5886,7 +5888,9 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
&& dst_regno >= lra_constraint_new_regno_start
&& invariant_p (SET_SRC (curr_set))
&& (cl = lra_get_allocno_class (dst_regno)) != NO_REGS
- && ! bitmap_bit_p (&invalid_invariant_regs, dst_regno))
+ && ! bitmap_bit_p (&invalid_invariant_regs, dst_regno)
+ && ! bitmap_bit_p (&invalid_invariant_regs,
+ ORIGINAL_REGNO(regno_reg_rtx[dst_regno])))
{
/* 'reload_pseudo <- invariant'. */
if (ira_class_hard_regs_num[cl] <= max_small_class_regs_num)
@@ -6157,16 +6161,20 @@ inherit_in_ebb (rtx_insn *head, rtx_insn *tail)
curr_id = lra_get_insn_recog_data (curr_insn);
for (reg = curr_id->regs; reg != NULL; reg = reg->next)
if (reg->type != OP_IN)
- bitmap_set_bit (&invalid_invariant_regs, reg->regno);
+ {
+ bitmap_set_bit (&invalid_invariant_regs, reg->regno);
+ bitmap_set_bit (&invalid_invariant_regs,
+ ORIGINAL_REGNO (regno_reg_rtx[reg->regno]));
+ }
curr_static_id = curr_id->insn_static_data;
for (reg = curr_static_id->hard_regs; reg != NULL; reg = reg->next)
if (reg->type != OP_IN)
bitmap_set_bit (&invalid_invariant_regs, reg->regno);
if (curr_id->arg_hard_regs != NULL)
for (i = 0; (regno = curr_id->arg_hard_regs[i]) >= 0; i++)
+ if (regno >= FIRST_PSEUDO_REGISTER)
bitmap_set_bit (&invalid_invariant_regs,
- regno >= FIRST_PSEUDO_REGISTER
- ? regno : regno - FIRST_PSEUDO_REGISTER);
+ regno - FIRST_PSEUDO_REGISTER);
}
/* We reached the start of the current basic block. */
if (prev_insn == NULL_RTX || prev_insn == PREV_INSN (head)
diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog
index 7957b2b..cf224806 100644
--- a/gcc/lto/ChangeLog
+++ b/gcc/lto/ChangeLog
@@ -1,3 +1,9 @@
+2016-11-30 Georg-Johann Lay <avr@gjlay.de>
+
+ PR lto/78562
+ * lto-symtab.c (lto_symtab_merge_decls_2): Don't diagnose type
+ mismatch if the two types are built-in.
+
2016-11-26 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
* lto-lang.c (lto_init): Remove initialization of ptrdiff_type_node.
diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index ce9e146..5ab9977 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -655,6 +655,14 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p)
/* Diagnose all mismatched re-declarations. */
FOR_EACH_VEC_ELT (mismatches, i, decl)
{
+ /* Do not diagnose two built-in declarations, there is no useful
+ location in that case. It also happens for AVR if two built-ins
+ use the same asm name because their libgcc assembler code is the
+ same, see PR78562. */
+ if (DECL_IS_BUILTIN (prevailing->decl)
+ && DECL_IS_BUILTIN (decl))
+ continue;
+
int level = warn_type_compatibility_p (TREE_TYPE (prevailing->decl),
TREE_TYPE (decl),
DECL_COMDAT (decl));
diff --git a/gcc/real.c b/gcc/real.c
index 66e88e2..eabe22d 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -2887,7 +2887,7 @@ real_hash (const REAL_VALUE_TYPE *r)
return h;
case rvc_normal:
- h |= REAL_EXP (r) << 3;
+ h |= (unsigned int)REAL_EXP (r) << 3;
break;
case rvc_nan:
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 4e4eb2e..60550ad 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -4840,6 +4840,8 @@ num_sign_bit_copies1 (const_rtx x, machine_mode mode, const_rtx known_x,
if (mode == VOIDmode)
mode = GET_MODE (x);
+ gcc_checking_assert (mode != BLKmode);
+
if (mode == VOIDmode || FLOAT_MODE_P (mode) || FLOAT_MODE_P (GET_MODE (x))
|| VECTOR_MODE_P (GET_MODE (x)) || VECTOR_MODE_P (mode))
return 1;
diff --git a/gcc/selftest.c b/gcc/selftest.c
index 2a729be..6df73c2 100644
--- a/gcc/selftest.c
+++ b/gcc/selftest.c
@@ -198,6 +198,53 @@ read_file (const location &loc, const char *path)
return result;
}
+/* Selftests for libiberty. */
+
+/* Verify that both strndup and xstrndup generate EXPECTED
+ when called on SRC and N. */
+
+static void
+assert_strndup_eq (const char *expected, const char *src, size_t n)
+{
+ char *buf = strndup (src, n);
+ if (buf)
+ ASSERT_STREQ (expected, buf);
+ free (buf);
+
+ buf = xstrndup (src, n);
+ ASSERT_STREQ (expected, buf);
+ free (buf);
+}
+
+/* Verify that strndup and xstrndup work as expected. */
+
+static void
+test_strndup ()
+{
+ assert_strndup_eq ("", "test", 0);
+ assert_strndup_eq ("t", "test", 1);
+ assert_strndup_eq ("te", "test", 2);
+ assert_strndup_eq ("tes", "test", 3);
+ assert_strndup_eq ("test", "test", 4);
+ assert_strndup_eq ("test", "test", 5);
+
+ /* Test on an string without zero termination. */
+ const char src[4] = {'t', 'e', 's', 't'};
+ assert_strndup_eq ("", src, 0);
+ assert_strndup_eq ("t", src, 1);
+ assert_strndup_eq ("te", src, 2);
+ assert_strndup_eq ("tes", src, 3);
+ assert_strndup_eq ("test", src, 4);
+}
+
+/* Run selftests for libiberty. */
+
+static void
+test_libiberty ()
+{
+ test_strndup ();
+}
+
/* Selftests for the selftest system itself. */
/* Sanity-check the ASSERT_ macros with various passing cases. */
@@ -245,6 +292,7 @@ test_read_file ()
void
selftest_c_tests ()
{
+ test_libiberty ();
test_assertions ();
test_named_temp_file ();
test_read_file ();
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 7778db5..7ed849f 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -752,6 +752,7 @@ simplify_truncation (machine_mode mode, rtx op,
changing len. */
if ((GET_CODE (op) == ZERO_EXTRACT || GET_CODE (op) == SIGN_EXTRACT)
&& REG_P (XEXP (op, 0))
+ && GET_MODE (XEXP (op, 0)) == mode
&& CONST_INT_P (XEXP (op, 1))
&& CONST_INT_P (XEXP (op, 2)))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aeac71a..f38b586 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,116 @@
+2016-11-30 Martin Sebor <msebor@redhat.com>
+
+ PR tree-optimization/78586
+ * gcc.dg/tree-ssa/builtin-sprintf-2.c: New test cases.
+
+2016-11-30 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR tree-optimization/77856
+ * gcc.target/i386/pr77856.c: New.
+
+2016-11-30 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/debug/dwarf2/ptrdmem-1.C: Don't XFAIL
+ scan-assembler-not on AIX.
+
+2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ * gfortran.dg/coarray_lib_alloc_4.f90: Really add.
+
+2016-11-30 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/eh/new1.C: XFAIL on AIX.
+ * g++.dg/eh/delete1.C: Same.
+ * g++.dg/init/new40.C: Same.
+ * g++.old-deja/g++.eh/new2.C: Same.
+
+2016-11-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/78498
+ * gcc.dg/format/pr78494.c: Rename to...
+ * gcc.dg/format/pr78498.c: ...this.
+
+2016-11-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/78498
+ * gcc.dg/format/pr78494.c: New test case.
+
+2016-11-30 David Edelsohn <dje.gcc@gmail.com>
+
+ * g++.dg/debug/dwarf2/ref-1.C: Don't XFAIL scan-assembler-not on AIX.
+ * g++.dg/debug/dwarf2/imported-decl-2.C: Same.
+ * g++.dg/debug/dwarf2/refqual-1.C: Same.
+ * g++.dg/debug/dwarf2/refqual-2.C: Same.
+
+2016-11-30 Segher Boessenkool <segher@kernel.crashing.org>
+
+ PR rtl-optimization/78610
+ * gcc.c-torture/compile/pr78610.c: New testcase.
+
+2016-11-30 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/78574
+ * gcc.c-torture/compile/pr78574.c: New test.
+
+2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ * gfortran.dg/coarray/alloc_comp_1.f90: Fix tree-dump scans to adhere
+ to the changed interfaces.
+ * gfortran.dg/coarray_alloc_comp_1.f08: Likewise.
+ * gfortran.dg/coarray_allocate_7.f08: Likewise.
+ * gfortran.dg/coarray_lib_alloc_1.f90: Likewise.
+ * gfortran.dg/coarray_lib_alloc_2.f90: Likewise.
+ * gfortran.dg/coarray_lib_alloc_3.f90: Likewise.
+ * gfortran.dg/coarray_lib_comm_1.f90: Likewise.
+ * gfortran.dg/coarray_lib_alloc_4.f90: New test.
+
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78593
+ * gfortran.dg/derived_result.f90: New test case.
+
+2016-11-30 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * lib/target-supports.exp (add_options_for_arm_arch_v6m): Add
+ -mfloat-abi=soft option.
+ (add_options_for_arm_arch_v8m_base): Likewise. Reindent containing
+ foreach loop.
+
+2016-11-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ PR target/78362
+ * gcc.c-torture/compile/pr78362.c: New test.
+
+2016-11-30 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * lib/target-supports.exp (check_effective_target_freorder): Check
+ additional case.
+
+2016-11-30 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gcc.target/arc/arc700-stld-hazard.c: New file.
+
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78592
+ * gfortran.dg/dtio_18.f90: New test case.
+
+2016-11-30 Martin Liska <mliska@suse.cz>
+
+ PR sanitizer/78541
+ * gcc.dg/asan/pr78541-2.c: New test.
+ * gcc.dg/asan/pr78541.c: New test.
+
+2016-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/78586
+ * gcc.c-torture/execute/pr78586.c: New test.
+
+2016-11-30 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/78573
+ * gfortran.dg/class_61.f90: New test case.
+
2016-11-29 David Malcolm <dmalcolm@redhat.com>
PR preprocessor/78569
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C
index 22458c0..8163a5f 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/imported-decl-2.C
@@ -28,5 +28,5 @@ BBBB::method (int b)
return a + b;
}
-// { dg-final { scan-assembler-not "ascii \"BBBB\\\\0\".*ascii \"AAAA\\\\0\".*DW_TAG_imported_declaration" { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-not "ascii \"BBBB\\\\0\".*ascii \"AAAA\\\\0\".*DW_TAG_imported_declaration" } }
// { dg-final { scan-assembler-times "ascii \"AAAA\\\\0\".*ascii \"BBBB\\\\0\".*DIE .0x\[0-9a-f\]*. DW_TAG_imported_declaration" 1 { xfail { powerpc-ibm-aix* } } } }
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C
index 5d65196..bebf7fb 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/ptrdmem-1.C
@@ -2,7 +2,7 @@
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 { xfail { powerpc-ibm-aix* } } } }
// { dg-final { scan-assembler-times " DW_AT_use_location" 1 { xfail { powerpc-ibm-aix* } } } }
-// { dg-final { scan-assembler-not " DW_AT_reference" { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-not " DW_AT_reference" } }
struct S;
typedef int S::*pdm;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/ref-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/ref-1.C
index 75e9fca..8689606 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/ref-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/ref-1.C
@@ -1,6 +1,6 @@
// { dg-do compile }
// { dg-options "-O -g -dA -gno-strict-dwarf" }
-// { dg-final { scan-assembler-not "DW_TAG_const_type" { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-not "DW_TAG_const_type" } }
int x;
int &y = x;
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C
index 221008e..aba02b0 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-1.C
@@ -2,7 +2,7 @@
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 { xfail { powerpc-ibm-aix* } } } }
// { dg-final { scan-assembler-times " DW_AT_reference" 2 { xfail { powerpc-ibm-aix* } } } }
-// { dg-final { scan-assembler-not " DW_AT_use_location" { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-not " DW_AT_use_location" } }
/* It is not clear what if anything we should output for
DW_AT_use_location in a pointer to member function, so we don't
output it for now. */
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C
index ddf33c1..3cd424e 100644
--- a/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/refqual-2.C
@@ -2,7 +2,7 @@
// { dg-options "-O -std=c++11 -g -dA -gno-strict-dwarf" }
// { dg-final { scan-assembler-times "DIE \\(\[^\n\]*\\) DW_TAG_ptr_to_member_type" 1 { xfail { powerpc-ibm-aix* } } } }
// { dg-final { scan-assembler-times " DW_AT_rvalue_reference" 2 { xfail { powerpc-ibm-aix* } } } }
-// { dg-final { scan-assembler-not " DW_AT_use_location" { xfail { powerpc-ibm-aix* } } } }
+// { dg-final { scan-assembler-not " DW_AT_use_location" } }
/* It is not clear what if anything we should output for
DW_AT_use_location in a pointer to member function, so we don't
output it for now. */
diff --git a/gcc/testsuite/g++.dg/eh/delete1.C b/gcc/testsuite/g++.dg/eh/delete1.C
index 43d7bc0..64ccb50 100644
--- a/gcc/testsuite/g++.dg/eh/delete1.C
+++ b/gcc/testsuite/g++.dg/eh/delete1.C
@@ -1,4 +1,6 @@
// { dg-do run }
+// { dg-xfail-run-if "AIX operator delete" { powerpc-ibm-aix* } }
+
// pr 55635, the delete operator must be called, regardless of whether
// the dtor throws
diff --git a/gcc/testsuite/g++.dg/eh/new1.C b/gcc/testsuite/g++.dg/eh/new1.C
index 3126f19..2a68517 100644
--- a/gcc/testsuite/g++.dg/eh/new1.C
+++ b/gcc/testsuite/g++.dg/eh/new1.C
@@ -3,6 +3,7 @@
// right pointer to operator delete.
// { dg-do run }
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
#include <new>
diff --git a/gcc/testsuite/g++.dg/init/new40.C b/gcc/testsuite/g++.dg/init/new40.C
index 026712d..30d9de6 100644
--- a/gcc/testsuite/g++.dg/init/new40.C
+++ b/gcc/testsuite/g++.dg/init/new40.C
@@ -3,6 +3,7 @@
// In C++11 we throw bad_array_new_length instead.
// { dg-options -std=c++03 }
// { dg-do run }
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
#include <assert.h>
#include <stdlib.h>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new2.C b/gcc/testsuite/g++.old-deja/g++.eh/new2.C
index f3e8982..563a794 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/new2.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/new2.C
@@ -2,6 +2,7 @@
// Test that a throw in B's constructor destroys the A and frees the memory.
// Avoid use of none-overridable new/delete operators in shared
// { dg-options "-static" { target *-*-mingw* } }
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
#include <cstddef>
#include <cstdlib>
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78362.c b/gcc/testsuite/gcc.c-torture/compile/pr78362.c
new file mode 100644
index 0000000..66eea7d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78362.c
@@ -0,0 +1,11 @@
+/* PR target/78362. */
+
+long a;
+
+void
+foo (void)
+{
+ for (;; a--)
+ if ((int) a)
+ break;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78574.c b/gcc/testsuite/gcc.c-torture/compile/pr78574.c
new file mode 100644
index 0000000..8c91d1e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78574.c
@@ -0,0 +1,27 @@
+/* PR tree-optimization/78574 */
+
+int a, d, f, g;
+int b[1];
+short h;
+int main() {
+ long j;
+ int k, i;
+ for (; j; j++) {
+ i = 0;
+ for (; i < 6; i++) {
+ int l = a, m = d || g;
+ L:
+ l ^ m | a;
+ }
+ b[j + 1] = 2;
+ ++k;
+ for (; g; g++) {
+ d ^= h;
+ if (f)
+ for (;;)
+ ;
+ }
+ }
+ if (k)
+ goto L;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78610.c b/gcc/testsuite/gcc.c-torture/compile/pr78610.c
new file mode 100644
index 0000000..0415ae6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr78610.c
@@ -0,0 +1,14 @@
+/* PR rtl-optimization/78610 */
+
+unsigned int ao, gl;
+
+void
+ri (void)
+{
+ for (;;)
+ {
+ if (ao != 1)
+ ao /= 0;
+ gl = 0;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr78586.c b/gcc/testsuite/gcc.c-torture/execute/pr78586.c
new file mode 100644
index 0000000..6982534
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr78586.c
@@ -0,0 +1,17 @@
+/* PR tree-optimization/78586 */
+
+void
+foo (unsigned long x)
+{
+ char a[30];
+ unsigned long b = __builtin_sprintf (a, "%lu", x);
+ if (b != 4)
+ __builtin_abort ();
+}
+
+int
+main ()
+{
+ foo (1000);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/asan/pr78541-2.c b/gcc/testsuite/gcc.dg/asan/pr78541-2.c
new file mode 100644
index 0000000..44be19c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr78541-2.c
@@ -0,0 +1,10 @@
+/* PR sanitizer/78560 */
+/* { dg-do compile } */
+
+void __quadmath_mpn_extract_flt128 (long *fp_input);
+
+int fn1 ()
+{
+ long fp_input[1];
+ int hack_digit () { __quadmath_mpn_extract_flt128 (fp_input); }
+}
diff --git a/gcc/testsuite/gcc.dg/asan/pr78541.c b/gcc/testsuite/gcc.dg/asan/pr78541.c
new file mode 100644
index 0000000..fb02082
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asan/pr78541.c
@@ -0,0 +1,25 @@
+// PR sanitizer/78560
+// { dg-do run }
+// { dg-shouldfail "asan" }
+
+void foo (double a, double b)
+{
+ double *ptr;
+ {
+ double x = a + b;
+ ptr = &x;
+ }
+ double square () { __builtin_printf ("", *ptr); }
+
+ square ();
+}
+
+int main()
+{
+ foo (1.2f, 2.3f);
+ return 0;
+}
+
+// { dg-output "ERROR: AddressSanitizer: stack-use-after-scope on address.*(\n|\r\n|\r)" }
+// { dg-output "READ of size.*" }
+// { dg-output ".*'x' <== Memory access at offset \[0-9\]* is inside this variable.*" }
diff --git a/gcc/testsuite/gcc.dg/format/pr78498.c b/gcc/testsuite/gcc.dg/format/pr78498.c
new file mode 100644
index 0000000..4b53a68
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/format/pr78498.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wall -Wextra -fdiagnostics-show-caret" } */
+
+void f (void)
+{
+ __builtin_printf ("%i", ""); /* { dg-warning "expects argument of type" } */
+/* { dg-begin-multiline-output "" }
+ __builtin_printf ("%i", "");
+ ~^ ~~
+ %s
+ { dg-end-multiline-output "" } */
+}
diff --git a/gcc/testsuite/gcc.dg/pr78582.c b/gcc/testsuite/gcc.dg/pr78582.c
new file mode 100644
index 0000000..3084e3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr78582.c
@@ -0,0 +1,18 @@
+/* PR target/78582. */
+/* { dg-options "-fprofile-generate" } */
+/* { dg-compile } */
+
+#include <setjmp.h>
+
+void reader_loop () {}
+
+int
+main (int argc, char argv, char env)
+{
+ int a;
+ sigsetjmp (0, 0);
+ argc = a = argc;
+ reader_loop ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
index 6279956..4dddccdf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-2.c
@@ -13,7 +13,11 @@
# define LINE 0
#endif
-#define INT_MAX __INT_MAX__
+#define INT_MAX __INT_MAX__
+#define INT_MIN (-INT_MAX - 1)
+
+#define LONG_MAX __LONG_MAX__
+#define LONG_MIN (-LONG_MAX - 1)
char *buf;
char buf8k [8192];
@@ -50,8 +54,13 @@ char buf8k [8192];
} \
}
+typedef __SIZE_TYPE__ size_t;
+
extern int i;
+extern unsigned u;
extern long li;
+extern unsigned long lu;
+extern size_t sz;
extern char *str;
extern double d;
@@ -162,6 +171,20 @@ RNG (0, 4, 7, "%i", i)
RNG (0, 5, 7, "%i", i)
RNG (0, 6, 7, "%i", i)
+RNG (4, 4, 32, "%i", i)
+RNG (4, 4, 32, "%u", u)
+RNG (4, 4, 32, "%li", li)
+RNG (4, 4, 32, "%lu", lu)
+RNG (4, 4, 32, "%zu", sz)
+
+/* Exercise bug 78586. */
+RNG (4, 4, 32, "%lu", (unsigned long)i)
+RNG (4, 4, 32, "%lu", (unsigned)u)
+RNG (4, 4, 32, "%lu", (unsigned long)li)
+RNG (4, 4, 32, "%lu", (unsigned long)lu)
+RNG (4, 4, 32, "%lu", (unsigned long)sz)
+
+
#if __SIZEOF_INT__ == 4
/* A 32-bit int takes up at most 11 bytes (-2147483648) not including
@@ -252,5 +275,5 @@ RNG (0, 6, 8, "%s%ls", "1", L"2");
*/
-/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 114 "optimized" { target { ilp32 || lp64 } } } } */
-/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 83 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } } */
+/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 124 "optimized" { target { ilp32 || lp64 } } } } */
+/* { dg-final { scan-tree-dump-times "> \\\[\[0-9.\]+%\\\]:\n *__builtin_abort" 93 "optimized" { target { { ! ilp32 } && { ! lp64 } } } } } */
diff --git a/gcc/testsuite/gcc.target/arc/arc700-stld-hazard.c b/gcc/testsuite/gcc.target/arc/arc700-stld-hazard.c
new file mode 100644
index 0000000..bf6ae33
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/arc700-stld-hazard.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-mcpu=arc700" } */
+
+volatile int a;
+volatile int b;
+
+void
+foo ()
+{
+ a = 1;
+ b = a;
+}
+
+/* { dg-final { scan-assembler "st r\[0-9\]+,\\\[@a\\\]\[^\n\]*\n\[ \t\]+nop_s\[^\n\]*\n\[ \t\]+nop_s\[^\n\]*\n\[ \t\]+ld r\[0-9\]+,\\\[@a\\\]" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr77856.c b/gcc/testsuite/gcc.target/i386/pr77856.c
new file mode 100644
index 0000000..81556be
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr77856.c
@@ -0,0 +1,83 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+unsigned a, e;
+
+struct S0
+{
+ int f1;
+ int f8;
+} c = {4, 6};
+
+int b, f, g, h, i, j, l, p;
+short d, o = -7;
+char k, n = 5;
+
+unsigned fn1 (int p1, int p2)
+{
+ return p2 >= 2 || p1 >> p2 ? p1 : p1 << p2;
+}
+
+static short fn2 (struct S0 p1)
+{
+ int *q = 0;
+ int r = 7;
+ if (!a)
+ {
+ c.f1 = 1;
+ for (; c.f1; c.f1--)
+ if (fn1 (10 != 0, p1.f8))
+ {
+ short s = 9 << ~o % (d ^ n);
+ int t = s >> h % ~d;
+ p = r;
+ r = s | p * (d && 9) | t;
+ int u = i & c.f1;
+ unsigned v = ~(~(u & h) | (~(8 >> c.f1) & i));
+ int w = v;
+ if (u < 9)
+ w = c.f1;
+ if (i > h && u)
+ {
+ __builtin_printf ("%d\n", c.f1);
+ continue;
+ }
+ c.f1 = w;
+ if (!p)
+ continue;
+ return 0;
+ }
+ for (;;)
+ *q = 0;
+ }
+ return 0;
+}
+
+static void fn3 ()
+{
+ fn2 (c);
+ l = c.f1 < b;
+ if (l)
+ {
+ L1:
+ e = l | j / e % ~f;
+ j = f - 4 % k < c.f1 / e / b - j - 1;
+ if (l)
+ {
+ __builtin_printf ("%d\n", b);
+ goto L1;
+ }
+ int m[245];
+ g = m[2];
+ }
+}
+
+int main ()
+{
+ fn3 ();
+ if (c.f1 != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/class_61.f90 b/gcc/testsuite/gfortran.dg/class_61.f90
new file mode 100644
index 0000000..207e1e8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_61.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR 78573: [7 Regression] [OOP] ICE in resolve_component, at fortran/resolve.c:13405
+!
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+program p
+ type t1
+ class(t2), pointer :: q(2) ! { dg-error "must have a deferred shape" }
+ end type
+end
diff --git a/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90 b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90
index 6baeabf..f1136e3 100644
--- a/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_1.f90
@@ -8,9 +8,9 @@ end type t
type(t) :: a
allocate (a%caf[3:*])
a%caf = 7
-!print *, a%caf
if (a%caf /= 7) call abort ()
if (any (lcobound (a%caf) /= [ 3 ]) &
.or. ucobound (a%caf, dim=1) /= this_image ()+2) &
call abort ()
+deallocate (a%caf)
end
diff --git a/gcc/testsuite/gfortran.dg/coarray_alloc_comp_1.f08 b/gcc/testsuite/gfortran.dg/coarray_alloc_comp_1.f08
index 659fd48..8c35fc8 100644
--- a/gcc/testsuite/gfortran.dg/coarray_alloc_comp_1.f08
+++ b/gcc/testsuite/gfortran.dg/coarray_alloc_comp_1.f08
@@ -90,4 +90,7 @@ if (.not. allocated(bar%vec( 2)%indices)) call abort()
if (any(bar[me]%vec(2)%indices /= 89)) call abort()
if (any (bar[neighbor]%vec(1)%indices /= [ 3,4,15])) call abort()
+
+deallocate(bar%vec(2)%indices, object%scalar, object%matrix)
+deallocate(bar%vec)
end program
diff --git a/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08 b/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
index 4b08941..d924176 100644
--- a/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
+++ b/gcc/testsuite/gfortran.dg/coarray_allocate_7.f08
@@ -23,6 +23,7 @@ program main
if ( object%indices(1) /= 1 ) call abort()
end program
-! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(D.\[0-9\]+, 1, &\\(\\(struct mytype\\) \\*object\\).indices.token, &\\(\\(struct mytype\\) \\*object\\).indices, 0B, 0B, 0\\);" 2 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct mytype\\) \\*object\\).indices.token, 0B, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(D.\[0-9\]+, 1, &\\(\\(struct mytype\\) \\*object\\).indices.token, &\\(\\(struct mytype\\) \\*object\\).indices, 0B, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(D.\[0-9\]+, 8, &\\(\\(struct mytype\\) \\*object\\).indices.token, &\\(\\(struct mytype\\) \\*object\\).indices, 0B, 0B, 0\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct mytype\\) \\*object\\).indices.token, 1, 0B, 0B, 0\\);" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90
index 31e4cf5..4f90bdf 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_1.f90
@@ -15,7 +15,7 @@
! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(4, 1, &xx.token, \\(void \\*\\) &xx, &stat.., &errmsg, 200\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(8, 1, &yy.token, \\(void \\*\\) &yy, &stat.., &errmsg, 200\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx.token, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy.token, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy.token, 0B, 0B, 0.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx.token, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy.token, 0, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx.token, 0, 0B, 0B, 0.;" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90
index a83963c..90998ee 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_2.f90
@@ -17,7 +17,7 @@
! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, &xx._data.token, \\(void \\*\\) &xx._data, &stat.., &errmsg, 200\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, &yy._data.token, \\(void \\*\\) &yy._data, &stat.., &errmsg, 200\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, 0B, 0B, 0.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90
index 33cda92..17f800f 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_3.f90
@@ -18,7 +18,7 @@ subroutine test
! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, &xx._data.token, \\(void \\*\\) &xx._data, &stat.., &errmsg, 200\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(1, 1, &yy._data.token, \\(void \\*\\) &yy._data, &stat.., &errmsg, 200\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, &stat.., &errmsg, 200.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, 0B, 0B, 0.;" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, 0, &stat.., &errmsg, 200.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&yy._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister .&xx._data.token, 0, 0B, 0B, 0.;" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90
new file mode 100644
index 0000000..aea9fbf
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_alloc_4.f90
@@ -0,0 +1,46 @@
+! { dg-do run }
+! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" }
+!
+! Allocate/deallocate with libcaf.
+!
+
+program test_caf_alloc
+
+ type t
+ integer, allocatable :: i
+ real, allocatable :: r(:)
+ end type t
+
+ type(t), allocatable :: xx[:]
+
+ allocate (xx[*])
+
+ if (allocated(xx%i)) call abort()
+ if (allocated(xx[1]%i)) call abort()
+ if (allocated(xx[1]%r)) call abort()
+ allocate(xx%i)
+ if (.not. allocated(xx[1]%i)) call abort()
+ if (allocated(xx[1]%r)) call abort()
+
+ allocate(xx%r(5))
+ if (.not. allocated(xx[1]%i)) call abort()
+ if (.not. allocated(xx[1]%r)) call abort()
+
+ deallocate(xx%i)
+ if (allocated(xx[1]%i)) call abort()
+ if (.not. allocated(xx[1]%r)) call abort()
+
+ deallocate(xx%r)
+ if (allocated(xx[1]%i)) call abort()
+ if (allocated(xx[1]%r)) call abort()
+
+ deallocate(xx)
+end
+
+! { dg-final { scan-tree-dump-times "_gfortran_caf_is_present \\(xx\\.token, 2 - \\(integer\\(kind=4\\)\\) xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)|_gfortran_caf_is_present \\(xx\\.token, 2 - xx\\.dim\\\[0\\\]\\.lbound, &caf_ref\\.\[0-9\]+\\)" 10 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(72, 1, &xx\\.token, \\(void \\*\\) &xx, 0B, 0B, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 7" 2 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_register \\(\[0-9\]+, 8" 2 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&xx\\.token, 0, 0B, 0B, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct t \\* restrict\\) xx\\.data\\)->r\\.token, 1, 0B, 0B, 0\\)" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_deregister \\(&\\(\\(struct t \\* restrict\\) xx\\.data\\)->_caf_i, 1, 0B, 0B, 0\\)" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90 b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
index a17feab..8ad6b08 100644
--- a/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
+++ b/gcc/testsuite/gfortran.dg/coarray_lib_comm_1.f90
@@ -38,8 +38,8 @@ B(1:5) = B(3:7)
if (any (A-B /= 0)) call abort
end
-! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
-! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, _gfortran_caf_this_image \\\(0\\\), &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 1, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 0, 0B\\\);" 1 "original" } }
+! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &parm.\[0-9\]+, 4, 4, 1, 0B\\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 1, 0B\\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_get \\\(caf_token.1, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) b, 1, &parm.\[0-9\]+, 0B, &p, 4, 4, 0, 0B\\\);" 1 "original" } }
! { dg-final { scan-tree-dump-times "_gfortran_caf_sendget \\\(caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, caf_token.0, \\\(integer\\\(kind=\[48\]\\\)\\\) parm.\[0-9\]+.data - \\\(integer\\\(kind=\[48\]\\\)\\\) a, 1, &parm.\[0-9\]+, 0B, 4, 4, 0, 0B\\\);" 1 "original" } }
diff --git a/gcc/testsuite/gfortran.dg/derived_result.f90 b/gcc/testsuite/gfortran.dg/derived_result.f90
new file mode 100644
index 0000000..76d4a49
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/derived_result.f90
@@ -0,0 +1,10 @@
+! { dg-do compile }
+!
+! PR 78593: [6/7 Regression] ICE in gfc_match_varspec, at fortran/primary.c:2053
+!
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+type(t) function add (x, y) ! { dg-error "is not accessible" }
+ integer, intent(in) :: x, y
+ add%a = x + y ! { dg-error "Unclassifiable statement" }
+end
diff --git a/gcc/testsuite/gfortran.dg/dtio_18.f90 b/gcc/testsuite/gfortran.dg/dtio_18.f90
new file mode 100644
index 0000000..cc85ba5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dtio_18.f90
@@ -0,0 +1,15 @@
+! { dg-do compile }
+!
+! PR 78592: [7 Regression] ICE in gfc_find_specific_dtio_proc, at fortran/interface.c:4939
+!
+! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
+
+program p
+ type t
+ end type
+ type(t) :: z
+ interface write(formatted)
+ module procedure wf ! { dg-error "is neither function nor subroutine" }
+ end interface
+ print *, z
+end
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 2192eb6..798cf6b 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1011,12 +1011,19 @@ proc check_effective_target_fstack_protector {} {
}
# Return 1 if compilation with -freorder-blocks-and-partition is error-free
-# for trivial code, 0 otherwise.
+# for trivial code, 0 otherwise. As some targets (ARM for example) only
+# warn when -fprofile-use is also supplied we test that combination too.
proc check_effective_target_freorder {} {
- return [check_no_compiler_messages freorder object {
+ if { [check_no_compiler_messages freorder object {
void foo (void) { }
} "-freorder-blocks-and-partition"]
+ && [check_no_compiler_messages fprofile_use_freorder object {
+ void foo (void) { }
+ } "-fprofile-use -freorder-blocks-and-partition"] } {
+ return 1
+ }
+ return 0
}
# Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
@@ -3721,25 +3728,26 @@ proc check_effective_target_arm_fp16_hw { } {
# Usage: /* { dg-require-effective-target arm_arch_v5_ok } */
# /* { dg-add-options arm_arch_v5 } */
# /* { dg-require-effective-target arm_arch_v5_multilib } */
-foreach { armfunc armflag armdef } { v4 "-march=armv4 -marm" __ARM_ARCH_4__
- v4t "-march=armv4t" __ARM_ARCH_4T__
- v5 "-march=armv5 -marm" __ARM_ARCH_5__
- v5t "-march=armv5t" __ARM_ARCH_5T__
- v5te "-march=armv5te" __ARM_ARCH_5TE__
- v6 "-march=armv6" __ARM_ARCH_6__
- v6k "-march=armv6k" __ARM_ARCH_6K__
- v6t2 "-march=armv6t2" __ARM_ARCH_6T2__
- v6z "-march=armv6z" __ARM_ARCH_6Z__
- v6m "-march=armv6-m -mthumb" __ARM_ARCH_6M__
- v7a "-march=armv7-a" __ARM_ARCH_7A__
- v7r "-march=armv7-r" __ARM_ARCH_7R__
- v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
- v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
- v8a "-march=armv8-a" __ARM_ARCH_8A__
- v8_1a "-march=armv8.1a" __ARM_ARCH_8A__
- v8_2a "-march=armv8.2a" __ARM_ARCH_8A__
- v8m_base "-march=armv8-m.base -mthumb" __ARM_ARCH_8M_BASE__
- v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ } {
+foreach { armfunc armflag armdef } {
+ v4 "-march=armv4 -marm" __ARM_ARCH_4__
+ v4t "-march=armv4t" __ARM_ARCH_4T__
+ v5 "-march=armv5 -marm" __ARM_ARCH_5__
+ v5t "-march=armv5t" __ARM_ARCH_5T__
+ v5te "-march=armv5te" __ARM_ARCH_5TE__
+ v6 "-march=armv6" __ARM_ARCH_6__
+ v6k "-march=armv6k" __ARM_ARCH_6K__
+ v6t2 "-march=armv6t2" __ARM_ARCH_6T2__
+ v6z "-march=armv6z" __ARM_ARCH_6Z__
+ v6m "-march=armv6-m -mthumb -mfloat-abi=soft" __ARM_ARCH_6M__
+ v7a "-march=armv7-a" __ARM_ARCH_7A__
+ v7r "-march=armv7-r" __ARM_ARCH_7R__
+ v7m "-march=armv7-m -mthumb" __ARM_ARCH_7M__
+ v7em "-march=armv7e-m -mthumb" __ARM_ARCH_7EM__
+ v8a "-march=armv8-a" __ARM_ARCH_8A__
+ v8_1a "-march=armv8.1a" __ARM_ARCH_8A__
+ v8_2a "-march=armv8.2a" __ARM_ARCH_8A__
+ v8m_base "-march=armv8-m.base -mthumb -mfloat-abi=soft" __ARM_ARCH_8M_BASE__
+ v8m_main "-march=armv8-m.main -mthumb" __ARM_ARCH_8M_MAIN__ } {
eval [string map [list FUNC $armfunc FLAG $armflag DEF $armdef ] {
proc check_effective_target_arm_arch_FUNC_ok { } {
if { [ string match "*-marm*" "FLAG" ] &&
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 5c667a2..00b287a 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1853,6 +1853,11 @@ find_deriving_biv_for_expr (struct ivopts_data *data, tree expr)
{
ssa_op_iter iter;
use_operand_p use_p;
+ basic_block phi_bb = gimple_bb (phi);
+
+ /* Skip loop header PHI that doesn't define biv. */
+ if (phi_bb->loop_father == data->current_loop)
+ return NULL;
if (virtual_operand_p (gimple_phi_result (phi)))
return NULL;
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index affc7f0..d3966f5 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,24 @@
+2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ * caf/single.c (_gfortran_caf_get_by_ref): Prevent compile time
+ warning.
+ (_gfortran_caf_send_by_ref): Same.
+ (_gfortran_caf_is_present): Prevent fallthrough warnings.
+
+2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ * caf/libcaf.h: Add new action types for (de-)registration of
+ allocatable components in derived type coarrays. Add _caf_is_present
+ prototype.
+ * caf/single.c (_gfortran_caf_register): Add support for registration
+ only and allocation of already registered allocatable components in
+ derived type coarrays.
+ (_gfortran_caf_deregister): Add mode to deallocate but not deregister
+ an allocatable component in a derived type coarray.
+ (_gfortran_caf_is_present): New function. Query whether an
+ allocatable component in a derived type coarray on a remote image is
+ allocated.
+
2016-11-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/51119
diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h
index aad0f62..1bb5176 100644
--- a/libgfortran/caf/libcaf.h
+++ b/libgfortran/caf/libcaf.h
@@ -50,7 +50,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define STAT_STOPPED_IMAGE 6000
#endif
-/* Describes what type of array we are registerring. Keep in sync with
+/* Describes what type of array we are registerring. Keep in sync with
gcc/fortran/trans.h. */
typedef enum caf_register_t {
CAF_REGTYPE_COARRAY_STATIC,
@@ -59,10 +59,20 @@ typedef enum caf_register_t {
CAF_REGTYPE_LOCK_ALLOC,
CAF_REGTYPE_CRITICAL,
CAF_REGTYPE_EVENT_STATIC,
- CAF_REGTYPE_EVENT_ALLOC
+ CAF_REGTYPE_EVENT_ALLOC,
+ CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY,
+ CAF_REGTYPE_COARRAY_ALLOC_ALLOCATE_ONLY
}
caf_register_t;
+/* Describes the action to take on _caf_deregister. Keep in sync with
+ gcc/fortran/trans.h. */
+typedef enum caf_deregister_t {
+ CAF_DEREGTYPE_COARRAY_DEREGISTER,
+ CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY
+}
+caf_deregister_t;
+
typedef void* caf_token_t;
typedef gfc_array_void gfc_descriptor_t;
@@ -174,7 +184,8 @@ int _gfortran_caf_num_images (int, int);
void _gfortran_caf_register (size_t, caf_register_t, caf_token_t *,
gfc_descriptor_t *, int *, char *, int);
-void _gfortran_caf_deregister (caf_token_t *, int *, char *, int);
+void _gfortran_caf_deregister (caf_token_t *, caf_deregister_t, int *, char *,
+ int);
void _gfortran_caf_sync_all (int *, char *, int);
void _gfortran_caf_sync_memory (int *, char *, int);
@@ -232,4 +243,6 @@ void _gfortran_caf_event_post (caf_token_t, size_t, int, int *, char *, int);
void _gfortran_caf_event_wait (caf_token_t, size_t, int, int *, char *, int);
void _gfortran_caf_event_query (caf_token_t, size_t, int, int *, int *);
+int _gfortran_caf_is_present (caf_token_t, int, caf_reference_t *);
+
#endif /* LIBCAF_H */
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index 00b7120..d1b3359 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -144,11 +144,17 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
|| type == CAF_REGTYPE_CRITICAL || type == CAF_REGTYPE_EVENT_STATIC
|| type == CAF_REGTYPE_EVENT_ALLOC)
local = calloc (size, sizeof (bool));
+ else if (type == CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY)
+ local = NULL;
else
local = malloc (size);
- *token = malloc (sizeof (struct caf_single_token));
- if (unlikely (local == NULL || *token == NULL))
+ if (type != CAF_REGTYPE_COARRAY_ALLOC_ALLOCATE_ONLY)
+ *token = malloc (sizeof (struct caf_single_token));
+
+ if (unlikely (*token == NULL
+ || (local == NULL
+ && type != CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY)))
{
/* Freeing the memory conditionally seems pointless, but
caf_internal_error () may return, when a stat is given and then the
@@ -163,7 +169,7 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
single_token = TOKEN (*token);
single_token->memptr = local;
- single_token->owning_memory = true;
+ single_token->owning_memory = type != CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY;
single_token->desc = GFC_DESCRIPTOR_RANK (data) > 0 ? data : NULL;
@@ -184,7 +190,7 @@ _gfortran_caf_register (size_t size, caf_register_t type, caf_token_t *token,
void
-_gfortran_caf_deregister (caf_token_t *token, int *stat,
+_gfortran_caf_deregister (caf_token_t *token, caf_deregister_t type, int *stat,
char *errmsg __attribute__ ((unused)),
int errmsg_len __attribute__ ((unused)))
{
@@ -193,7 +199,16 @@ _gfortran_caf_deregister (caf_token_t *token, int *stat,
if (single_token->owning_memory && single_token->memptr)
free (single_token->memptr);
- free (TOKEN (*token));
+ if (type != CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY)
+ {
+ free (TOKEN (*token));
+ *token = NULL;
+ }
+ else
+ {
+ single_token->memptr = NULL;
+ single_token->owning_memory = false;
+ }
if (stat)
*stat = 0;
@@ -1456,7 +1471,7 @@ _gfortran_caf_get_by_ref (caf_token_t token,
size_t dst_index[GFC_MAX_DIMENSIONS];
int dst_rank = GFC_DESCRIPTOR_RANK (dst);
int dst_cur_dim = 0;
- size_t src_size;
+ size_t src_size = 0;
caf_single_token_t single_token = TOKEN (token);
void *memptr = single_token->memptr;
gfc_descriptor_t *src = single_token->desc;
@@ -2310,7 +2325,7 @@ _gfortran_caf_send_by_ref (caf_token_t token,
size_t dst_index[GFC_MAX_DIMENSIONS];
int src_rank = GFC_DESCRIPTOR_RANK (src);
int src_cur_dim = 0;
- size_t src_size;
+ size_t src_size = 0;
caf_single_token_t single_token = TOKEN (token);
void *memptr = single_token->memptr;
gfc_descriptor_t *dst = single_token->desc;
@@ -2882,3 +2897,104 @@ _gfortran_caf_unlock (caf_token_t token, size_t index,
}
_gfortran_caf_error_stop_str (msg, (int32_t) strlen (msg));
}
+
+int
+_gfortran_caf_is_present (caf_token_t token,
+ int image_index __attribute__ ((unused)),
+ caf_reference_t *refs)
+{
+ const char arraddressingnotallowed[] = "libcaf_single::caf_is_present(): "
+ "only scalar indexes allowed.\n";
+ const char unknownreftype[] = "libcaf_single::caf_get_by_ref(): "
+ "unknown reference type.\n";
+ const char unknownarrreftype[] = "libcaf_single::caf_get_by_ref(): "
+ "unknown array reference type.\n";
+ size_t i;
+ caf_single_token_t single_token = TOKEN (token);
+ void *memptr = single_token->memptr;
+ gfc_descriptor_t *src = single_token->desc;
+ caf_reference_t *riter = refs;
+
+ while (riter)
+ {
+ switch (riter->type)
+ {
+ case CAF_REF_COMPONENT:
+ if (riter->u.c.caf_token_offset)
+ {
+ single_token = *(caf_single_token_t*)
+ (memptr + riter->u.c.caf_token_offset);
+ memptr = single_token->memptr;
+ src = single_token->desc;
+ }
+ else
+ {
+ memptr += riter->u.c.offset;
+ src = (gfc_descriptor_t *)memptr;
+ }
+ break;
+ case CAF_REF_ARRAY:
+ for (i = 0; riter->u.a.mode[i] != CAF_ARR_REF_NONE; ++i)
+ {
+ switch (riter->u.a.mode[i])
+ {
+ case CAF_ARR_REF_SINGLE:
+ memptr += (riter->u.a.dim[i].s.start
+ - GFC_DIMENSION_LBOUND (src->dim[i]))
+ * GFC_DIMENSION_STRIDE (src->dim[i])
+ * riter->item_size;
+ break;
+ case CAF_ARR_REF_FULL:
+ /* A full array ref is allowed on the last reference only. */
+ if (riter->next == NULL)
+ break;
+ /* else fall through reporting an error. */
+ /* FALLTHROUGH */
+ case CAF_ARR_REF_VECTOR:
+ case CAF_ARR_REF_RANGE:
+ case CAF_ARR_REF_OPEN_END:
+ case CAF_ARR_REF_OPEN_START:
+ caf_internal_error (arraddressingnotallowed, 0, NULL, 0);
+ return 0;
+ default:
+ caf_internal_error (unknownarrreftype, 0, NULL, 0);
+ return 0;
+ }
+ }
+ break;
+ case CAF_REF_STATIC_ARRAY:
+ for (i = 0; riter->u.a.mode[i] != CAF_ARR_REF_NONE; ++i)
+ {
+ switch (riter->u.a.mode[i])
+ {
+ case CAF_ARR_REF_SINGLE:
+ memptr += riter->u.a.dim[i].s.start
+ * riter->u.a.dim[i].s.stride
+ * riter->item_size;
+ break;
+ case CAF_ARR_REF_FULL:
+ /* A full array ref is allowed on the last reference only. */
+ if (riter->next == NULL)
+ break;
+ /* else fall through reporting an error. */
+ /* FALLTHROUGH */
+ case CAF_ARR_REF_VECTOR:
+ case CAF_ARR_REF_RANGE:
+ case CAF_ARR_REF_OPEN_END:
+ case CAF_ARR_REF_OPEN_START:
+ caf_internal_error (arraddressingnotallowed, 0, NULL, 0);
+ return 0;
+ default:
+ caf_internal_error (unknownarrreftype, 0, NULL, 0);
+ return 0;
+ }
+ }
+ break;
+ default:
+ caf_internal_error (unknownreftype, 0, NULL, 0);
+ return 0;
+ }
+ riter = riter->next;
+ }
+ return memptr != NULL;
+}
diff --git a/libgo/go/runtime/traceback_gccgo.go b/libgo/go/runtime/traceback_gccgo.go
index b102826..f61f9a0 100644
--- a/libgo/go/runtime/traceback_gccgo.go
+++ b/libgo/go/runtime/traceback_gccgo.go
@@ -89,6 +89,15 @@ func showframe(name string, gp *g) bool {
if g.m.throwing > 0 && gp != nil && (gp == g.m.curg || gp == g.m.caughtsig.ptr()) {
return true
}
+
+ // Gccgo can trace back through C functions called via cgo.
+ // We want to print those in the traceback.
+ // But unless GOTRACEBACK > 1 (checked below), still skip
+ // internal C functions and cgo-generated functions.
+ if !contains(name, ".") && !hasprefix(name, "__go_") && !hasprefix(name, "_cgo_") {
+ return true
+ }
+
level, _, _ := gotraceback()
// Special case: always show runtime.gopanic frame, so that we can
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 4bd0eb0..9e2a300 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,24 @@
+2016-11-30 Alexander Monakov <amonakov@ispras.ru>
+
+ * config/nvptx/env.c: Delete.
+ * icv.c: Move definitions of ICV variables back ...
+ * env.c: ...here. Do not compile environment-related functionality if
+ LIBGOMP_OFFLOADED_ONLY is set.
+
+2016-11-30 Alexander Monakov <amonakov@ispras.ru>
+
+ * configure.ac [nvptx*-*-*] (libgomp_offloaded_only): Set and use it...
+ (LIBGOMP_OFFLOADED_ONLY): ...here; new define.
+ * configure: Regenerate.
+ * config.h.in: Likewise.
+
+2016-11-30 Alexander Monakov <amonakov@ispras.ru>
+
+ * Makefile.in: Regenerate with automake-1.11.6.
+ * aclocal.m4: Likewise.
+ * configure: Likewise.
+ * testsuite/Makefile.in: Likewise.
+
2016-11-28 Alexander Monakov <amonakov@ispras.ru>
* config/nvptx/critical.c: Delete to use generic implementation.
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index e62daec..92c087f 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -45,6 +45,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -120,6 +137,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
am__installdirs = "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(infodir)" \
"$(DESTDIR)$(fincludedir)" "$(DESTDIR)$(libsubincludedir)" \
"$(DESTDIR)$(toolexeclibdir)"
@@ -203,6 +226,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
HEADERS = $(nodist_finclude_HEADERS) $(nodist_libsubinclude_HEADERS) \
$(nodist_noinst_HEADERS) $(nodist_toolexeclib_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
@@ -465,7 +493,7 @@ all: config.h
.SUFFIXES:
.SUFFIXES: .c .dvi .f90 .lo .o .obj .ps
-am--refresh:
+am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/plugin/Makefrag.am $(am__configure_deps)
@for dep in $?; do \
@@ -490,6 +518,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
+$(top_srcdir)/plugin/Makefrag.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
@@ -501,10 +530,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
config.h: stamp-h1
- @if test ! -f $@; then \
- rm -f stamp-h1; \
- $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
- else :; fi
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
@@ -528,7 +555,6 @@ libgomp.spec: $(top_builddir)/config.status $(srcdir)/libgomp.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@list='$(toolexeclib_LTLIBRARIES)'; test -n "$(toolexeclibdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -536,6 +562,8 @@ install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(toolexeclibdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(toolexeclibdir)"; \
}
@@ -557,11 +585,11 @@ clean-toolexeclibLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libgomp-plugin-hsa.la: $(libgomp_plugin_hsa_la_OBJECTS) $(libgomp_plugin_hsa_la_DEPENDENCIES)
+libgomp-plugin-hsa.la: $(libgomp_plugin_hsa_la_OBJECTS) $(libgomp_plugin_hsa_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_hsa_la_DEPENDENCIES)
$(libgomp_plugin_hsa_la_LINK) $(am_libgomp_plugin_hsa_la_rpath) $(libgomp_plugin_hsa_la_OBJECTS) $(libgomp_plugin_hsa_la_LIBADD) $(LIBS)
-libgomp-plugin-nvptx.la: $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_DEPENDENCIES)
+libgomp-plugin-nvptx.la: $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_DEPENDENCIES) $(EXTRA_libgomp_plugin_nvptx_la_DEPENDENCIES)
$(libgomp_plugin_nvptx_la_LINK) $(am_libgomp_plugin_nvptx_la_rpath) $(libgomp_plugin_nvptx_la_OBJECTS) $(libgomp_plugin_nvptx_la_LIBADD) $(LIBS)
-libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES)
+libgomp.la: $(libgomp_la_OBJECTS) $(libgomp_la_DEPENDENCIES) $(EXTRA_libgomp_la_DEPENDENCIES)
$(libgomp_la_LINK) -rpath $(toolexeclibdir) $(libgomp_la_OBJECTS) $(libgomp_la_LIBADD) $(LIBS)
mostlyclean-compile:
@@ -729,9 +757,7 @@ uninstall-html-am:
uninstall-info-am:
@$(PRE_UNINSTALL)
- @if test -d '$(DESTDIR)$(infodir)' && \
- (install-info --version && \
- install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+ @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
relfile=`echo "$$file" | sed 's|^.*/||'`; \
@@ -805,8 +831,11 @@ maintainer-clean-aminfo:
done
install-nodist_fincludeHEADERS: $(nodist_finclude_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(fincludedir)" || $(MKDIR_P) "$(DESTDIR)$(fincludedir)"
@list='$(nodist_finclude_HEADERS)'; test -n "$(fincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(fincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(fincludedir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -820,13 +849,14 @@ uninstall-nodist_fincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_finclude_HEADERS)'; test -n "$(fincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(fincludedir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(fincludedir)" && rm -f $$files
+ dir='$(DESTDIR)$(fincludedir)'; $(am__uninstall_files_from_dir)
install-nodist_libsubincludeHEADERS: $(nodist_libsubinclude_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(libsubincludedir)" || $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)"
@list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libsubincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libsubincludedir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -840,13 +870,14 @@ uninstall-nodist_libsubincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_libsubinclude_HEADERS)'; test -n "$(libsubincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(libsubincludedir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(libsubincludedir)" && rm -f $$files
+ dir='$(DESTDIR)$(libsubincludedir)'; $(am__uninstall_files_from_dir)
install-nodist_toolexeclibHEADERS: $(nodist_toolexeclib_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(toolexeclibdir)" || $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)"
@list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -860,9 +891,7 @@ uninstall-nodist_toolexeclibHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(nodist_toolexeclib_HEADERS)'; test -n "$(toolexeclibdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- test -n "$$files" || exit 0; \
- echo " ( cd '$(DESTDIR)$(toolexeclibdir)' && rm -f" $$files ")"; \
- cd "$(DESTDIR)$(toolexeclibdir)" && rm -f $$files
+ dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -1017,10 +1046,15 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
@@ -1065,8 +1099,11 @@ install-dvi: install-dvi-recursive
install-dvi-am: $(DVIS)
@$(NORMAL_INSTALL)
- test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)"
@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -1082,18 +1119,22 @@ install-html: install-html-recursive
install-html-am: $(HTMLS)
@$(NORMAL_INSTALL)
- test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"
@list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
$(am__strip_dir) \
- if test -d "$$d$$p"; then \
+ d2=$$d$$p; \
+ if test -d "$$d2"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
$(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
- echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
- $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+ echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+ $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
else \
- list2="$$list2 $$d$$p"; \
+ list2="$$list2 $$d2"; \
fi; \
done; \
test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
@@ -1105,9 +1146,12 @@ install-info: install-info-recursive
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
- test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
+ fi; \
for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
@@ -1125,8 +1169,7 @@ install-info-am: $(INFO_DEPS)
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
@$(POST_INSTALL)
- @if (install-info --version && \
- install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+ @if $(am__can_run_installinfo); then \
list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
for file in $$list; do \
relfile=`echo "$$file" | sed 's|^.*/||'`; \
@@ -1140,8 +1183,11 @@ install-pdf: install-pdf-recursive
install-pdf-am: $(PDFS)
@$(NORMAL_INSTALL)
- test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -1153,8 +1199,11 @@ install-ps: install-ps-recursive
install-ps-am: $(PSS)
@$(NORMAL_INSTALL)
- test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)"
@list='$(PSS)'; test -n "$(psdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
diff --git a/libgomp/aclocal.m4 b/libgomp/aclocal.m4
index 6aff9fd..a1f51f2 100644
--- a/libgomp/aclocal.m4
+++ b/libgomp/aclocal.m4
@@ -1,7 +1,8 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -19,12 +20,15 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
+# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# serial 1
+
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
@@ -34,7 +38,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.1], [],
+m4_if([$1], [1.11.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -50,19 +54,21 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# serial 1
+
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@@ -144,14 +150,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
+# 2010, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 10
+# serial 12
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
@@ -191,6 +197,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
+ rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
@@ -255,7 +262,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
break
fi
;;
- msvisualcpp | msvcmsys)
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
@@ -320,10 +327,13 @@ AC_DEFUN([AM_DEP_TRACK],
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
+ am__nodep='_no'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
@@ -545,12 +555,15 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
+# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# serial 1
+
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
@@ -569,8 +582,8 @@ AC_SUBST(install_sh)])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
+# 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -590,7 +603,7 @@ AC_DEFUN([AM_MAINTAINER_MODE],
[disable], [m4_define([am_maintainer_other], [enable])],
[m4_define([am_maintainer_other], [enable])
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
-AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
@@ -701,12 +714,15 @@ else
fi
])
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
+# Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# serial 1
+
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
@@ -729,13 +745,14 @@ esac
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 4
+# serial 5
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -743,13 +760,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
-# ------------------------------
+# --------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
+# ------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@@ -825,12 +842,14 @@ Check your system clock])
fi
AC_MSG_RESULT(yes)])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
+# serial 1
+
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
@@ -853,13 +872,13 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 2
+# serial 3
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
@@ -868,13 +887,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
+# --------------------------
# Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -896,10 +915,11 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4_if([$1], [v7],
- [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
diff --git a/libgomp/config.h.in b/libgomp/config.h.in
index b54dd87..583b9b4 100644
--- a/libgomp/config.h.in
+++ b/libgomp/config.h.in
@@ -115,6 +115,9 @@
/* Define to 1 if GNU symbol versioning is used for libgomp. */
#undef LIBGOMP_GNU_SYMBOL_VERSIONING
+/* Define to 1 if building libgomp for an accelerator-only target. */
+#undef LIBGOMP_OFFLOADED_ONLY
+
/* Define to 1 if libgomp should use POSIX threads. */
#undef LIBGOMP_USE_PTHREADS
diff --git a/libgomp/config/nvptx/env.c b/libgomp/config/nvptx/env.c
deleted file mode 100644
index e69de29..0000000
--- a/libgomp/config/nvptx/env.c
+++ /dev/null
diff --git a/libgomp/configure b/libgomp/configure
index a61f135..6355ad9 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -683,6 +683,7 @@ AR
am__fastdepCC_FALSE
am__fastdepCC_TRUE
CCDEPMODE
+am__nodep
AMDEPBACKSLASH
AMDEP_FALSE
AMDEP_TRUE
@@ -3285,11 +3286,11 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
-# Always define AMTAR for backward compatibility.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
@@ -4187,6 +4188,7 @@ fi
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
+ am__nodep='_no'
fi
if test "x$enable_dependency_tracking" != xno; then
AMDEP_TRUE=
@@ -4211,6 +4213,7 @@ else
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
+ rm -rf conftest.dir
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
@@ -4270,7 +4273,7 @@ else
break
fi
;;
- msvisualcpp | msvcmsys)
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted.
@@ -11148,7 +11151,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11151 "configure"
+#line 11154 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11254,7 +11257,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11257 "configure"
+#line 11260 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15071,6 +15074,8 @@ case "$host" in
nvptx*-*-*)
# NVPTX does not support Pthreads, has its own code replacement.
libgomp_use_pthreads=no
+ # NVPTX is an accelerator-only target
+ libgomp_offloaded_only=yes
;;
*)
# Check to see if -pthread or -lpthread is needed. Prefer the former.
@@ -15122,6 +15127,12 @@ $as_echo "#define LIBGOMP_USE_PTHREADS 1" >>confdefs.h
fi
+if test x$libgomp_offloaded_only = xyes; then
+
+$as_echo "#define LIBGOMP_OFFLOADED_ONLY 1" >>confdefs.h
+
+fi
+
# Plugins for offload execution, configure.ac fragment. -*- mode: autoconf -*-
#
# Copyright (C) 2014-2016 Free Software Foundation, Inc.
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index 5f1db7e..4086d3f 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -182,6 +182,8 @@ case "$host" in
nvptx*-*-*)
# NVPTX does not support Pthreads, has its own code replacement.
libgomp_use_pthreads=no
+ # NVPTX is an accelerator-only target
+ libgomp_offloaded_only=yes
;;
*)
# Check to see if -pthread or -lpthread is needed. Prefer the former.
@@ -208,6 +210,11 @@ if test x$libgomp_use_pthreads != xno; then
[Define to 1 if libgomp should use POSIX threads.])
fi
+if test x$libgomp_offloaded_only = xyes; then
+ AC_DEFINE(LIBGOMP_OFFLOADED_ONLY, 1,
+ [Define to 1 if building libgomp for an accelerator-only target.])
+fi
+
m4_include([plugin/configfrag.ac])
# Check for functions needed.
diff --git a/libgomp/env.c b/libgomp/env.c
index 7ba7663..63899a2 100644
--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -23,13 +23,15 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* This file arranges for OpenMP internal control variables to be initialized
- from environment variables at startup. */
+/* This file defines the OpenMP internal control variables and arranges
+ for them to be initialized from environment variables at startup. */
#include "libgomp.h"
+#include "gomp-constants.h"
+#include <limits.h>
+#ifndef LIBGOMP_OFFLOADED_ONLY
#include "libgomp_f.h"
#include "oacc-int.h"
-#include "gomp-constants.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
@@ -48,12 +50,44 @@
# endif
# endif
#endif
-#include <limits.h>
#include <errno.h>
#ifndef HAVE_STRTOULL
# define strtoull(ptr, eptr, base) strtoul (ptr, eptr, base)
#endif
+#endif /* LIBGOMP_OFFLOADED_ONLY */
+
+struct gomp_task_icv gomp_global_icv = {
+ .nthreads_var = 1,
+ .thread_limit_var = UINT_MAX,
+ .run_sched_var = GFS_DYNAMIC,
+ .run_sched_chunk_size = 1,
+ .default_device_var = 0,
+ .dyn_var = false,
+ .nest_var = false,
+ .bind_var = omp_proc_bind_false,
+ .target_data = NULL
+};
+
+unsigned long gomp_max_active_levels_var = INT_MAX;
+bool gomp_cancel_var = false;
+int gomp_max_task_priority_var = 0;
+#ifndef HAVE_SYNC_BUILTINS
+gomp_mutex_t gomp_managed_threads_lock;
+#endif
+unsigned long gomp_available_cpus = 1, gomp_managed_threads = 1;
+unsigned long long gomp_spin_count_var, gomp_throttled_spin_count_var;
+unsigned long *gomp_nthreads_var_list, gomp_nthreads_var_list_len;
+char *gomp_bind_var_list;
+unsigned long gomp_bind_var_list_len;
+void **gomp_places_list;
+unsigned long gomp_places_list_len;
+int gomp_debug_var;
+unsigned int gomp_num_teams_var;
+char *goacc_device_type;
+int goacc_device_num;
+
+#ifndef LIBGOMP_OFFLOADED_ONLY
/* Parse the OMP_SCHEDULE environment variable. */
@@ -1273,3 +1307,4 @@ initialize_env (void)
goacc_runtime_initialize ();
}
+#endif /* LIBGOMP_OFFLOADED_ONLY */
diff --git a/libgomp/icv.c b/libgomp/icv.c
index e58b961..cf00e24 100644
--- a/libgomp/icv.c
+++ b/libgomp/icv.c
@@ -23,43 +23,13 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* This file defines the OpenMP internal control variables and associated
- OpenMP API entry points. */
+/* This file defines the OpenMP API entry points that operate on internal
+ control variables. */
#include "libgomp.h"
#include "gomp-constants.h"
#include <limits.h>
-struct gomp_task_icv gomp_global_icv = {
- .nthreads_var = 1,
- .thread_limit_var = UINT_MAX,
- .run_sched_var = GFS_DYNAMIC,
- .run_sched_chunk_size = 1,
- .default_device_var = 0,
- .dyn_var = false,
- .nest_var = false,
- .bind_var = omp_proc_bind_false,
- .target_data = NULL
-};
-
-unsigned long gomp_max_active_levels_var = INT_MAX;
-bool gomp_cancel_var = false;
-int gomp_max_task_priority_var = 0;
-#ifndef HAVE_SYNC_BUILTINS
-gomp_mutex_t gomp_managed_threads_lock;
-#endif
-unsigned long gomp_available_cpus = 1, gomp_managed_threads = 1;
-unsigned long long gomp_spin_count_var, gomp_throttled_spin_count_var;
-unsigned long *gomp_nthreads_var_list, gomp_nthreads_var_list_len;
-char *gomp_bind_var_list;
-unsigned long gomp_bind_var_list_len;
-void **gomp_places_list;
-unsigned long gomp_places_list_len;
-int gomp_debug_var;
-unsigned int gomp_num_teams_var;
-char *goacc_device_type;
-int goacc_device_num;
-
void
omp_set_num_threads (int n)
{
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 5a73d30..1fae9e8 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -1,9 +1,9 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,6 +15,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -59,6 +76,11 @@ CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = libgomp-test-support.pt.exp
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
DEJATOOL = $(PACKAGE)
RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
ACLOCAL = @ACLOCAL@
@@ -280,7 +302,7 @@ CTAGS:
check-DEJAGNU: site.exp
- srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ srcdir='$(srcdir)'; export srcdir; \
EXPECT=$(EXPECT); export EXPECT; \
runtest=$(RUNTEST); \
if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
@@ -291,12 +313,12 @@ check-DEJAGNU: site.exp
else echo "WARNING: could not find \`runtest'" 1>&2; :;\
fi; \
exit $$exit_status
-site.exp: Makefile
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
@echo 'Making a new site.exp file...'
@echo '## these variables are automatically generated by make ##' >site.tmp
@echo '# Do not edit here. If you wish to override these values' >>site.tmp
@echo '# edit the last section' >>site.tmp
- @echo 'set srcdir $(srcdir)' >>site.tmp
+ @echo 'set srcdir "$(srcdir)"' >>site.tmp
@echo "set objdir `pwd`" >>site.tmp
@echo 'set build_alias "$(build_alias)"' >>site.tmp
@echo 'set build_triplet $(build_triplet)' >>site.tmp
@@ -304,9 +326,16 @@ site.exp: Makefile
@echo 'set host_triplet $(host_triplet)' >>site.tmp
@echo 'set target_alias "$(target_alias)"' >>site.tmp
@echo 'set target_triplet $(target_triplet)' >>site.tmp
- @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
- @test ! -f site.exp || \
- sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+ @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+ echo "## Begin content included from file $$f. Do not modify. ##" \
+ && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+ && echo "## End content included from file $$f. ##" \
+ || exit 1; \
+ done >> site.tmp
+ @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp
+ @if test -f site.exp; then \
+ sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \
+ fi
@-rm -f site.bak
@test ! -f site.exp || mv site.exp site.bak
@mv site.tmp site.exp
@@ -331,10 +360,15 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 42164c4..f0959c9 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,11 @@
+2016-11-30 David Malcolm <dmalcolm@redhat.com>
+
+ PR c/78498
+ * strndup.c (strlen): Delete decl.
+ (strnlen): Add decl.
+ (strndup): Call strnlen rather than strlen.
+ * xstrndup.c (xstrndup): Likewise.
+
2016-11-29 Nathan Sidwell <nathan@acm.org>
* cp-demangle.c (d_print_comp_inner): Fix parameter indentation.
diff --git a/libiberty/strndup.c b/libiberty/strndup.c
index 9e9b4e2..4556b96 100644
--- a/libiberty/strndup.c
+++ b/libiberty/strndup.c
@@ -33,7 +33,7 @@ memory was available. The result is always NUL terminated.
#include "ansidecl.h"
#include <stddef.h>
-extern size_t strlen (const char*);
+extern size_t strnlen (const char *s, size_t maxlen);
extern PTR malloc (size_t);
extern PTR memcpy (PTR, const PTR, size_t);
@@ -41,10 +41,7 @@ char *
strndup (const char *s, size_t n)
{
char *result;
- size_t len = strlen (s);
-
- if (n < len)
- len = n;
+ size_t len = strnlen (s, n);
result = (char *) malloc (len + 1);
if (!result)
diff --git a/libiberty/xstrndup.c b/libiberty/xstrndup.c
index 0a41f60..c3d2d83 100644
--- a/libiberty/xstrndup.c
+++ b/libiberty/xstrndup.c
@@ -48,10 +48,7 @@ char *
xstrndup (const char *s, size_t n)
{
char *result;
- size_t len = strlen (s);
-
- if (n < len)
- len = n;
+ size_t len = strnlen (s, n);
result = XNEWVEC (char, len + 1);
diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog
index d38ac75..f6eadaf 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,12 +1,24 @@
2016-11-30 Matthias Klose <doko@ubuntu.com>
+ * configure.ac: Set BDW_GC_CFLAGS and BDW_GC_LIBS after checking
+ for the existence of the pkg-config modules.
+ * Regenerate.
+
+2016-11-30 Jakub Jelinek <jakub@redhat.com>
+
+ * configure.ac (--enable-objc-gc): If not given, default to
+ enable_objc_gc=no.
+ * configure: Regenerated.
+
+2016-11-30 Matthias Klose <doko@ubuntu.com>
+
* configure.ac (--enable-objc-gc): Allow to configure with a
system provided boehm-gc.
* configure: Regenerate.
* Makefile.in (OBJC_BOEHM_GC_LIBS): Get value from configure.
* gc.c: Include system bdw-gc headers.
- * memory.c: Likewise
- * objects.c: Likewise
+ * memory.c: Likewise.
+ * objects.c: Likewise.
2016-11-15 Matthias Klose <doko@ubuntu.com>
diff --git a/libobjc/configure b/libobjc/configure
index 43a68de..c617f27 100755
--- a/libobjc/configure
+++ b/libobjc/configure
@@ -11509,6 +11509,8 @@ $as_echo "#define HAVE_BITFIELD_TYPE_MATTERS 1" >>confdefs.h
# Check whether --enable-objc-gc was given.
if test "${enable_objc_gc+set}" = set; then :
enableval=$enable_objc_gc;
+else
+ enable_objc_gc=no
fi
@@ -11666,6 +11668,8 @@ if test -n "$PKG_CONFIG" && \
test $ac_status = 0; }; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using bdw-gc pkg-config module" >&5
$as_echo "using bdw-gc pkg-config module" >&6; }
+ BDW_GC_CFLAGS=`$PKG_CONFIG --cflags bdw-gc`
+ BDW_GC_LIBS=`$PKG_CONFIG --libs bdw-gc`
else
as_fn_error "no --with-target-bdw-gc options and no bdw-gc pkg-config module found" "$LINENO" 5
fi
diff --git a/libobjc/configure.ac b/libobjc/configure.ac
index 0497836..2303143 100644
--- a/libobjc/configure.ac
+++ b/libobjc/configure.ac
@@ -203,7 +203,7 @@ gt_BITFIELD_TYPE_MATTERS
AC_ARG_ENABLE(objc-gc,
[AS_HELP_STRING([--enable-objc-gc],
[enable use of Boehm's garbage collector with the
- GNU Objective-C runtime])])
+ GNU Objective-C runtime])],,enable_objc_gc=no)
AC_ARG_WITH([target-bdw-gc],
[AS_HELP_STRING([--with-target-bdw-gc=PATHLIST],
[specify prefix directory for installed bdw-gc package.
@@ -225,7 +225,9 @@ no)
if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw_gc_lib" = x; then
dnl no bdw-gw options, fall back to the bdw-gc pkg-config module
PKG_CHECK_EXISTS(bdw-gc,
- AC_MSG_RESULT([using bdw-gc pkg-config module]),
+ [AC_MSG_RESULT([using bdw-gc pkg-config module])
+ BDW_GC_CFLAGS=`$PKG_CONFIG --cflags bdw-gc`
+ BDW_GC_LIBS=`$PKG_CONFIG --libs bdw-gc`],
AC_MSG_ERROR([no --with-target-bdw-gc options and no bdw-gc pkg-config module found]))
else
dnl bdw-gw options passed by configure flags
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index 5fe324a..3dc49d3 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,14 @@
+2016-11-30 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ * LOCAL_PATCHES: Add revision.
+
+2016-11-30 Maxim Ostapenko <m.ostapenko@samsung.com>
+
+ PR sanitizer/78532
+ * sanitizer_common/sanitizer_platform_limits_posix.h
+ (__sanitizer_sigaction): Adjust for sparc targets and various Glibc
+ versions.
+
2016-11-29 Markus Trippelsdorf <markus@trippelsdorf.de>
* LOCAL_PATCHES: Remove r242480.
diff --git a/libsanitizer/LOCAL_PATCHES b/libsanitizer/LOCAL_PATCHES
index 21e9530..822e2f3 100644
--- a/libsanitizer/LOCAL_PATCHES
+++ b/libsanitizer/LOCAL_PATCHES
@@ -3,3 +3,4 @@ r241980
r241981
r242478
r242633
+r243014
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index d1a3051..066bf41 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -25,6 +25,10 @@
# define GET_LINK_MAP_BY_DLOPEN_HANDLE(handle) ((link_map*)(handle))
#endif // !SANITIZER_FREEBSD
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
namespace __sanitizer {
extern unsigned struct_utsname_sz;
extern unsigned struct_stat_sz;
@@ -628,7 +632,14 @@ namespace __sanitizer {
#endif
#ifndef __mips__
#if defined(__sparc__)
+#if __GLIBC_PREREQ (2, 20)
+ // On sparc glibc 2.19 and earlier sa_flags was unsigned long, and
+ // __glibc_reserved0 didn't exist.
+ int __glibc_reserved0;
+ int sa_flags;
+#else
unsigned long sa_flags;
+#endif
#else
int sa_flags;
#endif
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 02ad29e..6d3bfcc 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,51 @@
+2016-11-30 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Fix testsuite failures caused by the patch implementing LWG 2534.
+ * include/std/istream (__is_convertible_to_basic_istream):
+ Change the return types of __check, introduce istream_type.
+ (operator>>(_Istream&&, _Tp&&)):
+ Use __is_convertible_to_basic_istream::istream_type as the return type.
+ * include/std/ostream (__is_convertible_to_basic_ostream):
+ Change the return types of __check, introduce ostream_type.
+ (operator>>(_Ostream&&, _Tp&&)):
+ Use __is_convertible_to_basic_ostream::ostream_type as the return type.
+
+2016-11-30 Tim Shen <timshen@google.com>
+
+ * include/bits/shared_ptr_base.h
+ (__shared_ptr_access<T, L, true, false>::operator*()): Fix assertion.
+
+2016-11-30 David Edelsohn <dje.gcc@gmail.com>
+
+ * testsuite/18_support/50594.cc: XFAIL on AIX.
+ * testsuite/ext/mt_allocator/check_new.cc: Same.
+ * testsuite/ext/pool_allocator/check_new.cc: Same.
+ * testsuite/27_io/ios_base/storage/11584.cc: Same.
+
+2016-11-30 Ville Voutilainen <ville.voutilainen@gmail.com>
+
+ Implement LWG 2534, Constrain rvalue stream operators.
+ * include/std/istream (__is_convertible_to_basic_istream): New.
+ (__is_extractable): Likewise.
+ (operator>>(basic_istream<_CharT, _Traits>&&, _Tp&&)):
+ Turn the stream parameter into a template parameter
+ and constrain.
+ * include/std/ostream (__is_convertible_to_basic_ostream): New.
+ (__is_insertable): Likewise.
+ (operator<<(basic_ostream<_CharT, _Traits>&&, const _Tp&)):
+ Turn the stream parameter into a template parameter
+ and constrain.
+ * testsuite/27_io/basic_istream/extractors_other/char/4.cc: New.
+ * testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
+ Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/char/6.cc: Likewise.
+ * testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc: Likewise.
+
+2016-11-30 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * testsuite/experimental/type_erased_allocator/2.cc: Add
+ dg-require-thread-fence.
+
2016-11-29 David Edelsohn <dje.gcc@gmail.com>
PR libstdc++/68838
diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h
index 953aa87..2fb70b7 100644
--- a/libstdc++-v3/include/bits/shared_ptr_base.h
+++ b/libstdc++-v3/include/bits/shared_ptr_base.h
@@ -1000,7 +1000,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
element_type&
operator*() const noexcept
{
- __glibcxx_assert(_M_ptr != nullptr);
+ __glibcxx_assert(_M_get() != nullptr);
return *_M_get();
}
diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream
index c8a2e08..319e226 100644
--- a/libstdc++-v3/include/std/istream
+++ b/libstdc++-v3/include/std/istream
@@ -908,6 +908,30 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
ws(basic_istream<_CharT, _Traits>& __is);
#if __cplusplus >= 201103L
+
+ template<typename _Tp>
+ struct __is_convertible_to_basic_istream
+ {
+ template<typename _Ch, typename _Up>
+ static basic_istream<_Ch, _Up>& __check(basic_istream<_Ch, _Up>*);
+
+ static void __check(void*);
+ public:
+ using istream_type =
+ decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
+ using type = __not_<is_same<istream_type, void>>;
+ constexpr static bool value = type::value;
+ };
+
+ template<typename _Istream, typename _Tp, typename = void>
+ struct __is_extractable : false_type {};
+
+ template<typename _Istream, typename _Tp>
+ struct __is_extractable<_Istream, _Tp,
+ __void_t<decltype(declval<_Istream&>()
+ >> declval<_Tp>())>>
+ : true_type {};
+
// [27.7.1.6] Rvalue stream extraction
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 2328. Rvalue stream extraction should use perfect forwarding
@@ -921,9 +945,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* rvalue streams since they won't bind to the extractor functions
* that take an lvalue reference.
*/
- template<typename _CharT, typename _Traits, typename _Tp>
- inline basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
+ template<typename _Istream, typename _Tp>
+ inline
+ typename enable_if<__and_<__not_<is_lvalue_reference<_Istream>>,
+ __is_convertible_to_basic_istream<_Istream>,
+ __is_extractable<_Istream&, _Tp&&>>::value,
+ typename __is_convertible_to_basic_istream<
+ _Istream>::istream_type>::type
+ operator>>(_Istream&& __is, _Tp&& __x)
{
__is >> std::forward<_Tp>(__x);
return __is;
diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream
index 0bf53f0..70fd10b 100644
--- a/libstdc++-v3/include/std/ostream
+++ b/libstdc++-v3/include/std/ostream
@@ -613,6 +613,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return __os.flush(); }
#if __cplusplus >= 201103L
+ template<typename _Tp>
+ struct __is_convertible_to_basic_ostream
+ {
+ template<typename _Ch, typename _Up>
+ static basic_ostream<_Ch, _Up>& __check(basic_ostream<_Ch, _Up>*);
+
+ static void __check(void*);
+ public:
+ using ostream_type =
+ decltype(__check(declval<typename remove_reference<_Tp>::type*>()));
+ using type = __not_<is_same<ostream_type, void>>;
+ constexpr static bool value = type::value;
+ };
+
+ template<typename _Ostream, typename _Tp, typename = void>
+ struct __is_insertable : false_type {};
+
+ template<typename _Ostream, typename _Tp>
+ struct __is_insertable<_Ostream, _Tp,
+ __void_t<decltype(declval<_Ostream&>()
+ << declval<const _Tp&>())>>
+ : true_type {};
+
/**
* @brief Generic inserter for rvalue stream
* @param __os An input stream.
@@ -623,9 +646,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* rvalue streams since they won't bind to the inserter functions
* that take an lvalue reference.
*/
- template<typename _CharT, typename _Traits, typename _Tp>
- inline basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
+ template<typename _Ostream, typename _Tp>
+ inline
+ typename enable_if<__and_<__not_<is_lvalue_reference<_Ostream>>,
+ __is_convertible_to_basic_ostream<_Ostream>,
+ __is_insertable<_Ostream&, const _Tp&>>::value,
+ typename __is_convertible_to_basic_ostream<
+ _Ostream>::ostream_type>::type
+ operator<<(_Ostream&& __os, const _Tp& __x)
{
__os << __x;
return __os;
diff --git a/libstdc++-v3/testsuite/18_support/50594.cc b/libstdc++-v3/testsuite/18_support/50594.cc
index 88c87ee..fb49bf8 100644
--- a/libstdc++-v3/testsuite/18_support/50594.cc
+++ b/libstdc++-v3/testsuite/18_support/50594.cc
@@ -1,5 +1,6 @@
// { dg-options "-fwhole-program" }
// { dg-additional-options "-static-libstdc++" { target *-*-mingw* } }
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
// Copyright (C) 2011-2016 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc
new file mode 100644
index 0000000..0922b0b
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/char/4.cc
@@ -0,0 +1,96 @@
+// { dg-do run { target c++11 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.6.2.5.3 basic_ostream manipulator inserters
+
+#include <sstream>
+
+struct X {};
+std::istream& operator>>(std::istream&, X&) = delete;
+
+struct Y {};
+std::istream& operator>>(std::istream& is, Y&) {return is;}
+std::istream& operator>>(std::istream& is, Y&&) {return is;}
+
+struct Z{};
+
+template <class T>
+auto f(T&&) -> decltype(void(std::declval<std::istream&>()
+ >> std::declval<T&&>()),
+ std::true_type());
+
+std::false_type f(...);
+
+template <class T>
+auto g(T&&) -> decltype(void(std::declval<std::istream&&>()
+ >> std::declval<T&&>()),
+ std::true_type());
+
+std::false_type g(...);
+
+void test01()
+{
+ Y y;
+ std::istringstream is;
+ is >> y;
+ is >> Y();
+ std::istringstream() >> y;
+ std::istringstream() >> Y();
+ static_assert(!std::__is_extractable<std::istream&, X&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&&, X&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&, X&&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&&, X&&>::value, "");
+ static_assert(std::__is_extractable<std::istream&, Y&>::value, "");
+ static_assert(std::__is_extractable<std::istream&&, Y&>::value, "");
+ static_assert(std::__is_extractable<std::istream&, Y&&>::value, "");
+ static_assert(std::__is_extractable<std::istream&&, Y&&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&, Z&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&&, Z&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&, Z&&>::value, "");
+ static_assert(!std::__is_extractable<std::istream&&, Z&&>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&&>())),
+ std::false_type>::value, "");
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc
new file mode 100644
index 0000000..87c4ce4
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc
@@ -0,0 +1,96 @@
+// { dg-do run { target c++11 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.6.2.5.3 basic_ostream manipulator inserters
+
+#include <sstream>
+
+struct X {};
+std::wistream& operator>>(std::wistream&, X&) = delete;
+
+struct Y {};
+std::wistream& operator>>(std::wistream& is, Y&) {return is;}
+std::wistream& operator>>(std::wistream& is, Y&&) {return is;}
+
+struct Z{};
+
+template <class T>
+auto f(T&&) -> decltype(void(std::declval<std::wistream&>()
+ >> std::declval<T&&>()),
+ std::true_type());
+
+std::false_type f(...);
+
+template <class T>
+auto g(T&&) -> decltype(void(std::declval<std::wistream&&>()
+ >> std::declval<T&&>()),
+ std::true_type());
+
+std::false_type g(...);
+
+void test01()
+{
+ Y y;
+ std::wistringstream is;
+ is >> y;
+ is >> Y();
+ std::wistringstream() >> y;
+ std::wistringstream() >> Y();
+ static_assert(!std::__is_extractable<std::wistream&, X&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&&, X&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&, X&&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&&, X&&>::value, "");
+ static_assert(std::__is_extractable<std::wistream&, Y&>::value, "");
+ static_assert(std::__is_extractable<std::wistream&&, Y&>::value, "");
+ static_assert(std::__is_extractable<std::wistream&, Y&&>::value, "");
+ static_assert(std::__is_extractable<std::wistream&&, Y&&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&, Z&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&&, Z&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&, Z&&>::value, "");
+ static_assert(!std::__is_extractable<std::wistream&&, Z&&>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&&>())),
+ std::false_type>::value, "");
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
new file mode 100644
index 0000000..f5b27f9
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/6.cc
@@ -0,0 +1,96 @@
+// { dg-do run { target c++11 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.6.2.5.3 basic_ostream manipulator inserters
+
+#include <sstream>
+
+struct X {};
+std::ostream& operator<<(std::ostream&, const X&) = delete;
+
+struct Y {};
+std::ostream& operator<<(std::ostream& os, const Y&) {return os;}
+std::ostream& operator<<(std::ostream&& os, const Y&) {return os;}
+
+struct Z{};
+
+template <class T>
+auto f(T&&) -> decltype(void(std::declval<std::ostream&>()
+ << std::declval<T&&>()),
+ std::true_type());
+
+std::false_type f(...);
+
+template <class T>
+auto g(T&&) -> decltype(void(std::declval<std::ostream&&>()
+ << std::declval<T&&>()),
+ std::true_type());
+
+std::false_type g(...);
+
+void test01()
+{
+ Y y;
+ std::ostringstream os;
+ os << y;
+ os << Y();
+ std::ostringstream() << y;
+ std::ostringstream() << Y();
+ static_assert(!std::__is_insertable<std::ostream&, X&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&&, X&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&, X&&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&&, X&&>::value, "");
+ static_assert(std::__is_insertable<std::ostream&, Y&>::value, "");
+ static_assert(std::__is_insertable<std::ostream&&, Y&&>::value, "");
+ static_assert(std::__is_insertable<std::ostream&, Y&>::value, "");
+ static_assert(std::__is_insertable<std::ostream&&, Y&&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&, Z&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&&, Z&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&, Z&&>::value, "");
+ static_assert(!std::__is_insertable<std::ostream&&, Z&&>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&&>())),
+ std::false_type>::value, "");
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc
new file mode 100644
index 0000000..1aed058
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc
@@ -0,0 +1,96 @@
+// { dg-do run { target c++11 } }
+
+// Copyright (C) 2016 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 27.6.2.5.3 basic_ostream manipulator inserters
+
+#include <sstream>
+
+struct X {};
+std::wostream& operator<<(std::wostream&, const X&) = delete;
+
+struct Y {};
+std::wostream& operator<<(std::wostream& os, const Y&) {return os;}
+std::wostream& operator<<(std::wostream&& os, const Y&) {return os;}
+
+struct Z{};
+
+template <class T>
+auto f(T&&) -> decltype(void(std::declval<std::wostream&>()
+ << std::declval<T&&>()),
+ std::true_type());
+
+std::false_type f(...);
+
+template <class T>
+auto g(T&&) -> decltype(void(std::declval<std::wostream&&>()
+ << std::declval<T&&>()),
+ std::true_type());
+
+std::false_type g(...);
+
+void test01()
+{
+ Y y;
+ std::wostringstream os;
+ os << y;
+ os << Y();
+ std::wostringstream() << y;
+ std::wostringstream() << Y();
+ static_assert(!std::__is_insertable<std::wostream&, X&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&&, X&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&, X&&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&&, X&&>::value, "");
+ static_assert(std::__is_insertable<std::wostream&, Y&>::value, "");
+ static_assert(std::__is_insertable<std::wostream&&, Y&&>::value, "");
+ static_assert(std::__is_insertable<std::wostream&, Y&>::value, "");
+ static_assert(std::__is_insertable<std::wostream&&, Y&&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&, Z&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&&, Z&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&, Z&&>::value, "");
+ static_assert(!std::__is_insertable<std::wostream&&, Z&&>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(f(std::declval<Z&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<X&&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Y&&>())),
+ std::true_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&>())),
+ std::false_type>::value, "");
+ static_assert(std::is_same<decltype(g(std::declval<Z&&>())),
+ std::false_type>::value, "");
+}
+
+int main()
+{
+ test01();
+}
diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
index f67201f..032c175 100644
--- a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
+++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc
@@ -1,3 +1,5 @@
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
+
// 2004-01-25 jlquinn@gcc.gnu.org
// Copyright (C) 2004-2016 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/experimental/type_erased_allocator/2.cc b/libstdc++-v3/testsuite/experimental/type_erased_allocator/2.cc
index 216a88c..0b73359 100644
--- a/libstdc++-v3/testsuite/experimental/type_erased_allocator/2.cc
+++ b/libstdc++-v3/testsuite/experimental/type_erased_allocator/2.cc
@@ -1,4 +1,5 @@
// { dg-do run { target c++14 } }
+// { dg-require-thread-fence "" }
// Copyright (C) 2015-2016 Free Software Foundation, Inc.
//
diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc
index dd3f272..a2e79ea 100644
--- a/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc
+++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc
@@ -1,3 +1,5 @@
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
+
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
//
// Copyright (C) 2001-2016 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/ext/pool_allocator/check_new.cc b/libstdc++-v3/testsuite/ext/pool_allocator/check_new.cc
index 31ca634..bfd0e42 100644
--- a/libstdc++-v3/testsuite/ext/pool_allocator/check_new.cc
+++ b/libstdc++-v3/testsuite/ext/pool_allocator/check_new.cc
@@ -1,3 +1,5 @@
+// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
+
// 2001-11-25 Phil Edwards <pme@gcc.gnu.org>
//
// Copyright (C) 2001-2016 Free Software Foundation, Inc.