aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-12-19 05:32:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-12-19 05:32:22 +0000
commit413748f6ac6cc83d67f14e4fd367c90e67fa7c83 (patch)
treef0c7bc42b43b5f309e19843219ffc246003ea207
parent38b8bf768a13a88cfc0311aacc17782b1b2b10ae (diff)
parent47b6f9825f7867fcd91e3150ce6f95676ee3985d (diff)
downloadgcc-413748f6ac6cc83d67f14e4fd367c90e67fa7c83.zip
gcc-413748f6ac6cc83d67f14e4fd367c90e67fa7c83.tar.gz
gcc-413748f6ac6cc83d67f14e4fd367c90e67fa7c83.tar.bz2
Merge from trunk revision 218884.
From-SVN: r218893
-rw-r--r--ChangeLog8
-rw-r--r--MAINTAINERS3
-rw-r--r--boehm-gc/ChangeLog4
-rw-r--r--boehm-gc/testsuite/lib/boehm-gc.exp1
-rw-r--r--contrib/ChangeLog5
-rwxr-xr-xcontrib/dg-extract-results.sh25
-rw-r--r--gcc/ChangeLog700
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/gcc-interface/misc.c62
-rw-r--r--gcc/auto-profile.c9
-rw-r--r--gcc/c/ChangeLog8
-rw-r--r--gcc/c/c-convert.c15
-rw-r--r--gcc/config/aarch64/aarch64-protos.h4
-rw-r--r--gcc/config/aarch64/aarch64-simd.md32
-rw-r--r--gcc/config/aarch64/aarch64.c31
-rw-r--r--gcc/config/aarch64/aarch64.md10
-rw-r--r--gcc/config/i386/gnu-user-common.h6
-rw-r--r--gcc/config/i386/gnu-user.h5
-rw-r--r--gcc/config/i386/gnu-user64.h5
-rw-r--r--gcc/config/i386/i386-opts.h6
-rw-r--r--gcc/config/i386/i386.c27
-rw-r--r--gcc/config/i386/i386.opt21
-rw-r--r--gcc/config/msp430/msp430.c2
-rw-r--r--gcc/config/nds32/nds32.md2
-rw-r--r--gcc/config/rl78/rl78.h1
-rw-r--r--gcc/config/sh/sh.md41
-rw-r--r--gcc/config/sh/sh_treg_combine.cc85
-rw-r--r--gcc/cp/ChangeLog43
-rw-r--r--gcc/cp/constexpr.c273
-rw-r--r--gcc/cp/cp-tree.h12
-rw-r--r--gcc/cp/decl2.c25
-rw-r--r--gcc/cp/parser.c19
-rw-r--r--gcc/cp/pt.c12
-rw-r--r--gcc/cp/semantics.c3
-rw-r--r--gcc/ddg.c2
-rw-r--r--gcc/doc/invoke.texi23
-rw-r--r--gcc/dwarf2out.c909
-rw-r--r--gcc/dwarf2out.h13
-rw-r--r--gcc/fibonacci_heap.h2
-rw-r--r--gcc/flag-types.h34
-rw-r--r--gcc/fortran/ChangeLog118
-rw-r--r--gcc/fortran/arith.c18
-rw-r--r--gcc/fortran/array.c10
-rw-r--r--gcc/fortran/check.c12
-rw-r--r--gcc/fortran/cpp.c4
-rw-r--r--gcc/fortran/decl.c34
-rw-r--r--gcc/fortran/expr.c5
-rw-r--r--gcc/fortran/f95-lang.c4
-rw-r--r--gcc/fortran/frontend-passes.c8
-rw-r--r--gcc/fortran/gfortran.h73
-rw-r--r--gcc/fortran/intrinsic.c5
-rw-r--r--gcc/fortran/io.c2
-rw-r--r--gcc/fortran/lang.opt159
-rw-r--r--gcc/fortran/libgfortran.h1
-rw-r--r--gcc/fortran/match.c12
-rw-r--r--gcc/fortran/module.c10
-rw-r--r--gcc/fortran/options.c379
-rw-r--r--gcc/fortran/parse.c16
-rw-r--r--gcc/fortran/primary.c30
-rw-r--r--gcc/fortran/resolve.c32
-rw-r--r--gcc/fortran/scanner.c15
-rw-r--r--gcc/fortran/simplify.c24
-rw-r--r--gcc/fortran/symbol.c4
-rw-r--r--gcc/fortran/trans-array.c21
-rw-r--r--gcc/fortran/trans-common.c6
-rw-r--r--gcc/fortran/trans-decl.c91
-rw-r--r--gcc/fortran/trans-expr.c39
-rw-r--r--gcc/fortran/trans-intrinsic.c60
-rw-r--r--gcc/fortran/trans-openmp.c18
-rw-r--r--gcc/fortran/trans-stmt.c32
-rw-r--r--gcc/fortran/trans-types.c43
-rw-r--r--gcc/fortran/trans.c4
-rw-r--r--gcc/genmatch.c11
-rw-r--r--gcc/go/gofrontend/expressions.cc123
-rw-r--r--gcc/go/gofrontend/gogo.cc15
-rw-r--r--gcc/go/gofrontend/parse.cc8
-rw-r--r--gcc/go/gofrontend/parse.h2
-rw-r--r--gcc/go/gofrontend/statements.cc76
-rw-r--r--gcc/go/gofrontend/statements.h10
-rw-r--r--gcc/go/gofrontend/types.cc4
-rw-r--r--gcc/hwint.c16
-rw-r--r--gcc/hwint.h17
-rw-r--r--gcc/ipa-icf.c18
-rw-r--r--gcc/ipa-inline-analysis.c19
-rw-r--r--gcc/ira-int.h6
-rw-r--r--gcc/ira.c18
-rw-r--r--gcc/lra-constraints.c34
-rw-r--r--gcc/lra-remat.c21
-rw-r--r--gcc/match.pd14
-rw-r--r--gcc/sreal.c73
-rw-r--r--gcc/sreal.h94
-rw-r--r--gcc/testsuite/ChangeLog115
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr64289.c9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/deleted9.C31
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae53.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/sfinae54.C41
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-initlist1.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/constexpr-loop2.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic2.C22
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr64146.C38
-rw-r--r--gcc/testsuite/g++.dg/parse/friend12.C7
-rw-r--r--gcc/testsuite/g++.dg/template/non-dependent14.C7
-rw-r--r--gcc/testsuite/g++.dg/warn/register-parm-1.C9
-rw-r--r--gcc/testsuite/gcc.dg/addr_equal-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/lto/20110201-1_0.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr63568.c54
-rw-r--r--gcc/testsuite/gcc.dg/pr64309.c66
-rw-r--r--gcc/testsuite/gcc.dg/sms-12.c43
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp95.c50
-rw-r--r--gcc/testsuite/gcc.target/aarch64/pr62178.c17
-rw-r--r--gcc/testsuite/gcc.target/aarch64/ushr64_1.c1
-rw-r--r--gcc/testsuite/gcc.target/i386/amd64-abi-7.c46
-rw-r--r--gcc/testsuite/gcc.target/i386/amd64-abi-8.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/amd64-abi-9.c18
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-1.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-2.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-3.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-4.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-5.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-6.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr61296-7.c27
-rw-r--r--gcc/testsuite/gcc.target/i386/pr64291-1.c51
-rw-r--r--gcc/testsuite/gcc.target/i386/pr64291-2.c4
-rw-r--r--gcc/testsuite/gcc.target/sh/fpchg.c17
-rw-r--r--gcc/testsuite/gcc.target/sh/pr53513-1.c11
-rw-r--r--gcc/testsuite/gcc.target/sh/pr54089-1.c2
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_comp_40.f9026
-rw-r--r--gcc/testsuite/gfortran.dg/typebound_call_26.f9030
-rw-r--r--gcc/testsuite/lib/mpx-dg.exp3
-rw-r--r--gcc/tree-inline.c8
-rw-r--r--gcc/tree-ssa-loop-ivopts.c127
-rw-r--r--gcc/tree-streamer.c13
-rw-r--r--gcc/tree-vrp.c10
-rw-r--r--libgcc/ChangeLog7
-rw-r--r--libgcc/config/sh/crt.h29
-rw-r--r--libgcc/config/sh/crt1.S13
-rw-r--r--libgcc/config/sh/crti.S9
-rw-r--r--libgo/Makefile.am2
-rw-r--r--libgo/Makefile.in2
-rw-r--r--libsanitizer/ChangeLog7
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc8
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.h2
-rw-r--r--libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc2
-rw-r--r--libstdc++-v3/ChangeLog25
-rw-r--r--libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver4
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver4
-rw-r--r--libstdc++-v3/include/bits/regex.h26
-rw-r--r--libstdc++-v3/include/bits/regex.tcc4
-rw-r--r--libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc49
150 files changed, 3885 insertions, 1816 deletions
diff --git a/ChangeLog b/ChangeLog
index 861d016..e7cf4d4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * MAINTAINERS (Write After Approval): Add myself.
+
+2014-12-16 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
+
+ * MAINTAINERS (Write After Approval): Add myself.
+
2014-12-15 Thomas Schwinge <thomas@codesourcery.com>
* configure.ac (--enable-as-accelerator-for): Don't set
diff --git a/MAINTAINERS b/MAINTAINERS
index f240cd9..a0da233 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -412,6 +412,7 @@ Wei Guozhi <carrot@google.com>
Mostafa Hagog <hagog@gcc.gnu.org>
Olivier Hainque <hainque@act-europe.fr>
Stuart Hastings <stuart@apple.com>
+Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Pat Haugen <pthaugen@us.ibm.com>
Mark Heffernan <meheff@google.com>
George Helffrich <george@gcc.gnu.org>
@@ -448,6 +449,7 @@ Jeff Knaggs <jknaggs@redhat.com>
Michael Koch <konqueror@gmx.de>
Matt Kraai <kraai@ftbfs.org>
Jan Kratochvil <jan.kratochvil@redhat.com>
+Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Venkataramanan Kumar <venkataramanan.kumar@amd.com>
Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org>
Doug Kwan <dougkwan@google.com>
@@ -525,6 +527,7 @@ Rolf Rasmussen <rolfwr@gcc.gnu.org>
Volker Reichelt <v.reichelt@netcologne.de>
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Tom Rix <trix@redhat.com>
+Pierre-Marie de Rodat <derodat@adacore.com>
Craig Rodrigues <rodrigc@gcc.gnu.org>
Erven Rohou <erven.rohou@inria.fr>
Ira Rosen <irar@il.ibm.com>
diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog
index a0e162c..17114fa 100644
--- a/boehm-gc/ChangeLog
+++ b/boehm-gc/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * testsuite/lib/boehm-gc.exp: Load target-utils.exp.
+
2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/63784
diff --git a/boehm-gc/testsuite/lib/boehm-gc.exp b/boehm-gc/testsuite/lib/boehm-gc.exp
index c5b3e95..bafe7bb 100644
--- a/boehm-gc/testsuite/lib/boehm-gc.exp
+++ b/boehm-gc/testsuite/lib/boehm-gc.exp
@@ -27,6 +27,7 @@ load_gcc_lib wrapper.exp
load_gcc_lib target-supports.exp
# For dg-skip-if.
load_gcc_lib target-supports-dg.exp
+load_gcc_lib target-utils.exp
# For ${tool}_exit.
load_gcc_lib gcc-defs.exp
# For prune_gcc_output.
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index e6e2240..f2d21db 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-17 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * dg-extract-results.sh: Use --text with grep to avoid issues with
+ binary files. Fall back to cat -v, if that doesn't work.
+
2014-12-12 Chung-Ju Wu <jasonwucj@gmail.com>
* download_prerequisites: Modify the comment for GRAPHITE_LOOP_OPT.
diff --git a/contrib/dg-extract-results.sh b/contrib/dg-extract-results.sh
index a83c8e8..0ddf25b 100755
--- a/contrib/dg-extract-results.sh
+++ b/contrib/dg-extract-results.sh
@@ -127,13 +127,28 @@ do
done
test $ERROR -eq 0 || exit 1
+# Test if grep supports the '--text' option
+
+GREP=grep
+
+if echo -e '\x00foo\x00' | $GREP --text foo > /dev/null 2>&1 ; then
+ GREP="grep --text"
+else
+ # Our grep does not recognize the '--text' option. We have to
+ # treat our files in order to remove any non-printable character.
+ for file in $SUM_FILES ; do
+ mv $file ${file}.orig
+ cat -v ${file}.orig > $file
+ done
+fi
+
if [ -z "$TOOL" ]; then
# If no tool was specified, all specified summary files must be for
# the same tool.
- CNT=`grep '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l`
+ CNT=`$GREP '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l`
if [ $CNT -eq 1 ]; then
- TOOL=`grep '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'`
+ TOOL=`$GREP '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'`
else
msg "${PROGNAME}: sum files are for multiple tools, specify a tool"
msg ""
@@ -144,7 +159,7 @@ else
# Ignore the specified summary files that are not for this tool. This
# should keep the relevant files in the same order.
- SUM_FILES=`grep -l "=== $TOOL" $SUM_FILES`
+ SUM_FILES=`$GREP -l "=== $TOOL" $SUM_FILES`
if test -z "$SUM_FILES" ; then
msg "${PROGNAME}: none of the specified files are results for $TOOL"
exit 1
@@ -233,7 +248,7 @@ else
VARIANTS=""
for VAR in $VARS
do
- grep "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR"
+ $GREP "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR"
done
fi
@@ -435,6 +450,6 @@ cat ${TMP}/var-* | $AWK -f $TOTAL_AWK
# This is ugly, but if there's version output from the compiler under test
# at the end of the file, we want it. The other thing that might be there
# is the final summary counts.
-tail -2 $FIRST_SUM | grep '^#' > /dev/null || tail -2 $FIRST_SUM
+tail -2 $FIRST_SUM | $GREP '^#' > /dev/null || tail -2 $FIRST_SUM
exit 0
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 07aa48c..72e8dfd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,309 @@
+2014-12-18 Vladimir Makarov <vmakarov@redhat.com>
+
+ * lra-constraints.c (lra-constraints.c): Exchange places of sclass
+ and dclass.
+
+2014-12-18 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/64291
+ * lra-remat.c (bad_for_rematerialization_p): Add UNPSEC_VLOATILE.
+ (create_cands): Process only output reload insn with potential
+ cands.
+
+2014-12-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_expand_call): Skip setting up RAX
+ register for -mskip-rax-setup when there are no parameters
+ passed in vector registers.
+ * config/i386/i386.opt (mskip-rax-setup): New option.
+ * doc/invoke.texi: Document -mskip-rax-setup.
+
+2014-12-18 Alan Lawrence <alan.lawrence@arm.com>
+
+ * config/aarch64/aarch64-simd.md (aarch64_lshr_simddi): Handle shift
+ by 64 by moving const0_rtx.
+ (aarch64_ushr_simddi): Delete.
+
+ * config/aarch64/aarch64.md (enum unspec): Delete UNSPEC_USHR64.
+
+2014-12-18 Alan Lawrence <alan.lawrence@arm.com>
+
+ * config/aarch64/aarch64.md (enum "unspec"): Remove UNSPEC_SSHR64.
+
+ * config/aarch64/aarch64-simd.md (aarch64_ashr_simddi): Change shift
+ amount to 63 if was 64.
+ (aarch64_sshr_simddi): Remove.
+
+2014-12-18 Wilco Dijkstra <wilco.dijkstra@arm.com>
+
+ * gcc/config/aarch64/aarch64.c (TARGET_MIN_DIVISIONS_FOR_RECIP_MUL):
+ Define.
+ (aarch64_min_divisions_for_recip_mul): New function.
+
+2014-12-18 Wilco Dijkstra <wilco.dijkstra@arm.com>
+
+ * config/aarch64/aarch64-protos.h (tune-params): Add code alignment
+ tuning parameters.
+ * gcc/config/aarch64/aarch64.c (generic_tunings): Add code alignment
+ tuning parameters.
+ (cortexa53_tunings): Likewise.
+ (cortexa57_tunings): Likewise.
+ (thunderx_tunings): Likewise.
+ (aarch64_override_options): Use new alignment tunings.
+
+2014-12-18 Martin Liska <mliska@suse.cz>
+
+ PR tree-optimization/64330
+ * ipa-icf.c (sem_variable::parse): Add checking
+ for externally visible symbols and do not introduce
+ an alias for an external declaration.
+
+2014-12-18 Jan Hubicka <hubicka@ucw.cz>
+
+ PR bootstrap/63573
+ * tree-inline.c (remap_gimple_stmt): Handle gimple_call_from_thunk_p
+ predicate.
+
+2014-12-18 Martin Liska <mliska@suse.cz>
+
+ PR ipa/64146
+ * ipa-icf.c (sem_function::merge): Check for
+ decl_binds_to_current_def_p is newly added to merge operation.
+
+2014-12-18 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/62178
+ * tree-ssa-loop-ivopts.c (cheaper_cost_with_cand): New function.
+ (iv_ca_replace): New function.
+ (try_improve_iv_set): New parameter try_replace_p.
+ Break local optimal fixed-point by calling iv_ca_replace.
+ (find_optimal_iv_set_1): Pass new argument to try_improve_iv_set.
+
+2014-12-17 Dehao Chen <dehao@google.com>
+
+ * auto-profile.c (afdo_annotate_cfg): Invoke update_ssa in the right
+ place.
+ (auto_profile): Recompute inline summary after processing cgraph node.
+
+2014-12-17 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/51244
+ * config/sh/sh_treg_combine.cc (is_conditional_insn): New function.
+ (cbranch_trace): Add member rtx* condition_rtx_in_insn, initialize it
+ accordingly in constructor.
+ (cbranch_trace::branch_condition_rtx_ref): New function.
+ (cbranch_trace::branch_condition_rtx): Use branch_condition_rtx_ref.
+ (sh_treg_combine::try_invert_branch_condition): Invert condition rtx
+ in insn using reversed_comparison_code and validate_change instead of
+ invert_jump_1.
+ (sh_treg_combine::execute): Look for conditional insns in basic blocks
+ in addition to conditional branches.
+ * config/sh/sh.md (*movsicc_div0s): Remove combine patterns.
+
+2014-12-17 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/51244
+ * config/sh/sh_treg_combine.cc (sh_treg_combine::try_optimize_cbranch):
+ Combine ccreg inversion and cbranch into inverted cbranch.
+
+2014-12-17 Vladimir Makarov <vmakarov@redhat.com>
+
+ * lra-constraints.c (process_alt_operands): Remove non
+ allocatable hard regs when considering
+ ira_prohibited_class_mode_regs.
+
+2014-12-17 Jan Hubicka <hubicka@ucw.cz>
+
+ * sreal.h (sreal::normalize): Implement inline.
+ (sreal::normalize_up): New function.
+ (sreal::normalize_down): New function.
+ * sreal.c (sreal::normalize): Remove.
+
+2014-12-17 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/aarch64/aarch64.md (generic_sched): Delete it.
+
+2014-12-17 Jan-Benedict Glaw <jbglaw@lug-owl.de>
+
+ * config/msp430/msp430.c (msp430_asm_output_addr_const_extra): Fix
+ unused argument warning.
+
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * dwarf2out.h (struct array_descr_info): Remove the base_decl field.
+ * dwarf2out.c (enum dw_scalar_form): New.
+ (struct loc_descr_context): New.
+ (add_scalar_info): New.
+ (add_bound_info): Add a context parameter. Use add_scalar_info.
+ (loc_list_from_tree): Add a context parameter. Handle PLACEHOLDER_EXPR
+ nodes for type-related expressions. Likewise for base declarations.
+ (loc_descriptor_from_tree): Add a context parameter.
+ (subrange_type_die): Update calls to add_bound_info.
+ (tls_mem_loc_descriptor): Likewise.
+ (loc_list_for_address_of_addr_expr_of_indirect_ref): Add a context
+ parameter. Update calls to loc_list_from_tree.
+ (add_subscript_info): Update calls to add_bound_info.
+ (gen_array_type_die): Update calls to loc_list_from_tree and to
+ add_bound_info.
+ (descr_info_loc): Remove.
+ (add_descr_info_field): Remove.
+ (gen_descr_array_type_die): Switch add_descr_info_field calls into
+ add_scalar_info/add_bound_info ones.
+ (gen_subprogram_die): Update calls to loc_list_from_tree.
+ (gen_variable_die): Likewise.
+
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * dwarf2out.c (print_loc_descr): New.
+ (print_dw_val): New.
+ (print_attribute): New.
+ (print_loc_descr): New.
+ (print_die): Use print_dw_val.
+ (debug_dwarf_loc_descr): New.
+ * dwarf2out.h (debug_dwarf_loc_descr): New declaration.
+
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * dwarf2out.c (gen_type_die_with_usage): Enable the array lang-hook
+ even when (dwarf_version < 3 && dwarf_strict).
+ (gen_descr_array_die): Do not output DW_AT_data_locationn,
+ DW_AT_associated, DW_AT_allocated and DW_AT_byte_stride DWARF
+ attributes when (dwarf_version < 3 && dwarf_strict).
+
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * dwarf2out.h (enum array_descr_ordering): New.
+ (array_descr_dimen): Add a bounds_type structure field.
+ (struct array_descr_info): Add a field to hold index type information
+ and another one to hold ordering information.
+ * dwarf2out.c (gen_type_die_with_usage): Get the main variant before
+ invoking the array descriptor language hook. Initialize the
+ array_descr_info structure before calling the lang-hook.
+ (gen_descr_array_type_die): Use gen_type_die if not processing the main
+ type variant. Replace Fortran-specific code with generic one using
+ this new field. Add a GNAT descriptive type, if any. Output type
+ information for the array bound subrange, if any.
+
+2014-12-17 H.J. Lu <hongjiu.lu@intel.com>
+ Jakub Jelinek <jakub@redhat.com>
+ Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/61296
+ * config/i386/i386-opts.h (ix86_align_data): New enum.
+ * config/i386/i386.c (ix86_data_alignment): Return the ABI
+ alignment value for -malign-data=abi, the cachine line size
+ for -malign-data=cacheline and the older GCC compatible
+ alignment value for for -malign-data=compat.
+ * config/i386/i386.opt (malign-data=): New.
+ * doc/invoke.texi: Document -malign-data=.
+
+2014-12-17 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/63568
+ * match.pd: Add (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x pattern.
+
+2014-12-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64322
+ * tree-vrp.c (extract_range_from_binary_expr_1): Attempt to derive
+ range for RSHIFT_EXPR even if vr0 range is not VR_RANGE or is symbolic.
+
+2014-12-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54687
+ * flag-types.h (gfc_init_local_real, gfc_fcoarray,
+ gfc_convert): New enums; moved from fortran/.
+
+2014-12-16 Jan Hubicka <hubicka@ucw.cz>
+
+ * fibonacci_heap.h (min): Return m_data instead of non-existing data.
+
+2014-12-16 Jan Hubicka <hubicka@ucw.cz>
+
+ * ipa-inline-analysis.c (will_be_nonconstant_predicate): Consider
+ return values of const calls as constants.
+ (estimate_function_body_sizes): Expect calls to have false predicates.
+
+2014-12-16 Jan Hubicka <hubicka@ucw.cz>
+
+ * hwint.c (abs_hwi, absu_hwi): Move to ...
+ * hwint.h (abs_hwi, absu_hwi): ... here; make inline.
+
+2014-12-16 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/64309
+ * match.pd: Add ((1 << A) & 1) != 0 -> A == 0 and
+ ((1 << A) & 1) == 0 -> A != 0.
+
+2014-12-16 Richard Biener <rguenther@suse.de>
+
+ * genmatch.c (parser::parser): Initialize capture_ids.
+ (parser::parse_pattern): Properly allocate capture_ids before
+ using them. Set capture_ids to zero when its lifetime is
+ supposed to finish.
+ (parser::parse_simplify): Allocate capture_ids only if
+ required.
+
+2014-12-16 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
+
+ * sreal.c: Include math.h later.
+
+2014-12-16 Felix Yang <felix.yang@huawei.com>
+
+ PR rtl-optimization/64240
+ * ddg.c (mark_mem_use): Check *iter instead of *x.
+
+2014-12-16 Martin Liska <mliska@suse.cz>
+
+ PR ipa/64278
+ * sreal.c (sreal::operator*): Replace std::abs with absu_hwi.
+
+2014-12-16 Igor Zamyatin <igor.zamyatin@intel.com>
+
+ * config/i386/i386.c (ix86_address_cost): Add explicit restriction
+ to RTL level for the check for PIC register.
+
+2014-12-16 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/gnu-user.h (TARGET_CAN_SPLIT_STACK): Move from here ...
+ * config/i386/gnu-user64.h (TARGET_CAN_SPLIT_STACK): ... and here ...
+ * config/i386/gnu-user-common.h (TARGET_CAN_SPLIT_STACK): ... to here.
+
+2014-12-16 Chung-Ju Wu <jasonwucj@gmail.com>
+
+ PR target/64217
+ * config/nds32/nds32.md (casesi_internal): Add '=r' for clobber
+ register constraint.
+
+2014-12-15 DJ Delorie <dj@redhat.com>
+
+ * config/rl78/rl78.h: Remove SHORT_IMMEDIATES_SIGN_EXTEND.
+
+2014-12-15 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/64043
+ * tree-streamer.c (preload_common_nodes): Skip preloading
+ of main_identifier_node, pid_type and optimization/option nodes.
+
+2014-12-15 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/63397
+ * ira-int.h (ira_overall_cost, ira_reg_cost, ira_mem_cost): Use
+ int64_t.
+ (ira_load_cost, ira_store_cost, ira_shuffle_cost): Ditto.
+ * ira.c (ira_overall_cost, ira_overall_cost_before): Ditto.
+ (ira_reg_cost, ira_mem_cost): Ditto.
+ (ira_load_cost, ira_store_cost, ira_shuffle_cost): Ditto.
+ (calculate_allocation_cost, do_reload): Use the right
+ format for int64_t values.
+
+2014-12-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * sreal.h (to_double): New method.
+ (shift): Do not ICE on 0.
+ * sreal.c: Include math.h
+ (sreal::to_double): New.
+
2014-12-15 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/64316
@@ -75,13 +381,23 @@
2014-12-14 Jan Hubicka <hubicka@ucw.cz>
+ PR ipa/61602
+ * cgraph.h (ipa_discover_readonly_nonaddressable_vars): Return bool.
+ * ipa.c (set_writeonly_bit): Track if reference was removed.
+ (ipa_discover_readonly_nonaddressable_vars): Return true if any
+ references was removed.
+ * ipa-reference.c (propagate): Return TODO_remove_functions if
+ reference was removed.
+
+2014-12-14 Jan Hubicka <hubicka@ucw.cz>
+
* ipa.c (process_references): Fix conditoinal on flag_optimize
2014-12-14 Jan Hubicka <hubicka@ucw.cz>
PR ipa/61558
* symtab.c (symbol_table::insert_to_assembler_name_hash
- symbol_table::unlink_from_assembler_name_hash): Do not ICE when
+ symbol_table::unlink_from_assembler_name_hash): Do not ICE when
DECL_ASSEMBLER_NAME is NULL.
2014-12-14 Jan Hubicka <hubicka@ucw.cz>
@@ -550,9 +866,9 @@
2014-12-10 Richard Biener <rguenther@suse.de>
- * tree-ssa-loop-im.c
- (move_computations_dom_walker::before_dom_children): Clear
- SSA_NAME_RANGE_INFO on moved stmts.
+ * tree-ssa-loop-im.c
+ (move_computations_dom_walker::before_dom_children): Clear
+ SSA_NAME_RANGE_INFO on moved stmts.
2014-12-10 Martin Liska <mliska@suse.cz>
@@ -811,8 +1127,8 @@
(cortexa57_tunings): Likewise.
(thunderx_tunings): Likewise.
-2014-12-09 Andrew Pinski apinski@cavium.com
- Kyrylo Tkachov kyrylo.tkachov@arm.com
+2014-12-09 Andrew Pinski <apinski@cavium.com>
+ Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (AARCH64_FUSE_CMP_BRANCH): New define.
(thunderx_tunings): Add AARCH64_FUSE_CMP_BRANCH to fuseable_ops.
@@ -916,7 +1232,7 @@
2014-11-15 David Wohlferd <dw@LimeGreenSocks.com>
- PR target/61692
+ PR target/61692
* cfgexpand.c (expand_asm_operands): Count all inline asm params.
2014-12-08 David Malcolm <dmalcolm@redhat.com>
@@ -1218,7 +1534,8 @@
2014-12-05 Ilya Enkovich <ilya.enkovich@intel.com>
PR target/64056
- * doc/sourcebuild.texi: Add mempcpy and stpcpy for Effective-Target Keywords.
+ * doc/sourcebuild.texi: Add mempcpy and stpcpy for Effective-Target
+ Keywords.
2014-12-05 Manuel López-Ibáñez <manu@gcc.gnu.org>
@@ -1630,7 +1947,7 @@
(aarch64_simd_vec_set<mode>,vashr<mode>3, vlshr<mode>3, vec_set<mode>,
aarch64_mla<mode>, aarch64_mls<mode>, <su><maxmin><mode>3,
aarch64_<sur>h<addsub><mode>): Change VQ_S to VDQ_BHSI.
-
+
(*aarch64_<su>mlal<mode>, *aarch64_<su>mlsl<mode>,
aarch64_<ANY_EXTEND:su><ADDSUB:optab>l<mode>,
aarch64_<ANY_EXTEND:su><ADDSUB:optab>w<mode>, aarch64_<sur>shll_n<mode>):
@@ -3127,9 +3444,9 @@
2014-11-21 Andrew Bennett <andrew.bennett@imgtec.com>
- * config/mips/mips.c (mips_process_sync_loop): Place a
+ * config/mips/mips.c (mips_process_sync_loop): Place a
nop in the delay slot of the branch likely instruction.
- (mips_output_sync_loop): Ensure mips_branch_likely is
+ (mips_output_sync_loop): Ensure mips_branch_likely is
set before calling mips_output_sync_loop.
(mips_sync_loop_insns): Likewise.
@@ -3272,7 +3589,7 @@
* config/rs6000/predicates.md: Likewise.
* config/rs6000/rs6000.c (num_insns_constant_wide): Likewise.
(includes_rldic_lshift_p): Likewise.
- (includes_rldicr_lshift_p): Likewise.
+ (includes_rldicr_lshift_p): Likewise.
* emit-rtl.c (const_wide_int_htab_hash): Likewise.
* loop-iv.c (determine_max_iter): Likewise.
(iv_number_of_iterations): Likewise.
@@ -3446,10 +3763,10 @@
2014-11-19 Jan Hubicka <hubicka@ucw.cz>
PR bootstrap/63963
- * tree-streamer-out.c (write_ts_function_decl_tree_pointers): Stream out
- DECL_FUNCTION_SPECIFIC_TARGET
- * tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): Stream in
- DECL_FUNCTION_SPECIFIC_TARGET.
+ * tree-streamer-out.c (write_ts_function_decl_tree_pointers): Stream
+ out DECL_FUNCTION_SPECIFIC_TARGET
+ * tree-streamer-in.c (lto_input_ts_function_decl_tree_pointers): Stream
+ in DECL_FUNCTION_SPECIFIC_TARGET.
2014-11-19 David Malcolm <dmalcolm@redhat.com>
@@ -4433,8 +4750,9 @@
2014-11-19 Renlin Li <renlin.li@arm.com>
- * config/aarch64/aarch64.h (TARGET_CPU_CPP_BUILTINS): Define __ARM_FP_FAST,
- __ARM_FEATURE_FMA, __ARM_FP, __ARM_FEATURE_NUMERIC_MAXMIN, __ARM_NEON_FP.
+ * config/aarch64/aarch64.h (TARGET_CPU_CPP_BUILTINS): Define
+ __ARM_FP_FAST, __ARM_FEATURE_FMA, __ARM_FP,
+ __ARM_FEATURE_NUMERIC_MAXMIN, __ARM_NEON_FP.
2014-11-19 Marek Polacek <polacek@redhat.com>
@@ -6154,8 +6472,8 @@
2014-11-18 Marat Zakirov <m.zakirov@samsung.com>
- * opts.c (finish_options): Disable aggressive opts for sanitizer.
- (common_handle_option): Move code to finish_options.
+ * opts.c (finish_options): Disable aggressive opts for sanitizer.
+ (common_handle_option): Move code to finish_options.
2014-11-18 Yury Gribov <y.gribov@samsung.com>
@@ -6296,8 +6614,8 @@
2014-11-17 Jan Hubicka <hubicka@ucw.cz>
- * tree.c (free_lang_data_in_decl): Set DECL_FUNCTION_SPECIFIC_OPTIMIZATION
- to optimization_default_node.
+ * tree.c (free_lang_data_in_decl): Set
+ DECL_FUNCTION_SPECIFIC_OPTIMIZATION to optimization_default_node.
2014-11-17 Jan Hubicka <hubicka@ucw.cz>
@@ -6508,15 +6826,15 @@
* ipa-polymorphic-call.c
(ipa_polymorphic_call_context::speculation_consistent_p): Constify.
(ipa_polymorphic_call_context::meet_speculation_with): New function.
- (ipa_polymorphic_call_context::combine_with): Handle types in construction
- better.
+ (ipa_polymorphic_call_context::combine_with): Handle types in
+ construction better.
(ipa_polymorphic_call_context::equal_to): Do not bother about useless
speculation.
(ipa_polymorphic_call_context::meet_with): New function.
* cgraph.h (class ipa_polymorphic_call_context): Add
meet_width, meet_speculation_with; constify speculation_consistent_p.
- * ipa-cp.c (ipa_context_from_jfunc): Handle speculation; combine with incomming
- context.
+ * ipa-cp.c (ipa_context_from_jfunc): Handle speculation; combine
+ with incomming context.
(propagate_context_accross_jump_function): Likewise; be more cureful.
about set_contains_variable.
(ipa_get_indirect_edge_target_1): Fix handling of dynamic type changes.
@@ -6531,7 +6849,8 @@
(expand_thunk): Use get_untransformed_body.
(cgraph_node::expand): Likewise.
* tree-ssa-structalias.c (ipa_pta_execute): Skip inline clones.
- * cgraph.c (release_function_body): Do not push cfun when CFG is not there.
+ * cgraph.c (release_function_body): Do not push cfun when CFG
+ is not there.
(cgraph_node::get_untransformed_body): Break out from ...
(cgraph_node::get_body): ... here; add code to apply all transforms.
* cgraph.h (cgraph_node): Add get_untransformed_body.
@@ -6618,8 +6937,10 @@
2014-11-15 Jan Hubicka <hubicka@ucw.cz>
* lto-streamer-out.c (hash_tree): Use cl_optimization_hash.
- * lto-streamer.h (cl_optimization_stream_out, cl_optimization_stream_in): Declare.
- * optc-save-gen.awk: Generate cl_optimization LTO streaming and hashing routines.
+ * lto-streamer.h (cl_optimization_stream_out,
+ cl_optimization_stream_in): Declare.
+ * optc-save-gen.awk: Generate cl_optimization LTO streaming
+ and hashing routines.
* opth-gen.awk: Add prototype of cl_optimization_hash.
* tree-streamer-in.c (unpack_ts_optimization): Remove.
(streamer_unpack_tree_bitfields): Use cl_optimization_stream_in.
@@ -8492,7 +8813,7 @@
* config/pa/pa.md (trap): New insn. Add "trap" to attribute type.
Don't allow trap insn in in_branch_delay, in_nullified_branch_delay
or in_call_delay.
-
+
2014-11-06 Steve Ellcey <sellcey@imgtec.com>
* config.gcc (mips*-mti-linux*): Remove gnu_ld and gas assignments.
@@ -9282,7 +9603,7 @@
* sanopt.c: ...here. New file.
2014-11-04 Jiong Wang <jiong.wang@arm.com>
-2014-11-04 Wilco Dijkstra <wilco.dijkstra@arm.com>
+ Wilco Dijkstra <wilco.dijkstra@arm.com>
PR target/63293
* config/aarch64/aarch64.c (aarch64_expand_epiloue): Add barriers before
@@ -9775,8 +10096,9 @@
2014-10-31 Max Ostapenko <m.ostapenko@partner.samsung.com>
PR ipa/63696
- * ipa-icf.c (sem_function::~sem_function): Change free to delete to avoid
- alloc-dealloc mismatch with new, called in ipa_icf::sem_function::init.
+ * ipa-icf.c (sem_function::~sem_function): Change free to delete
+ to avoid alloc-dealloc mismatch with new, called in
+ ipa_icf::sem_function::init.
2014-10-30 Felix Yang <felix.yang@huawei.com>
@@ -11892,8 +12214,9 @@
(enum asan_check_flags): Remove ASAN_CHECK_START_INSTRUMENTED and
ASAN_CHECK_END_INSTRUMENTED. Change ASAN_CHECK_LAST.
(asan_expand_check_ifn): Remove start_instrumented and end_instrumented.
- * builtins.c (expand_builtin): Include asan.h. Don't expand string/memory
- builtin functions that have interceptors if ASan is enabled.
+ * builtins.c (expand_builtin): Include asan.h. Don't expand
+ string/memory builtin functions that have interceptors if ASan is
+ enabled.
2014-10-28 Richard Biener <rguenther@suse.de>
@@ -13543,7 +13866,6 @@
(lds_fpscr, sts_fpscr): New insns.
(toggle_sz, toggle_pr): Use SImode for FPSCR_REG instead of PSImode.
->>>>>>> .r217525
2014-10-17 Eric Botcazou <ebotcazou@adacore.com>
* ipa-inline-transform.c (master_clone_with_noninline_clones_p): New.
@@ -13673,8 +13995,8 @@
2014-10-17 Tom de Vries <tom@codesourcery.com>
PR rtl-optimization/61605
- * regcprop.c (copyprop_hardreg_forward_1): Add copy_p and noop_p. Don't
- notice stores for noops. Don't regard noops as copies.
+ * regcprop.c (copyprop_hardreg_forward_1): Add copy_p and noop_p.
+ Don't notice stores for noops. Don't regard noops as copies.
2014-10-17 Uros Bizjak <ubizjak@gmail.com>
@@ -14126,8 +14448,8 @@
PR lto/62026
* cgraphclones.c (duplicate_thunk_for_node): Get body to have args
to duplicate.
- * lto-streamer-out.c (lto_output): Handle correctly thunks that was born
- at WPA time.
+ * lto-streamer-out.c (lto_output): Handle correctly thunks that was
+ born at WPA time.
2014-10-15 Vladimir Makarov <vmakarov@redhat.com>
@@ -14258,7 +14580,7 @@
2014-10-14 Jan Hubicka <hubicka@ucw.cz>
- * loop-unroll.c: (decide_unrolling_and_peeling): Rename to
+ * loop-unroll.c (decide_unrolling_and_peeling): Rename to
(decide_unrolling): ... this one.
(peel_loops_completely): Remove.
(decide_peel_simple): Remove.
@@ -14268,13 +14590,12 @@
(peel_loop_completely): Remove.
(unroll_and_peel_loops): Rename to ...
(unroll_loops): ... this one; handle only unrolling.
- * cfgloop.h (lpt_dec): Remove LPT_PEEL_COMPLETELY and
- LPT_PEEL_SIMPLE.
+ * cfgloop.h (lpt_dec): Remove LPT_PEEL_COMPLETELY and LPT_PEEL_SIMPLE.
(UAP_PEEL): Remove.
(unroll_and_peel_loops): Remove.
(unroll_loops): New.
- * passes.def: Replace
- pass_rtl_unroll_and_peel_loops by pass_rtl_unroll_loops.
+ * passes.def: Replace pass_rtl_unroll_and_peel_loops
+ by pass_rtl_unroll_loops.
* loop-init.c (gate_rtl_unroll_and_peel_loops,
rtl_unroll_and_peel_loops): Rename to ...
(gate_rtl_unroll_loops, rtl_unroll_loops): ... these; update.
@@ -14282,7 +14603,8 @@
(pass_rtl_unroll_loops): ... this one.
* tree-pass.h (make_pass_rtl_unroll_and_peel_loops): Remove.
(make_pass_rtl_unroll_loops): New.
- * tree-ssa-loop-ivcanon.c: (estimated_peeled_sequence_size, try_peel_loop): New.
+ * tree-ssa-loop-ivcanon.c (estimated_peeled_sequence_size,
+ try_peel_loop): New.
(canonicalize_loop_induction_variables): Update.
2014-10-14 Max Filippov <jcmvbkbc@gmail.com>
@@ -14318,7 +14640,8 @@
* config/msp430/msp430-modes.def (PSI): Add.
- * config/msp430/msp430-protos.h (msp430_hard_regno_nregs_has_padding): New.
+ * config/msp430/msp430-protos.h (msp430_hard_regno_nregs_has_padding):
+ New.
(msp430_hard_regno_nregs_with_padding): New.
* config/msp430/msp430.c (msp430_scalar_mode_supported_p): New.
(msp430_hard_regno_nregs_has_padding): New.
@@ -14357,8 +14680,7 @@
(int_n_data): New.
* tree.c (int_n_enabled_p): New.
(int_n_trees): New.
- (make_or_reuse_type): Check for all __intN types, not just
- __int128.
+ (make_or_reuse_type): Check for all __intN types, not just __int128.
(build_common_tree_nodes): Likewise. Also fill in integer_typs[]
entries.
* tree.h (int128_integer_type_node): Remove.
@@ -14367,8 +14689,7 @@
(int_n_enabled_p): New.
(int_n_trees): New.
* toplev.c (standard_type_bitsize): New.
- (do_compile): Check which __intN types are enabled for the current
- run.
+ (do_compile): Check which __intN types are enabled for the current run.
* builtin-types.def (BT_INT128): Remove.
(BT_UINT128): Remove.
* machmode.def: Add macro to create __int128 for all targets.
@@ -14379,8 +14700,7 @@
(blank_mode): Likewise.
(INT_N): New.
(make_int_n): New.
- (emit_insn_modes_h): Count __intN entries and define
- NUM_INT_N_ENTS.
+ (emit_insn_modes_h): Count __intN entries and define NUM_INT_N_ENTS.
(emit_mode_int_n): New.
(emit_insn_modes_c): Call it.
* gimple.c (gimple_signed_or_unsigned_type): Check for all __intN
@@ -15826,13 +16146,15 @@
2014-09-26 Jan Hubicka <hubicka@ucw.cz>
PR ipa/60665
- * ipa-devirt.c (possible_polymorphic_call_targets): Silence clang warning.
+ * ipa-devirt.c (possible_polymorphic_call_targets): Silence
+ clang warning.
2014-09-26 Jan Hubicka <hubicka@ucw.cz>
PR ipa/62121
- * ipa-polymorphic-call.c (ipa_polymorphic_call_context::restrict_to_inner_class):
- fix pasto in checking array size.
+ * ipa-polymorphic-call.c
+ (ipa_polymorphic_call_context::restrict_to_inner_class): Fix pasto
+ in checking array size.
2014-09-26 Jan Hubicka <hubicka@ucw.cz>
@@ -15857,9 +16179,12 @@
* cgraph.c (cgraph_node::release_body): New argument keep_arguments
introduced.
* cgraph.h: Likewise.
- * cgraphunit.c (cgraph_node::create_wrapper): Usage of new argument introduced.
- * ipa-utils.h (polymorphic_type_binfo_p): Safe check for binfos created by Java.
- * tree-ssa-alias.c (ao_ref_base_alias_set): Static function transformed to global.
+ * cgraphunit.c (cgraph_node::create_wrapper): Usage of new
+ argument introduced.
+ * ipa-utils.h (polymorphic_type_binfo_p): Safe check for binfos
+ created by Java.
+ * tree-ssa-alias.c (ao_ref_base_alias_set): Static function
+ transformed to global.
* tree-ssa-alias.h: Likewise.
2014-09-26 Jakub Jelinek <jakub@redhat.com>
@@ -15896,9 +16221,9 @@
2014-09-25 Jan Hubicka <hubicka@ucw.cz>
- * ipa-utils.h (subbinfo_with_vtable_at_offset, type_all_derivations_known_p,
- type_known_to_have_no_deriavations_p, types_must_be_same_for_odr,
- types_odr_comparable): Declare.
+ * ipa-utils.h (subbinfo_with_vtable_at_offset,
+ type_all_derivations_known_p, type_known_to_have_no_deriavations_p,
+ types_must_be_same_for_odr, types_odr_comparable): Declare.
(polymorphic_type_binfo_p): Move here from ipa-devirt.c
* ipa-polymorphic-call.c: New file.
(contains_polymorphic_type_p, possible_placement_new,
@@ -15947,8 +16272,8 @@
speculative and non-speculative answers, do just one at a time.
Replace NONSPECULATIVE_TARGETSP parameter with SPECULATIVE flag.
(dump_targets): Break out from ...
- (dump_possible_polymorphic_call_targets): ... here; dump both speculative
- and non-speculative lists.
+ (dump_possible_polymorphic_call_targets): ... here; dump both
+ speculative and non-speculative lists.
(ipa_devirt): Update for new possible_polymorphic_call_targets API.
* ipa-utils.h (possible_polymorphic_call_targets): Update.
@@ -16185,8 +16510,9 @@
(ipa_polymorphic_call_context::set_by_decl): Cleanup comment.
(ipa_polymorphic_call_context::set_by_invariant): Simplify.
(ipa_polymorphic_call_context::ipa_polymorphic_call_context): Simplify.
- (possible_polymorphic_call_targets): Trust context.restrict_to_inner_class
- to suceed on all valid cases; remove confused sanity check.
+ (possible_polymorphic_call_targets): Trust
+ context.restrict_to_inner_class to suceed on all valid cases;
+ remove confused sanity check.
(dump_possible_polymorphic_call_targets): Simplify.
2014-09-24 Aldy Hernandez <aldyh@redhat.com>
@@ -16426,8 +16752,8 @@
2014-09-23 Jiong Wang <jiong.wang@arm.com>
- * shrink-wrap.c (try_shrink_wrapping): Check PIC_OFFSET_TABLE_REGNUM not
- be INVALID_REGNUM.
+ * shrink-wrap.c (try_shrink_wrapping): Check PIC_OFFSET_TABLE_REGNUM
+ not be INVALID_REGNUM.
2014-09-23 Thomas Schwinge <thomas@codesourcery.com>
@@ -16832,9 +17158,12 @@
2014-09-19 Jan Hubicka <hubicka@ucw.cz>
- * ipa-utils.h (ipa_polymorphic_call_context): Turn into class; add ctors.
- (possible_polymorphic_call_targets, dump_possible_polymorphic_call_targets,
- possible_polymorphic_call_target_p, possible_polymorphic_call_target_p): Simplify.
+ * ipa-utils.h (ipa_polymorphic_call_context): Turn into class;
+ add ctors.
+ (possible_polymorphic_call_targets,
+ dump_possible_polymorphic_call_targets,
+ possible_polymorphic_call_target_p,
+ possible_polymorphic_call_target_p): Simplify.
(get_dynamic_type): Remove.
* ipa-devirt.c (ipa_dummy_polymorphic_call_context): Remove.
(clear_speculation): Bring to ipa-deivrt.h
@@ -16875,8 +17204,7 @@
field refuse_visibility_changes.
(symtab_node::get_create): New method.
* fold-const.c (tree_single_nonzero_warnv_p): Use get_create.
- * varasm.c (mark_weak): Verify that visibility change is
- possible.
+ * varasm.c (mark_weak): Verify that visibility change is possible.
2014-09-19 Michael Meissner <meissner@linux.vnet.ibm.com>
@@ -17321,8 +17649,7 @@
Strengthen param "insn" from rtx to rtx_insn *.
* config/nds32/nds32.c (nds32_target_alignment): Likewise for
local "insn".
- * config/pa/pa-protos.h (pa_insn_refs_are_delayed): Likewise for
- param.
+ * config/pa/pa-protos.h (pa_insn_refs_are_delayed): Likewise for param.
* config/pa/pa.c (pa_output_function_epilogue): Likewise for local
"insn". Use method of rtx_sequence for typesafety.
(branch_to_delay_slot_p): Strengthen param "insn" from rtx to
@@ -17448,8 +17775,7 @@
(loop_align_max_skip): Likewise.
(label_align_max_skip): Likewise.
(jump_align_max_skip): Likewise.
- * targhooks.h (default_label_align_after_barrier_max_skip):
- Likewise.
+ * targhooks.h (default_label_align_after_barrier_max_skip): Likewise.
(default_loop_align_max_skip): Likewise.
(default_label_align_max_skip): Likewise.
(default_jump_align_max_skip): Likewise.
@@ -17606,8 +17932,7 @@
* config/ia64/vms.h (IA64_NO_LIBGCC_XFMODE)
(IA64_NO_LIBGCC_TFMODE): Define.
* config/msp430/msp430.h (LIBGCC2_HAS_DF_MODE): Remove.
- * config/pdp11/pdp11.c (TARGET_SCALAR_MODE_SUPPORTED_P): New
- macro.
+ * config/pdp11/pdp11.c (TARGET_SCALAR_MODE_SUPPORTED_P): New macro.
(pdp11_scalar_mode_supported_p): New function.
* config/rl78/rl78.h (LIBGCC2_HAS_DF_MODE): Remove.
* config/rx/rx.h (LIBGCC2_HAS_DF_MODE): Remove.
@@ -18734,7 +19059,8 @@
(arm_init_neon_builtins): Support NEON_COPYSIGNF.
(arm_builtin_vectorized_function): Likewise.
* config/arm/arm_neon_builtins.def: New macro for copysignf.
- * config/arm/neon.md (neon_copysignf<mode>): New pattern for vector copysignf.
+ * config/arm/neon.md (neon_copysignf<mode>): New pattern for
+ vector copysignf.
2014-09-09 Richard Sandiford <richard.sandiford@arm.com>
@@ -19771,28 +20097,28 @@
* hash-map.h (hash_map::hash_entry::ggc_mx): Likewise.
(hash_map::hash_entry::pch_nx): Likewise.
(hash_map::hash_entry::pch_nx_helper): Likewise.
-(hash_map::hash_map): Adjust.
-(hash_map::create_ggc): New function.
-(gt_ggc_mx): Likewise.
-(gt_pch_nx): Likewise.
+ (hash_map::hash_map): Adjust.
+ (hash_map::create_ggc): New function.
+ (gt_ggc_mx): Likewise.
+ (gt_pch_nx): Likewise.
* hash-set.h (default_hashset_traits::ggc_mx): Likewise.
-(default_hashset_traits::pch_nx): Likewise.
-(hash_set::hash_entry::ggc_mx): Likewise.
-(hash_set::hash_entry::pch_nx): Likewise.
-(hash_set::hash_entry::pch_nx_helper): Likewise.
-(hash_set::hash_set): Adjust.
-(hash_set::create_ggc): New function.
-(hash_set::elements): Likewise.
-(gt_ggc_mx): Likewise.
-(gt_pch_nx): Likewise.
+ (default_hashset_traits::pch_nx): Likewise.
+ (hash_set::hash_entry::ggc_mx): Likewise.
+ (hash_set::hash_entry::pch_nx): Likewise.
+ (hash_set::hash_entry::pch_nx_helper): Likewise.
+ (hash_set::hash_set): Adjust.
+ (hash_set::create_ggc): New function.
+ (hash_set::elements): Likewise.
+ (gt_ggc_mx): Likewise.
+ (gt_pch_nx): Likewise.
* hash-table.h (hash_table::hash_table): Adjust.
-(hash_table::m_ggc): New member.
+ (hash_table::m_ggc): New member.
(hash_table::~hash_table): Adjust.
(hash_table::expand): Likewise.
(hash_table::empty): Likewise.
-(gt_ggc_mx): New function.
+ (gt_ggc_mx): New function.
(hashtab_entry_note_pointers): Likewise.
-(gt_pch_nx): Likewise.
+ (gt_pch_nx): Likewise.
2014-09-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
@@ -21267,7 +21593,8 @@
(define_insn "vec_interleave_lowv4si<mask_name>"): Ditto.
(define_insn "vec_interleave_highv16qi<mask_name>"): New.
(define_insn "avx512bw_interleave_highv32hi<mask_name>"): Ditto.
- (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"): Ditto.
+ (define_insn "<mask_codefor>avx512bw_interleave_lowv32hi<mask_name>"):
+ Ditto.
2014-08-28 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
@@ -24466,13 +24793,18 @@
* cgraph.h (symtab_node):
(bool needed_p (void)): created from decide_is_symbol_needed
(bool referred_to_p (void)): created from referred_to_p
- (static cgraph_node *get_for_asmname (tree asmname)): created from symtab_node_for_asm
+ (static cgraph_node *get_for_asmname (tree asmname)):
+ created from symtab_node_for_asm
* cgraph.h (cgraph_node):
- (void assemble_thunks_and_aliases (void)): created from assemble_thunks_and_aliases
+ (void assemble_thunks_and_aliases (void)):
+ created from assemble_thunks_and_aliases
(void expand (void)): created from expand_function
- (static void finalize_function (tree, bool)): created from cgraph_finalize_function
- (static cgraph_local_info *local_info (tree decl)): created from cgraph_local_info
- (static cgraph_global_info *global_info (tree)): created from cgraph_global_info
+ (static void finalize_function (tree, bool)):
+ created from cgraph_finalize_function
+ (static cgraph_local_info *local_info (tree decl)):
+ created from cgraph_local_info
+ (static cgraph_global_info *global_info (tree)):
+ created from cgraph_global_info
(static cgraph_rtl_info *rtl_info (tree)): created from cgraph_rtl_info
* cgraph.h (varpool_node):
(static void add (tree decl): created from varpool_add_new_variable
@@ -24481,21 +24813,30 @@
(void remove_caller (void)): created from cgraph_edge_remove_caller
(void remove_callee (void)): created from cgraph_edge_remove_callee
(void set_call_stmt (gimple new_stmt, bool update_speculative = true)):
- created from cgraph_set_call_stmt
- (void redirect_callee (cgraph_node *n)): created from cgraph_redirect_edge_callee
- (cgraph_edge *make_direct (cgraph_node *callee)): created from cgraph_make_edge_direct
+ created from cgraph_set_call_stmt
+ (void redirect_callee (cgraph_node *n)): created from
+ cgraph_redirect_edge_callee
+ (cgraph_edge *make_direct (cgraph_node *callee)): created from
+ cgraph_make_edge_direct
(cgraph_edge *make_speculative (cgraph_node *n2, gcov_type direct_count,
- gimple redirect_call_stmt_to_callee (void)): created from cgraph_turn_edge_to_speculative
- (void speculative_call_info (cgraph_edge *&direct, cgraph_edge *&indirect, ipa_ref *&reference)):
- created from cgraph_speculative_call_info
- (cgraph_edge * clone (cgraph_node *n, gimple call_stmt, unsigned stmt_uid, gcov_type count_scale,
- int freq_scale, bool update_original)): created from cgraph_clone_edge
- (cgraph_edge *resolve_speculation (tree callee_decl)): created from cgraph_resolve_speculation
- (bool cannot_lead_to_return_p (void)): created from cannot_lead_to_return_p
+ gimple redirect_call_stmt_to_callee (void)): created from
+ cgraph_turn_edge_to_speculative
+ (void speculative_call_info (cgraph_edge *&direct,
+ cgraph_edge *&indirect, ipa_ref *&reference)): created from
+ cgraph_speculative_call_info
+ (cgraph_edge * clone (cgraph_node *n, gimple call_stmt,
+ unsigned stmt_uid, gcov_type count_scale,
+ int freq_scale, bool update_original)): created from cgraph_clone_edge
+ (cgraph_edge *resolve_speculation (tree callee_decl)):
+ created from cgraph_resolve_speculation
+ (bool cannot_lead_to_return_p (void)): created from
+ cannot_lead_to_return_p
(bool recursive_p (void)): created from cgraph_edge_recursive_p
(bool maybe_hot_p (void)): created from cgraph_maybe_hot_edge_p
- (static unsigned int rebuild_edges (void)): created from rebuild_cgraph_edges
- (static void rebuild_references (void)): created from cgraph_rebuild_references
+ (static unsigned int rebuild_edges (void)): created from
+ rebuild_cgraph_edges
+ (static void rebuild_references (void)): created from
+ cgraph_rebuild_references
* cgraph.h (symbol_table):
(create_reference): renamed from add_reference
(maybe_create_reference): renamed from maybe_add_reference
@@ -24511,7 +24852,8 @@
(varpool_node *first_variable (void)):new function
(varpool_node *next_variable (varpool_node *node)):new function
(varpool_node *first_static_initializer (void)):new function
- (varpool_node *next_static_initializer (varpool_node *node)):new function
+ (varpool_node *next_static_initializer (varpool_node *node)):new
+ function
(varpool_node *first_defined_variable (void)):new function
(varpool_node *next_defined_variable (varpool_node *node)):new function
(cgraph_node *first_defined_function (void)):new function
@@ -24519,82 +24861,91 @@
(cgraph_node *first_function (void)):new function
(cgraph_node *next_function (cgraph_node *node)):new function
(cgraph_node *first_function_with_gimple_body (void)):new function
- (asm_node *finalize_toplevel_asm (tree asm_str)): created from add_asm_node
+ (asm_node *finalize_toplevel_asm (tree asm_str)): created from
+ add_asm_node
(bool remove_unreachable_nodes (bool before_inlining_p, FILE *file)):
- created from symtab_remove_unreachable_nodes
- (void remove_unreferenced_decls (void)): created from varpool_remove_unreferenced_decls
- (void process_new_functions (void)): created from cgraph_process_new_functions
- (void process_same_body_aliases (void)): created from cgraph_process_same_body_aliases
- (bool output_variables (void)): created from varpool_node::output_variables
+ created from symtab_remove_unreachable_nodes
+ (void remove_unreferenced_decls (void)): created from
+ varpool_remove_unreferenced_decls
+ (void process_new_functions (void)): created from
+ cgraph_process_new_functions
+ (void process_same_body_aliases (void)): created from
+ cgraph_process_same_body_aliases
+ (bool output_variables (void)): created from
+ varpool_node::output_variables
(void output_asm_statements (void)): created from output_asm_statements
- (void finalize_compilation_unit (void)): created from finalize_compilation_unit
+ (void finalize_compilation_unit (void)): created from
+ finalize_compilation_unit
(void compile (void)): created from compile
(void output_weakrefs (void)): created from output_weakrefs
- (cgraph_node *create_empty (void)): created from cgraph_node::create_empty
- (cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee, gimple call_stmt,
- gcov_type count, int freq, bool indir_unknown_callee)): created from cgraph_node::create_edge
+ (cgraph_node *create_empty (void)): created from
+ cgraph_node::create_empty
+ (cgraph_edge *create_edge (cgraph_node *caller, cgraph_node *callee,
+ gimple call_stmt, gcov_type count, int freq,
+ bool indir_unknown_callee)): created from cgraph_node::create_edge
(void free_edge (cgraph_edge *e)): created from cgraph_free_edge
(cgraph_node *next_function_with_gimple_body (cgraph_node *node)):
- created from cgraph_next_function_with_gimple_body
+ created from cgraph_next_function_with_gimple_body
(void remove_edge_removal_hook (cgraph_edge_hook_list *)):
- created from cgraph_remove_edge_removal_hook
- (cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook, void *)):
- created from cgraph_add_node_removal_hook
+ created from cgraph_remove_edge_removal_hook
+ (cgraph_node_hook_list *add_cgraph_removal_hook (cgraph_node_hook,
+ void *)): created from cgraph_add_node_removal_hook
(void remove_cgraph_removal_hook (cgraph_node_hook_list *)):
- created from cgraph_remove_node_removal_hook
- (varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook, void *)):
- created from varpool_add_node_removal_hook
+ created from cgraph_remove_node_removal_hook
+ (varpool_node_hook_list *add_varpool_removal_hook (varpool_node_hook,
+ void *)): created from varpool_add_node_removal_hook
(void remove_varpool_removal_hook (varpool_node_hook_list *)):
- created from varpool_remove_node_removal_hook
- (cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook, void *)):
- created from cgraph_add_function_insertion_hook
+ created from varpool_remove_node_removal_hook
+ (cgraph_node_hook_list *add_cgraph_insertion_hook (cgraph_node_hook,
+ void *)): created from cgraph_add_function_insertion_hook
(void remove_cgraph_insertion_hook (cgraph_node_hook_list *)):
- created from cgraph_remove_function_insertion_hook
- (varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook, void *)):
- created from varpool_add_variable_insertion_hook
+ created from cgraph_remove_function_insertion_hook
+ (varpool_node_hook_list *add_varpool_insertion_hook (varpool_node_hook,
+ void *)): created from varpool_add_variable_insertion_hook
(void remove_varpool_insertion_hook (varpool_node_hook_list *)):
created from varpool_remove_variable_insertion_hook
- (cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook, void *)):
- created from cgraph_add_edge_duplication_hook
+ (cgraph_2edge_hook_list *add_edge_duplication_hook (cgraph_2edge_hook,
+ void *)): created from cgraph_add_edge_duplication_hook
(void remove_edge_duplication_hook (cgraph_2edge_hook_list *)):
- created from cgraph_remove_edge_duplication_hook
- (cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook, void *)):
- created from cgraph_add_node_duplication_hook
+ created from cgraph_remove_edge_duplication_hook
+ (cgraph_2node_hook_list *add_cgraph_duplication_hook (cgraph_2node_hook,
+ void *)): created from cgraph_add_node_duplication_hook
(void remove_cgraph_duplication_hook (cgraph_2node_hook_list *)):
- created from cgraph_remove_node_duplication_hook
+ created from cgraph_remove_node_duplication_hook
(void call_edge_removal_hooks (cgraph_edge *e)):
- created from cgraph_call_edge_removal_hooks
+ created from cgraph_call_edge_removal_hooks
(void call_cgraph_insertion_hooks (cgraph_node *node)):
- created from call_function_insertion_hooks
+ created from call_function_insertion_hooks
(void call_cgraph_removal_hooks (cgraph_node *node)):
- created from cgraph_call_node_removal_hooks
- (void call_cgraph_duplication_hooks (cgraph_node *node, cgraph_node *node2)):
- created from cgraph_node::call_duplication_hooks
+ created from cgraph_call_node_removal_hooks
+ (void call_cgraph_duplication_hooks (cgraph_node *node,
+ cgraph_node *node2)): created from cgraph_node::call_duplication_hooks
(void call_edge_duplication_hooks (cgraph_edge *cs1, cgraph_edge *cs2)):
- created from cgraph_call_edge_duplication_hooks
+ created from cgraph_call_edge_duplication_hooks
(void call_varpool_removal_hooks (varpool_node *node)):
- created from varpool_call_node_removal_hooks
+ created from varpool_call_node_removal_hooks
(void call_varpool_insertion_hooks (varpool_node *node)):
- created from varpool_call_variable_insertion_hooks
- (void insert_to_assembler_name_hash (symtab_node *node, bool with_clones)):
- created from insert_to_assembler_name_hash
- (void unlink_from_assembler_name_hash (symtab_node *node, bool with_clones)):
- created from unlink_from_assembler_name_hash
+ created from varpool_call_variable_insertion_hooks
+ (void insert_to_assembler_name_hash (symtab_node *node,
+ bool with_clones)): created from insert_to_assembler_name_hash
+ (void unlink_from_assembler_name_hash (symtab_node *node,
+ bool with_clones)): created from unlink_from_assembler_name_hash
(void symtab_prevail_in_asm_name_hash (symtab_node *node)):
- created from symtab_prevail_in_asm_name_hash
+ created from symtab_prevail_in_asm_name_hash
(void symtab_initialize_asm_name_hash (void)):
- created from symtab_initialize_asm_name_hash
+ created from symtab_initialize_asm_name_hash
(void change_decl_assembler_name (tree decl, tree name)):
- created from change_decl_assembler_name
- (void materialize_all_clones (void)): created from cgraph_materialize_all_clones
+ created from change_decl_assembler_name
+ (void materialize_all_clones (void)): created from
+ cgraph_materialize_all_clones
(static hashval_t decl_assembler_name_hash (const_tree asmname)):
- created from decl_assembler_name_hash
+ created from decl_assembler_name_hash
(static bool decl_assembler_name_equal (tree decl, const_tree asmname)):
- created from decl_assembler_name_equal
+ created from decl_assembler_name_equal
(static hashval_t hash_node_by_assembler_name (const void *p)):
- created from hash_node_by_assembler_name
+ created from hash_node_by_assembler_name
(static int eq_assembler_name (const void *p1, const void *p2)):
- created from eq_assembler_name
+ created from eq_assembler_name
2014-08-25 Marek Polacek <polacek@redhat.com>
@@ -27679,8 +28030,8 @@
2014-08-18 Jan Hubicka <hubicka@ucw.cz>
- * ipa-visibility.c (update_visibility_by_resolution_info): Do no turn UNDEF
- comdats as extern.
+ * ipa-visibility.c (update_visibility_by_resolution_info): Do no
+ turn UNDEF comdats as extern.
2014-08-18 Jan Hubicka <hubicka@ucw.cz>
@@ -27810,15 +28161,16 @@
Kirill Yukhin <kirill.yukhin@intel.com>
Michael Zolotukhin <michael.v.zolotukhin@intel.com>
- * config/i386/i386.c: Rename ufloatv8siv8df_mask to ufloatv8siv8df2_mask.
+ * config/i386/i386.c: Rename ufloatv8siv8df_mask to
+ ufloatv8siv8df2_mask.
* config/i386/i386.md
(define_code_iterator any_float): New.
(define_code_attr floatsuffix): New.
* config/i386/sse.md
(define_mode_iterator VF1_128_256VL): New.
(define_mode_iterator VF2_512_256VL): New.
- (define_insn "float<si2dfmodelower><mode>2<mask_name>"): Remove unnecessary
- TARGET check.
+ (define_insn "float<si2dfmodelower><mode>2<mask_name>"): Remove
+ unnecessary TARGET check.
(define_insn "ufloatv8siv8df<mask_name>"): Delete.
(define_insn "<floatsuffix>float<sseintvecmodelower><mode>2<mask_name><round_name>"):
New.
@@ -29372,10 +29724,10 @@
* config/i386/i386.c (ix86_macro_fusion_pair_p): Reject 2nd
arguments that are not conditional jumps.
-2014-08-04 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
+2014-08-04 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com>
- * config/i386/driver-i386.c (host_detect_local_cpu): Handle AMD's extended
- family information. Handle BTVER2 cpu with cpuid family value.
+ * config/i386/driver-i386.c (host_detect_local_cpu): Handle AMD's
+ extended family information. Handle BTVER2 cpu with cpuid family value.
2014-08-04 Tom de Vries <tom@codesourcery.com>
@@ -29762,8 +30114,8 @@
2014-07-29 Jan Hubicka <hubicka@ucw.cz>
- * ipa-devirt.c (polymorphic_call_target_d): Rename nonconstruction_targets
- to speculative_targets
+ * ipa-devirt.c (polymorphic_call_target_d): Rename
+ nonconstruction_targets to speculative_targets
(get_class_context): Fix handling of contextes without outer type;
avoid matching non-polymorphic types in LTO.
(possible_polymorphic_call_targets): Trun nonconstruction_targetsp
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 29f652f..0e56917 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20141215
+20141219
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c749b54..890d436 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * gcc-interface/misc.c (gnat_get_array_descr_info): New. Use it for
+ the get_array_descr_info lang-hook. Use it to tune the DWARF output
+ for array types.
+
2014-11-24 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/Makefile.in (Cygwin/Mingw): Fix previous change.
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index fe28e96..2ab3f92 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -49,6 +49,7 @@
#include "hard-reg-set.h"
#include "input.h"
#include "function.h" /* For pass_by_reference. */
+#include "dwarf2out.h"
#include "ada.h"
#include "adadecode.h"
@@ -634,6 +635,65 @@ gnat_type_max_size (const_tree gnu_type)
return max_unitsize;
}
+/* Provide information in INFO for debug output about the TYPE array type.
+ Return whether TYPE is handled. */
+
+static bool
+gnat_get_array_descr_info (const_tree type, struct array_descr_info *info)
+{
+ bool convention_fortran_p;
+ tree index_type;
+
+ const_tree dimen = NULL_TREE;
+ const_tree last_dimen = NULL_TREE;
+ int i;
+
+ if (TREE_CODE (type) != ARRAY_TYPE
+ || !TYPE_DOMAIN (type)
+ || !TYPE_INDEX_TYPE (TYPE_DOMAIN (type)))
+ return false;
+
+ /* Count how many dimentions this array has. */
+ for (i = 0, dimen = type; ; ++i, dimen = TREE_TYPE (dimen))
+ if (i > 0
+ && (TREE_CODE (dimen) != ARRAY_TYPE
+ || !TYPE_MULTI_ARRAY_P (dimen)))
+ break;
+ info->ndimensions = i;
+ convention_fortran_p = TYPE_CONVENTION_FORTRAN_P (type);
+
+ /* TODO??? For row major ordering, we probably want to emit nothing and
+ instead specify it as the default in Dw_TAG_compile_unit. */
+ info->ordering = (convention_fortran_p
+ ? array_descr_ordering_column_major
+ : array_descr_ordering_row_major);
+ info->base_decl = NULL_TREE;
+ info->data_location = NULL_TREE;
+ info->allocated = NULL_TREE;
+ info->associated = NULL_TREE;
+
+ for (i = (convention_fortran_p ? info->ndimensions - 1 : 0),
+ dimen = type;
+
+ 0 <= i && i < info->ndimensions;
+
+ i += (convention_fortran_p ? -1 : 1),
+ dimen = TREE_TYPE (dimen))
+ {
+ /* We are interested in the stored bounds for the debug info. */
+ index_type = TYPE_INDEX_TYPE (TYPE_DOMAIN (dimen));
+
+ info->dimen[i].bounds_type = index_type;
+ info->dimen[i].lower_bound = TYPE_MIN_VALUE (index_type);
+ info->dimen[i].upper_bound = TYPE_MAX_VALUE (index_type);
+ last_dimen = dimen;
+ }
+
+ info->element_type = TREE_TYPE (last_dimen);
+
+ return true;
+}
+
/* GNU_TYPE is a subtype of an integral type. Set LOWVAL to the low bound
and HIGHVAL to the high bound, respectively. */
@@ -924,6 +984,8 @@ gnat_init_ts (void)
#define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
#define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p
+#undef LANG_HOOKS_GET_ARRAY_DESCR_INFO
+#define LANG_HOOKS_GET_ARRAY_DESCR_INFO gnat_get_array_descr_info
#undef LANG_HOOKS_GET_SUBRANGE_BOUNDS
#define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds
#undef LANG_HOOKS_DESCRIPTIVE_TYPE
diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index 7055c4a..085bbd6 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -1521,7 +1521,12 @@ afdo_annotate_cfg (const stmt_set &promoted_stmts)
profile_status_for_fn (cfun) = PROFILE_READ;
}
if (flag_value_profile_transformations)
- gimple_value_profile_transformations ();
+ {
+ gimple_value_profile_transformations ();
+ free_dominance_info (CDI_DOMINATORS);
+ free_dominance_info (CDI_POST_DOMINATORS);
+ update_ssa (TODO_update_ssa);
+ }
}
/* Wrapper function to invoke early inliner. */
@@ -1599,7 +1604,6 @@ auto_profile (void)
early_inline ();
autofdo::afdo_annotate_cfg (promoted_stmts);
compute_function_frequency ();
- update_ssa (TODO_update_ssa);
/* Local pure-const may imply need to fixup the cfg. */
if (execute_fixup_cfg () & TODO_cleanup_cfg)
@@ -1608,6 +1612,7 @@ auto_profile (void)
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
cgraph_edge::rebuild_edges ();
+ compute_inline_parameters (cgraph_node::get (current_function_decl), true);
pop_cfun ();
}
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index cef3aa1..ad9b8bc 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/64289
+ * c-convert.c: Include ubsan.h.
+ (convert): For real -> integral casts and
+ -fsanitize=float-cast-overflow don't call convert_to_integer, but
+ instead instrument the float cast directly.
+
2014-11-29 Jakub Jelinek <jakub@redhat.com>
* c-typeck.c (convert_lvalue_to_rvalue, build_atomic_assign,
diff --git a/gcc/c/c-convert.c b/gcc/c/c-convert.c
index 95be453..ba565da 100644
--- a/gcc/c/c-convert.c
+++ b/gcc/c/c-convert.c
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "c-tree.h"
#include "langhooks.h"
#include "target.h"
+#include "ubsan.h"
/* Change of width--truncation and extension of integers or reals--
is represented with NOP_EXPR. Proper functioning of many things
@@ -109,6 +110,20 @@ convert (tree type, tree expr)
case INTEGER_TYPE:
case ENUMERAL_TYPE:
+ if (flag_sanitize & SANITIZE_FLOAT_CAST
+ && TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE
+ && COMPLETE_TYPE_P (type)
+ && current_function_decl != NULL_TREE
+ && !lookup_attribute ("no_sanitize_undefined",
+ DECL_ATTRIBUTES (current_function_decl)))
+ {
+ expr = c_save_expr (expr);
+ tree check = ubsan_instrument_float_cast (loc, type, expr);
+ expr = fold_build1 (FIX_TRUNC_EXPR, type, expr);
+ if (check == NULL)
+ return expr;
+ return fold_build2 (COMPOUND_EXPR, TREE_TYPE (expr), check, expr);
+ }
ret = convert_to_integer (type, e);
goto maybe_fold;
diff --git a/gcc/config/aarch64/aarch64-protos.h b/gcc/config/aarch64/aarch64-protos.h
index 234efcb..f22573b 100644
--- a/gcc/config/aarch64/aarch64-protos.h
+++ b/gcc/config/aarch64/aarch64-protos.h
@@ -170,8 +170,10 @@ struct tune_params
const struct cpu_vector_cost *const vec_costs;
const int memmov_cost;
const int issue_rate;
- const int align;
const unsigned int fuseable_ops;
+ const int function_align;
+ const int jump_align;
+ const int loop_align;
const int int_reassoc_width;
const int fp_reassoc_width;
const int vec_reassoc_width;
diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index d4256a5..52a1c3b 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -726,25 +726,16 @@
(match_operand:SI 2 "aarch64_shift_imm64_di" "")]
"TARGET_SIMD"
{
+ /* An arithmetic shift right by 64 fills the result with copies of the sign
+ bit, just like asr by 63 - however the standard pattern does not handle
+ a shift by 64. */
if (INTVAL (operands[2]) == 64)
- emit_insn (gen_aarch64_sshr_simddi (operands[0], operands[1]));
- else
- emit_insn (gen_ashrdi3 (operands[0], operands[1], operands[2]));
+ operands[2] = GEN_INT (63);
+ emit_insn (gen_ashrdi3 (operands[0], operands[1], operands[2]));
DONE;
}
)
-;; SIMD shift by 64. This pattern is a special case as standard pattern does
-;; not handle NEON shifts by 64.
-(define_insn "aarch64_sshr_simddi"
- [(set (match_operand:DI 0 "register_operand" "=w")
- (unspec:DI
- [(match_operand:DI 1 "register_operand" "w")] UNSPEC_SSHR64))]
- "TARGET_SIMD"
- "sshr\t%d0, %d1, 64"
- [(set_attr "type" "neon_shift_imm")]
-)
-
(define_expand "vlshr<mode>3"
[(match_operand:VDQ_BHSI 0 "register_operand" "")
(match_operand:VDQ_BHSI 1 "register_operand" "")
@@ -765,24 +756,13 @@
"TARGET_SIMD"
{
if (INTVAL (operands[2]) == 64)
- emit_insn (gen_aarch64_ushr_simddi (operands[0], operands[1]));
+ emit_move_insn (operands[0], const0_rtx);
else
emit_insn (gen_lshrdi3 (operands[0], operands[1], operands[2]));
DONE;
}
)
-;; SIMD shift by 64. This pattern is a special case as standard pattern does
-;; not handle NEON shifts by 64.
-(define_insn "aarch64_ushr_simddi"
- [(set (match_operand:DI 0 "register_operand" "=w")
- (unspec:DI
- [(match_operand:DI 1 "register_operand" "w")] UNSPEC_USHR64))]
- "TARGET_SIMD"
- "ushr\t%d0, %d1, 64"
- [(set_attr "type" "neon_shift_imm")]
-)
-
(define_expand "vec_set<mode>"
[(match_operand:VDQ_BHSI 0 "register_operand")
(match_operand:<VEL> 1 "register_operand")
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 226a808..2281ce9 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -323,8 +323,10 @@ static const struct tune_params generic_tunings =
&generic_vector_cost,
NAMED_PARAM (memmov_cost, 4),
NAMED_PARAM (issue_rate, 2),
- NAMED_PARAM (align, 4),
NAMED_PARAM (fuseable_ops, AARCH64_FUSE_NOTHING),
+ 8, /* function_align. */
+ 8, /* jump_align. */
+ 4, /* loop_align. */
2, /* int_reassoc_width. */
4, /* fp_reassoc_width. */
1 /* vec_reassoc_width. */
@@ -338,9 +340,11 @@ static const struct tune_params cortexa53_tunings =
&generic_vector_cost,
NAMED_PARAM (memmov_cost, 4),
NAMED_PARAM (issue_rate, 2),
- NAMED_PARAM (align, 8),
NAMED_PARAM (fuseable_ops, (AARCH64_FUSE_MOV_MOVK | AARCH64_FUSE_ADRP_ADD
| AARCH64_FUSE_MOVK_MOVK | AARCH64_FUSE_ADRP_LDR)),
+ 8, /* function_align. */
+ 8, /* jump_align. */
+ 4, /* loop_align. */
2, /* int_reassoc_width. */
4, /* fp_reassoc_width. */
1 /* vec_reassoc_width. */
@@ -354,8 +358,10 @@ static const struct tune_params cortexa57_tunings =
&cortexa57_vector_cost,
NAMED_PARAM (memmov_cost, 4),
NAMED_PARAM (issue_rate, 3),
- NAMED_PARAM (align, 8),
NAMED_PARAM (fuseable_ops, (AARCH64_FUSE_MOV_MOVK | AARCH64_FUSE_ADRP_ADD | AARCH64_FUSE_MOVK_MOVK)),
+ 16, /* function_align. */
+ 8, /* jump_align. */
+ 4, /* loop_align. */
2, /* int_reassoc_width. */
4, /* fp_reassoc_width. */
1 /* vec_reassoc_width. */
@@ -369,8 +375,10 @@ static const struct tune_params thunderx_tunings =
&generic_vector_cost,
NAMED_PARAM (memmov_cost, 6),
NAMED_PARAM (issue_rate, 2),
- NAMED_PARAM (align, 8),
NAMED_PARAM (fuseable_ops, AARCH64_FUSE_CMP_BRANCH),
+ 8, /* function_align. */
+ 8, /* jump_align. */
+ 8, /* loop_align. */
2, /* int_reassoc_width. */
4, /* fp_reassoc_width. */
1 /* vec_reassoc_width. */
@@ -464,6 +472,12 @@ static const char * const aarch64_condition_codes[] =
"hi", "ls", "ge", "lt", "gt", "le", "al", "nv"
};
+static unsigned int
+aarch64_min_divisions_for_recip_mul (enum machine_mode mode ATTRIBUTE_UNUSED)
+{
+ return 2;
+}
+
static int
aarch64_reassociation_width (unsigned opc ATTRIBUTE_UNUSED,
enum machine_mode mode)
@@ -6771,11 +6785,11 @@ aarch64_override_options (void)
if (!optimize_size)
{
if (align_loops <= 0)
- align_loops = aarch64_tune_params->align;
+ align_loops = aarch64_tune_params->loop_align;
if (align_jumps <= 0)
- align_jumps = aarch64_tune_params->align;
+ align_jumps = aarch64_tune_params->jump_align;
if (align_functions <= 0)
- align_functions = aarch64_tune_params->align;
+ align_functions = aarch64_tune_params->function_align;
}
aarch64_override_options_after_change ();
@@ -11041,6 +11055,9 @@ aarch64_gen_adjusted_ldpstp (rtx *operands, bool load,
#undef TARGET_MEMORY_MOVE_COST
#define TARGET_MEMORY_MOVE_COST aarch64_memory_move_cost
+#undef TARGET_MIN_DIVISIONS_FOR_RECIP_MUL
+#define TARGET_MIN_DIVISIONS_FOR_RECIP_MUL aarch64_min_divisions_for_recip_mul
+
#undef TARGET_MUST_PASS_IN_STACK
#define TARGET_MUST_PASS_IN_STACK must_pass_in_stack_var_size
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 97d7009..12532c1 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -107,7 +107,6 @@
UNSPEC_SISD_SSHL
UNSPEC_SISD_USHL
UNSPEC_SSHL_2S
- UNSPEC_SSHR64
UNSPEC_ST1
UNSPEC_ST2
UNSPEC_ST3
@@ -118,7 +117,6 @@
UNSPEC_TLS
UNSPEC_TLSDESC
UNSPEC_USHL_2S
- UNSPEC_USHR64
UNSPEC_VSTRUCTDUMMY
UNSPEC_SP_SET
UNSPEC_SP_TEST
@@ -188,14 +186,6 @@
;; Processor types.
(include "aarch64-tune.md")
-;; True if the generic scheduling description should be used.
-
-(define_attr "generic_sched" "yes,no"
- (const (if_then_else
- (eq_attr "tune" "cortexa53,cortexa15,thunderx")
- (const_string "no")
- (const_string "yes"))))
-
;; Scheduling
(include "../arm/cortex-a53.md")
(include "../arm/cortex-a15.md")
diff --git a/gcc/config/i386/gnu-user-common.h b/gcc/config/i386/gnu-user-common.h
index 0e61996..4629911 100644
--- a/gcc/config/i386/gnu-user-common.h
+++ b/gcc/config/i386/gnu-user-common.h
@@ -64,3 +64,9 @@ along with GCC; see the file COPYING3. If not see
/* Static stack checking is supported by means of probes. */
#define STACK_CHECK_STATIC_BUILTIN 1
+
+/* We only build the -fsplit-stack support in libgcc if the
+ assembler has full support for the CFI directives. */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+#define TARGET_CAN_SPLIT_STACK
+#endif
diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
index e1163c9..118aa49 100644
--- a/gcc/config/i386/gnu-user.h
+++ b/gcc/config/i386/gnu-user.h
@@ -154,11 +154,6 @@ along with GCC; see the file COPYING3. If not see
/* i386 glibc provides __stack_chk_guard in %gs:0x14. */
#define TARGET_THREAD_SSP_OFFSET 0x14
-/* We only build the -fsplit-stack support in libgcc if the
- assembler has full support for the CFI directives. */
-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
-#define TARGET_CAN_SPLIT_STACK
-#endif
/* We steal the last transactional memory word. */
#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
#endif
diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h
index 1c72b41..75d5552 100644
--- a/gcc/config/i386/gnu-user64.h
+++ b/gcc/config/i386/gnu-user64.h
@@ -85,11 +85,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define TARGET_THREAD_SSP_OFFSET \
(TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14)
-/* We only build the -fsplit-stack support in libgcc if the
- assembler has full support for the CFI directives. */
-#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
-#define TARGET_CAN_SPLIT_STACK
-#endif
/* We steal the last transactional memory word. */
#define TARGET_THREAD_SPLIT_STACK_OFFSET \
(TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
diff --git a/gcc/config/i386/i386-opts.h b/gcc/config/i386/i386-opts.h
index 47a34db..455df43 100644
--- a/gcc/config/i386/i386-opts.h
+++ b/gcc/config/i386/i386-opts.h
@@ -77,6 +77,12 @@ enum pmode {
PMODE_DI /* Pmode == DImode. */
};
+enum ix86_align_data {
+ ix86_align_data_type_compat,
+ ix86_align_data_type_abi,
+ ix86_align_data_type_cacheline
+};
+
enum asm_dialect {
ASM_ATT,
ASM_INTEL
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index bfb135e..122a350 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -12831,12 +12831,14 @@ ix86_address_cost (rtx x, machine_mode, addr_space_t, bool)
Therefore only "pic_offset_table_rtx" could be hoisted out, which is not
profitable for x86. */
if (parts.base
- && (!pic_offset_table_rtx
- || REGNO (pic_offset_table_rtx) != REGNO(parts.base))
+ && (current_pass->type == GIMPLE_PASS
+ || (!pic_offset_table_rtx
+ || REGNO (pic_offset_table_rtx) != REGNO(parts.base)))
&& (!REG_P (parts.base) || REGNO (parts.base) >= FIRST_PSEUDO_REGISTER)
&& parts.index
- && (!pic_offset_table_rtx
- || REGNO (pic_offset_table_rtx) != REGNO(parts.index))
+ && (current_pass->type == GIMPLE_PASS
+ || (!pic_offset_table_rtx
+ || REGNO (pic_offset_table_rtx) != REGNO(parts.index)))
&& (!REG_P (parts.index) || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER)
&& parts.base != parts.index)
cost++;
@@ -25459,7 +25461,12 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx callarg1,
}
}
- if (TARGET_64BIT && INTVAL (callarg2) >= 0)
+ /* Skip setting up RAX register for -mskip-rax-setup when there are no
+ parameters passed in vector registers. */
+ if (TARGET_64BIT
+ && (INTVAL (callarg2) > 0
+ || (INTVAL (callarg2) == 0
+ && (TARGET_SSE || !flag_skip_rax_setup))))
{
rtx al = gen_rtx_REG (QImode, AX_REG);
emit_move_insn (al, callarg2);
@@ -27189,8 +27196,7 @@ ix86_data_alignment (tree type, int align, bool opt)
those compilers, ensure we don't decrease alignment from what we
used to assume. */
- int max_align_compat
- = optimize_size ? BITS_PER_WORD : MIN (256, MAX_OFILE_ALIGNMENT);
+ int max_align_compat = MIN (256, MAX_OFILE_ALIGNMENT);
/* A data structure, equal or greater than the size of a cache line
(64 bytes in the Pentium 4 and other recent Intel processors, including
@@ -27203,6 +27209,13 @@ ix86_data_alignment (tree type, int align, bool opt)
if (max_align < BITS_PER_WORD)
max_align = BITS_PER_WORD;
+ switch (ix86_align_data_type)
+ {
+ case ix86_align_data_type_abi: opt = false; break;
+ case ix86_align_data_type_compat: max_align = BITS_PER_WORD; break;
+ case ix86_align_data_type_cacheline: break;
+ }
+
if (opt
&& AGGREGATE_TYPE_P (type)
&& TYPE_SIZE (type)
diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt
index b1c6319..6dc4da2 100644
--- a/gcc/config/i386/i386.opt
+++ b/gcc/config/i386/i386.opt
@@ -221,6 +221,23 @@ malign-stringops
Target RejectNegative Report InverseMask(NO_ALIGN_STRINGOPS, ALIGN_STRINGOPS) Save
Align destination of the string operations
+malign-data=
+Target RejectNegative Joined Var(ix86_align_data_type) Enum(ix86_align_data) Init(ix86_align_data_type_compat)
+Use the given data alignment
+
+Enum
+Name(ix86_align_data) Type(enum ix86_align_data)
+Known data alignment choices (for use with the -malign-data= option):
+
+EnumValue
+Enum(ix86_align_data) String(compat) Value(ix86_align_data_type_compat)
+
+EnumValue
+Enum(ix86_align_data) String(abi) Value(ix86_align_data_type_abi)
+
+EnumValue
+Enum(ix86_align_data) String(cacheline) Value(ix86_align_data_type_cacheline)
+
march=
Target RejectNegative Joined Var(ix86_arch_string)
Generate code for given CPU
@@ -814,6 +831,10 @@ Target Report Var(flag_nop_mcount) Init(0)
Generate mcount/__fentry__ calls as nops. To activate they need to be
patched in.
+mskip-rax-setup
+Target Report Var(flag_skip_rax_setup) Init(0)
+Skip setting up RAX register when passing variable arguments.
+
m8bit-idiv
Target Report Mask(USE_8BIT_IDIV) Save
Expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index fe97f27..bf29e18 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -976,7 +976,7 @@ msp430_asm_integer (rtx x, unsigned int size, int aligned_p)
#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA msp430_asm_output_addr_const_extra
static bool
-msp430_asm_output_addr_const_extra (FILE *file, rtx x)
+msp430_asm_output_addr_const_extra (FILE *file ATTRIBUTE_UNUSED, rtx x)
{
debug_rtx(x);
return false;
diff --git a/gcc/config/nds32/nds32.md b/gcc/config/nds32/nds32.md
index 18d6d1b..b5642d2 100644
--- a/gcc/config/nds32/nds32.md
+++ b/gcc/config/nds32/nds32.md
@@ -2178,7 +2178,7 @@ create_template:
(const_int 4))
(label_ref (match_operand 1 "" "")))))
(use (label_ref (match_dup 1)))
- (clobber (match_operand:SI 2 "register_operand" ""))
+ (clobber (match_operand:SI 2 "register_operand" "=r"))
(clobber (reg:SI TA_REGNUM))])]
""
{
diff --git a/gcc/config/rl78/rl78.h b/gcc/config/rl78/rl78.h
index c3cae69..3e6344a 100644
--- a/gcc/config/rl78/rl78.h
+++ b/gcc/config/rl78/rl78.h
@@ -144,7 +144,6 @@
#define STORE_FLAG_VALUE 1
#define LOAD_EXTEND_OP(MODE) ZERO_EXTEND
-#define SHORT_IMMEDIATES_SIGN_EXTEND 0
/* The RL78 has four register banks. Normal operation uses RB0 as
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 644dd06..5aa50a25 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -1086,47 +1086,6 @@
(label_ref (match_dup 2))
(pc)))])
-;; Conditional move combine pattern for div0s comparisons.
-;; This is used when TARGET_PRETEND_CMOVE is in effect.
-(define_insn_and_split "*movsicc_div0s"
- [(set (match_operand:SI 0 "arith_reg_dest" "")
- (if_then_else:SI (ge (xor:SI (match_operand:SI 1 "arith_reg_operand" "")
- (match_operand:SI 2 "arith_reg_operand" ""))
- (const_int 0))
- (match_operand:SI 3 "arith_reg_operand" "")
- (match_operand:SI 4 "general_movsrc_operand" "")))
- (clobber (reg:SI T_REG))]
- "TARGET_PRETEND_CMOVE"
- "#"
- "&& 1"
- [(set (reg:SI T_REG) (lt:SI (xor:SI (match_dup 1) (match_dup 2))
- (const_int 0)))
- (set (match_dup 0)
- (if_then_else (ne (reg:SI T_REG) (const_int 0))
- (match_dup 4)
- (match_dup 3)))])
-
-(define_insn_and_split "*movsicc_div0s"
- [(set (match_operand:SI 0 "arith_reg_dest")
- (if_then_else:SI (eq (lshiftrt:SI
- (match_operand:SI 1 "arith_reg_operand")
- (const_int 31))
- (lshiftrt:SI
- (match_operand:SI 2 "arith_reg_operand")
- (const_int 31)))
- (match_operand:SI 3 "arith_reg_operand")
- (match_operand:SI 4 "general_movsrc_operand")))
- (clobber (reg:SI T_REG))]
- "TARGET_PRETEND_CMOVE"
- "#"
- "&& 1"
- [(set (reg:SI T_REG) (lt:SI (xor:SI (match_dup 1) (match_dup 2))
- (const_int 0)))
- (set (match_dup 0)
- (if_then_else (ne (reg:SI T_REG) (const_int 0))
- (match_dup 4)
- (match_dup 3)))])
-
;; -------------------------------------------------------------------------
;; SImode unsigned integer comparisons
;; -------------------------------------------------------------------------
diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
index 68c7fc1..97e677d 100644
--- a/gcc/config/sh/sh_treg_combine.cc
+++ b/gcc/config/sh/sh_treg_combine.cc
@@ -432,6 +432,16 @@ trace_reg_uses (rtx reg, rtx_insn *start_insn, rtx abort_at_insn)
return count;
}
+static bool
+is_conditional_insn (rtx_insn* i)
+{
+ if (! (INSN_P (i) && NONDEBUG_INSN_P (i)))
+ return false;
+
+ rtx p = PATTERN (i);
+ return GET_CODE (p) == SET && GET_CODE (XEXP (p, 1)) == IF_THEN_ELSE;
+}
+
// FIXME: Remove dependency on SH predicate function somehow.
extern int t_reg_operand (rtx, machine_mode);
extern int negt_reg_operand (rtx, machine_mode);
@@ -484,6 +494,7 @@ private:
struct cbranch_trace
{
rtx_insn *cbranch_insn;
+ rtx* condition_rtx_in_insn;
branch_condition_type_t cbranch_type;
// The comparison against zero right before the conditional branch.
@@ -495,9 +506,14 @@ private:
cbranch_trace (rtx_insn *insn)
: cbranch_insn (insn),
+ condition_rtx_in_insn (NULL),
cbranch_type (unknown_branch_condition),
setcc ()
{
+ if (is_conditional_insn (cbranch_insn))
+ condition_rtx_in_insn = &XEXP (XEXP (PATTERN (cbranch_insn), 1), 0);
+ else if (rtx x = pc_set (cbranch_insn))
+ condition_rtx_in_insn = &XEXP (XEXP (x, 1), 0);
}
basic_block bb (void) const { return BLOCK_FOR_INSN (cbranch_insn); }
@@ -505,8 +521,16 @@ private:
rtx
branch_condition_rtx (void) const
{
- rtx x = pc_set (cbranch_insn);
- return x == NULL_RTX ? NULL_RTX : XEXP (XEXP (x, 1), 0);
+ return condition_rtx_in_insn != NULL ? *condition_rtx_in_insn : NULL;
+ }
+ rtx&
+ branch_condition_rtx_ref (void) const
+ {
+ // Before anything gets to invoke this function, there are other checks
+ // in place to make sure that we have a known branch condition and thus
+ // the ref to the rtx in the insn.
+ gcc_assert (condition_rtx_in_insn != NULL);
+ return *condition_rtx_in_insn;
}
bool
@@ -1033,8 +1057,18 @@ sh_treg_combine::try_invert_branch_condition (cbranch_trace& trace)
{
log_msg ("inverting branch condition\n");
- if (!invert_jump_1 (trace.cbranch_insn, JUMP_LABEL (trace.cbranch_insn)))
- log_return (false, "invert_jump_1 failed\n");
+ rtx& comp = trace.branch_condition_rtx_ref ();
+
+ rtx_code rev_cmp_code = reversed_comparison_code (comp, trace.cbranch_insn);
+
+ if (rev_cmp_code == UNKNOWN)
+ log_return (false, "reversed_comparison_code = UNKNOWN\n");
+
+ validate_change (trace.cbranch_insn, &comp,
+ gen_rtx_fmt_ee (rev_cmp_code,
+ GET_MODE (comp), XEXP (comp, 0),
+ XEXP (comp, 1)),
+ 1);
if (verify_changes (num_validated_changes ()))
confirm_change_group ();
@@ -1339,9 +1373,17 @@ sh_treg_combine::try_optimize_cbranch (rtx_insn *insn)
// for now we limit the search to the current basic block.
trace.setcc = find_set_of_reg_bb (m_ccreg, prev_nonnote_insn_bb (insn));
- if (!is_cmp_eq_zero (trace.setcc.set_src ()))
+ if (trace.setcc.set_src () == NULL_RTX)
log_return_void ("could not find set of ccreg in current BB\n");
+ if (!is_cmp_eq_zero (trace.setcc.set_src ())
+ && !is_inverted_ccreg (trace.setcc.set_src ()))
+ {
+ log_msg ("unsupported set of ccreg in current BB: ");
+ log_rtx (trace.setcc.set_src ());
+ log_return_void ("\n");
+ }
+
rtx trace_reg = XEXP (trace.setcc.set_src (), 0);
log_msg ("set of ccreg:\n");
@@ -1358,6 +1400,19 @@ sh_treg_combine::try_optimize_cbranch (rtx_insn *insn)
log_return_void ("\nbecause it's volatile\n");
}
+ // If the ccreg is inverted before cbranch try inverting the branch
+ // condition.
+ if (is_inverted_ccreg (trace.setcc.set_src ()))
+ {
+ if (!trace.can_invert_condition ())
+ log_return_void ("branch condition can't be inverted - aborting\n");
+
+ if (try_invert_branch_condition (trace))
+ delete_insn (trace.setcc.insn);
+
+ return;
+ }
+
// Now that we have an insn which tests some reg and sets the condition
// reg before the conditional branch, try to figure out how that tested
// reg was formed, i.e. find all the insns that set the tested reg in
@@ -1510,14 +1565,26 @@ sh_treg_combine::execute (function *fun)
log_rtx (m_ccreg);
log_msg (" STORE_FLAG_VALUE = %d\n", STORE_FLAG_VALUE);
- // Look for basic blocks that end with a conditional branch and try to
- // optimize them.
+ // Look for basic blocks that end with a conditional branch or for
+ // conditional insns and try to optimize them.
basic_block bb;
FOR_EACH_BB_FN (bb, fun)
{
- rtx_insn *i = BB_END (bb);
+ rtx_insn* i = BB_END (bb);
+ if (i == NULL || i == PREV_INSN (BB_HEAD (bb)))
+ continue;
+
+ // A conditional branch is always the last insn of a basic block.
if (any_condjump_p (i) && onlyjump_p (i))
- try_optimize_cbranch (i);
+ {
+ try_optimize_cbranch (i);
+ i = PREV_INSN (i);
+ }
+
+ // Check all insns in block for conditional insns.
+ for (; i != NULL && i != PREV_INSN (BB_HEAD (bb)); i = PREV_INSN (i))
+ if (is_conditional_insn (i))
+ try_optimize_cbranch (i);
}
log_msg ("\n\n");
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index afb2483..823f086 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,46 @@
+2014-12-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/64105
+ * parser.c (cp_parser_simple_type_specifier): Make auto parameter
+ before -std=c++14 an error.
+
+ PR c++/64352
+ * pt.c (tsubst_copy_and_build): Pass complain to mark_used.
+
+ PR c++/64251
+ * decl2.c (mark_used): Don't mark if in_template_function.
+
+2014-12-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60955
+ * pt.c (struct warning_sentinel): Move it...
+ * cp-tree.h: ... here.
+ * semantics.c (force_paren_expr): Use it.
+
+2014-12-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/64333
+ * constexpr.c (cxx_bind_parameters_in_call): non_constant_args parm.
+ (cxx_eval_call_expression): Don't cache calls with non-constant args.
+ (cxx_eval_constant_expression) [COMPOUND_EXPR]: Pass true for lval.
+ (cxx_eval_unary_expression, cxx_eval_binary_expression)
+ (cxx_eval_conditional_expression): Pass false for lval.
+
+ * constexpr.c: Change "addr" parm names to "lval".
+
+ * constexpr.c: Tweak comments and formatting.
+
+2014-12-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58650
+ * parser.c (cp_parser_member_declaration): Fix error recovery for
+ initialized non-static data member declared friend.
+
+2014-12-15 Jan Hubicka <hubicka@ucw.cz>
+
+ * decl2.c (decl_needed_p): When not optimizing, do not consider external
+ decls as needed.
+
2014-12-15 Jason Merrill <jason@redhat.com>
PR c++/64297
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 732a79c..afbcf51 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1,6 +1,5 @@
-/* Perform the semantic phase of constexpr parsing, i.e., the process of
- building tree structure, checking semantic consistency, and
- building RTL. These routines are used both during actual parsing
+/* Perform -*- C++ -*- constant expression evaluation, including calls to
+ constexpr functions. These routines are used both during actual parsing
and during the instantiation of template functions.
Copyright (C) 1998-2014 Free Software Foundation, Inc.
@@ -866,11 +865,20 @@ struct constexpr_call_hasher : ggc_hasher<constexpr_call *>
is a map of values of variables initialized within the expression. */
struct constexpr_ctx {
+ /* The innermost call we're evaluating. */
constexpr_call *call;
+ /* Values for any temporaries or local variables within the
+ constant-expression. */
hash_map<tree,tree> *values;
+ /* The CONSTRUCTOR we're currently building up for an aggregate
+ initializer. */
tree ctor;
+ /* The object we're building the CONSTRUCTOR for. */
tree object;
+ /* Whether we should error on a non-constant expression or fail quietly. */
bool quiet;
+ /* Whether we are strictly conforming to constant expression rules or
+ trying harder to get a constant value. */
bool strict;
};
@@ -991,7 +999,7 @@ lookup_parameter_binding (const constexpr_call *call, tree t)
static tree
cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
const int nargs = call_expr_nargs (t);
@@ -1001,7 +1009,7 @@ cxx_eval_builtin_function_call (const constexpr_ctx *ctx, tree t,
for (i = 0; i < nargs; ++i)
{
args[i] = cxx_eval_constant_expression (ctx, CALL_EXPR_ARG (t, i),
- addr,
+ lval,
non_constant_p, overflow_p);
if (ctx->quiet && *non_constant_p)
return t;
@@ -1042,7 +1050,8 @@ adjust_temp_type (tree type, tree temp)
static void
cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
constexpr_call *new_call,
- bool *non_constant_p, bool *overflow_p)
+ bool *non_constant_p, bool *overflow_p,
+ bool *non_constant_args)
{
const int nargs = call_expr_nargs (t);
tree fun = new_call->fundef->decl;
@@ -1063,7 +1072,7 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
x = ctx->object;
x = cp_build_addr_expr (x, tf_warning_or_error);
}
- bool addr = false;
+ bool lval = false;
if (parms && DECL_BY_REFERENCE (parms) && !use_new_call)
{
/* cp_genericize made this a reference for argument passing, but
@@ -1074,9 +1083,9 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
gcc_assert (TREE_CODE (TREE_TYPE (x)) == REFERENCE_TYPE);
type = TREE_TYPE (type);
x = convert_from_reference (x);
- addr = true;
+ lval = true;
}
- arg = cxx_eval_constant_expression (ctx, x, addr,
+ arg = cxx_eval_constant_expression (ctx, x, lval,
non_constant_p, overflow_p);
/* Don't VERIFY_CONSTANT here. */
if (*non_constant_p && ctx->quiet)
@@ -1091,6 +1100,8 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t,
/* Make sure the binding has the same type as the parm. */
if (TREE_CODE (type) != REFERENCE_TYPE)
arg = adjust_temp_type (type, arg);
+ if (!TREE_CONSTANT (arg))
+ *non_constant_args = true;
*p = build_tree_list (parms, arg);
p = &TREE_CHAIN (*p);
next:
@@ -1142,15 +1153,12 @@ cx_error_context (void)
static tree
cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
location_t loc = EXPR_LOC_OR_LOC (t, input_location);
tree fun = get_function_named_in_call (t);
- tree result;
constexpr_call new_call = { NULL, NULL, NULL, 0 };
- constexpr_call **slot;
- constexpr_call *entry;
bool depth_ok;
if (fun == NULL_TREE)
@@ -1170,7 +1178,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
{
/* Might be a constexpr function pointer. */
fun = cxx_eval_constant_expression (ctx, fun,
- /*addr*/false, non_constant_p,
+ /*lval*/false, non_constant_p,
overflow_p);
STRIP_NOPS (fun);
if (TREE_CODE (fun) == ADDR_EXPR)
@@ -1192,7 +1200,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
if (is_builtin_fn (fun))
return cxx_eval_builtin_function_call (ctx, t,
- addr, non_constant_p, overflow_p);
+ lval, non_constant_p, overflow_p);
if (!DECL_DECLARED_CONSTEXPR_P (fun))
{
if (!ctx->quiet)
@@ -1211,7 +1219,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
{
tree arg = convert_from_reference (get_nth_callarg (t, 1));
return cxx_eval_constant_expression (ctx, arg,
- addr, non_constant_p,
+ lval, non_constant_p,
overflow_p);
}
else if (TREE_CODE (t) == AGGR_INIT_EXPR
@@ -1256,36 +1264,45 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
ctx = &new_ctx;
}
+ bool non_constant_args = false;
cxx_bind_parameters_in_call (ctx, t, &new_call,
- non_constant_p, overflow_p);
+ non_constant_p, overflow_p, &non_constant_args);
if (*non_constant_p)
return t;
depth_ok = push_cx_call_context (t);
- new_call.hash
- = iterative_hash_template_arg (new_call.bindings,
- constexpr_fundef_hasher::hash (new_call.fundef));
+ tree result = NULL_TREE;
- /* If we have seen this call before, we are done. */
- maybe_initialize_constexpr_call_table ();
- slot = constexpr_call_table->find_slot (&new_call, INSERT);
- entry = *slot;
- if (entry == NULL)
- {
- /* We need to keep a pointer to the entry, not just the slot, as the
- slot can move in the call to cxx_eval_builtin_function_call. */
- *slot = entry = ggc_alloc<constexpr_call> ();
- *entry = new_call;
- }
- /* Calls which are in progress have their result set to NULL
- so that we can detect circular dependencies. */
- else if (entry->result == NULL)
+ constexpr_call *entry = NULL;
+ if (!non_constant_args)
{
- if (!ctx->quiet)
- error ("call has circular dependency");
- *non_constant_p = true;
- entry->result = result = error_mark_node;
+ new_call.hash = iterative_hash_template_arg
+ (new_call.bindings, constexpr_fundef_hasher::hash (new_call.fundef));
+
+ /* If we have seen this call before, we are done. */
+ maybe_initialize_constexpr_call_table ();
+ constexpr_call **slot
+ = constexpr_call_table->find_slot (&new_call, INSERT);
+ entry = *slot;
+ if (entry == NULL)
+ {
+ /* We need to keep a pointer to the entry, not just the slot, as the
+ slot can move in the call to cxx_eval_builtin_function_call. */
+ *slot = entry = ggc_alloc<constexpr_call> ();
+ *entry = new_call;
+ }
+ /* Calls which are in progress have their result set to NULL
+ so that we can detect circular dependencies. */
+ else if (entry->result == NULL)
+ {
+ if (!ctx->quiet)
+ error ("call has circular dependency");
+ *non_constant_p = true;
+ entry->result = result = error_mark_node;
+ }
+ else
+ result = entry->result;
}
if (!depth_ok)
@@ -1295,11 +1312,10 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
"-fconstexpr-depth= to increase the maximum)",
max_constexpr_depth);
*non_constant_p = true;
- entry->result = result = error_mark_node;
+ result = error_mark_node;
}
else
{
- result = entry->result;
if (!result || result == error_mark_node)
{
if (!use_new_call)
@@ -1307,7 +1323,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
new_ctx.call = &new_call;
result = (cxx_eval_constant_expression
(&new_ctx, new_call.fundef->body,
- addr,
+ lval,
non_constant_p, overflow_p));
}
else
@@ -1350,7 +1366,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
tree jump_target = NULL_TREE;
cxx_eval_constant_expression (ctx, body,
- addr, non_constant_p, overflow_p,
+ lval, non_constant_p, overflow_p,
&jump_target);
if (DECL_CONSTRUCTOR_P (fun))
@@ -1359,7 +1375,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
side-effects rather than the value. We could get at the
value by evaluating *this, but we don't bother; there's
no need to put such a call in the hash table. */
- result = addr ? ctx->object : ctx->ctor;
+ result = lval ? ctx->object : ctx->ctor;
else
{
result = *ctx->values->get (slot ? slot : res);
@@ -1387,7 +1403,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
if (result == error_mark_node)
*non_constant_p = true;
if (*non_constant_p)
- entry->result = result = error_mark_node;
+ result = error_mark_node;
else if (result)
{
/* If this was a call to initialize an object, set the type of
@@ -1401,10 +1417,11 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t,
result = adjust_temp_type (TREE_TYPE (TREE_TYPE (ob_arg)),
result);
}
- entry->result = result;
}
else
result = void_node;
+ if (entry)
+ entry->result = result;
}
pop_cx_call_context ();
@@ -1550,13 +1567,13 @@ cxx_eval_check_shift_p (location_t loc, const constexpr_ctx *ctx,
static tree
cxx_eval_unary_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool /*lval*/,
bool *non_constant_p, bool *overflow_p)
{
tree r;
tree orig_arg = TREE_OPERAND (t, 0);
- tree arg = cxx_eval_constant_expression (ctx, orig_arg,
- addr, non_constant_p, overflow_p);
+ tree arg = cxx_eval_constant_expression (ctx, orig_arg, /*lval*/false,
+ non_constant_p, overflow_p);
VERIFY_CONSTANT (arg);
location_t loc = EXPR_LOCATION (t);
enum tree_code code = TREE_CODE (t);
@@ -1578,19 +1595,17 @@ cxx_eval_unary_expression (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_binary_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool /*lval*/,
bool *non_constant_p, bool *overflow_p)
{
tree r;
tree orig_lhs = TREE_OPERAND (t, 0);
tree orig_rhs = TREE_OPERAND (t, 1);
tree lhs, rhs;
- lhs = cxx_eval_constant_expression (ctx, orig_lhs,
- addr,
+ lhs = cxx_eval_constant_expression (ctx, orig_lhs, /*lval*/false,
non_constant_p, overflow_p);
VERIFY_CONSTANT (lhs);
- rhs = cxx_eval_constant_expression (ctx, orig_rhs,
- addr,
+ rhs = cxx_eval_constant_expression (ctx, orig_rhs, /*lval*/false,
non_constant_p, overflow_p);
VERIFY_CONSTANT (rhs);
@@ -1617,22 +1632,22 @@ cxx_eval_binary_expression (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_conditional_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p,
tree *jump_target)
{
tree val = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
- addr,
+ /*lval*/false,
non_constant_p, overflow_p);
VERIFY_CONSTANT (val);
/* Don't VERIFY_CONSTANT the other operands. */
if (integer_zerop (val))
return cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 2),
- addr,
+ lval,
non_constant_p, overflow_p,
jump_target);
return cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
- addr,
+ lval,
non_constant_p, overflow_p,
jump_target);
}
@@ -1642,12 +1657,12 @@ cxx_eval_conditional_expression (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
tree oldary = TREE_OPERAND (t, 0);
tree ary = cxx_eval_constant_expression (ctx, oldary,
- addr,
+ lval,
non_constant_p, overflow_p);
tree index, oldidx;
HOST_WIDE_INT i;
@@ -1660,9 +1675,9 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
false,
non_constant_p, overflow_p);
VERIFY_CONSTANT (index);
- if (addr && ary == oldary && index == oldidx)
+ if (lval && ary == oldary && index == oldidx)
return t;
- else if (addr)
+ else if (lval)
return build4 (ARRAY_REF, TREE_TYPE (t), ary, index, NULL, NULL);
elem_type = TREE_TYPE (TREE_TYPE (ary));
if (TREE_CODE (ary) == CONSTRUCTOR)
@@ -1688,7 +1703,7 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
initializer, it's value-initialized. */
tree val = build_value_init (elem_type, tf_warning_or_error);
return cxx_eval_constant_expression (ctx, val,
- addr,
+ lval,
non_constant_p, overflow_p);
}
@@ -1725,7 +1740,7 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
unsigned HOST_WIDE_INT i;
@@ -1734,11 +1749,11 @@ cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
tree part = TREE_OPERAND (t, 1);
tree orig_whole = TREE_OPERAND (t, 0);
tree whole = cxx_eval_constant_expression (ctx, orig_whole,
- addr,
+ lval,
non_constant_p, overflow_p);
if (whole == orig_whole)
return t;
- if (addr)
+ if (lval)
return fold_build3 (COMPONENT_REF, TREE_TYPE (t),
whole, part, NULL_TREE);
/* Don't VERIFY_CONSTANT here; we only want to check that we got a
@@ -1793,7 +1808,7 @@ cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
/* If there's no explicit init for this field, it's value-initialized. */
value = build_value_init (TREE_TYPE (t), tf_warning_or_error);
return cxx_eval_constant_expression (ctx, value,
- addr,
+ lval,
non_constant_p, overflow_p);
}
@@ -1803,7 +1818,7 @@ cxx_eval_component_reference (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_bit_field_ref (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
tree orig_whole = TREE_OPERAND (t, 0);
@@ -1811,7 +1826,7 @@ cxx_eval_bit_field_ref (const constexpr_ctx *ctx, tree t,
bool fld_seen = false;
HOST_WIDE_INT istart, isize;
tree whole = cxx_eval_constant_expression (ctx, orig_whole,
- addr,
+ lval,
non_constant_p, overflow_p);
tree start, field, value;
unsigned HOST_WIDE_INT i;
@@ -1889,19 +1904,19 @@ cxx_eval_bit_field_ref (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_logical_expression (const constexpr_ctx *ctx, tree t,
tree bailout_value, tree continue_value,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
tree r;
tree lhs = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
- addr,
+ lval,
non_constant_p, overflow_p);
VERIFY_CONSTANT (lhs);
if (tree_int_cst_equal (lhs, bailout_value))
return lhs;
gcc_assert (tree_int_cst_equal (lhs, continue_value));
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
- addr, non_constant_p,
+ lval, non_constant_p,
overflow_p);
VERIFY_CONSTANT (r);
return r;
@@ -2023,7 +2038,7 @@ verify_ctor_sanity (const constexpr_ctx *ctx, tree type)
static tree
cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
vec<constructor_elt, va_gc> *v = CONSTRUCTOR_ELTS (t);
@@ -2044,7 +2059,7 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t,
initializers can refer to it. */
CONSTRUCTOR_APPEND_ELT (*p, index, new_ctx.ctor);
tree elt = cxx_eval_constant_expression (&new_ctx, value,
- addr,
+ lval,
non_constant_p, overflow_p);
/* Don't VERIFY_CONSTANT here. */
if (ctx->quiet && *non_constant_p)
@@ -2103,7 +2118,7 @@ cxx_eval_bare_aggregate (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
- bool value_init, bool addr,
+ bool value_init, bool lval,
bool *non_constant_p, bool *overflow_p)
{
tree elttype = TREE_TYPE (atype);
@@ -2154,7 +2169,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
eltinit = cp_build_array_ref (input_location, init, idx,
tf_warning_or_error);
eltinit = cxx_eval_vec_init_1 (&new_ctx, elttype, eltinit, value_init,
- addr,
+ lval,
non_constant_p, overflow_p);
}
else if (pre_init)
@@ -2163,7 +2178,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
we just pre-built above. */
eltinit = (cxx_eval_constant_expression
(&new_ctx, init,
- addr, non_constant_p, overflow_p));
+ lval, non_constant_p, overflow_p));
}
else
{
@@ -2176,7 +2191,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
eltinit = move (eltinit);
eltinit = force_rvalue (eltinit, tf_warning_or_error);
eltinit = (cxx_eval_constant_expression
- (&new_ctx, eltinit, addr,
+ (&new_ctx, eltinit, lval,
non_constant_p, overflow_p));
}
if (*non_constant_p && !ctx->quiet)
@@ -2201,14 +2216,14 @@ cxx_eval_vec_init_1 (const constexpr_ctx *ctx, tree atype, tree init,
static tree
cxx_eval_vec_init (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
tree atype = TREE_TYPE (t);
tree init = VEC_INIT_EXPR_INIT (t);
tree r = cxx_eval_vec_init_1 (ctx, atype, init,
VEC_INIT_EXPR_VALUE_INIT (t),
- addr, non_constant_p, overflow_p);
+ lval, non_constant_p, overflow_p);
if (*non_constant_p)
return t;
else
@@ -2408,12 +2423,12 @@ cxx_fold_indirect_ref (location_t loc, tree type, tree op0, bool *empty_base)
static tree
cxx_eval_indirect_ref (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
tree orig_op0 = TREE_OPERAND (t, 0);
tree op0 = cxx_eval_constant_expression (ctx, orig_op0,
- /*addr*/false, non_constant_p,
+ /*lval*/false, non_constant_p,
overflow_p);
bool empty_base = false;
tree r;
@@ -2427,7 +2442,7 @@ cxx_eval_indirect_ref (const constexpr_ctx *ctx, tree t,
if (r)
r = cxx_eval_constant_expression (ctx, r,
- addr, non_constant_p, overflow_p);
+ lval, non_constant_p, overflow_p);
else
{
tree sub = op0;
@@ -2451,7 +2466,7 @@ cxx_eval_indirect_ref (const constexpr_ctx *ctx, tree t,
/* If we're pulling out the value of an empty base, make sure
that the whole object is constant and then return an empty
CONSTRUCTOR. */
- if (empty_base && !addr)
+ if (empty_base && !lval)
{
VERIFY_CONSTANT (r);
r = build_constructor (TREE_TYPE (t), NULL);
@@ -2460,9 +2475,9 @@ cxx_eval_indirect_ref (const constexpr_ctx *ctx, tree t,
if (r == NULL_TREE)
{
- if (addr && op0 != orig_op0)
+ if (lval && op0 != orig_op0)
return build1 (INDIRECT_REF, TREE_TYPE (t), op0);
- if (!addr)
+ if (!lval)
VERIFY_CONSTANT (t);
return t;
}
@@ -2518,7 +2533,7 @@ non_const_var_error (tree r)
static tree
cxx_eval_trinary_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
int i;
@@ -2528,7 +2543,7 @@ cxx_eval_trinary_expression (const constexpr_ctx *ctx, tree t,
for (i = 0; i < 3; i++)
{
args[i] = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, i),
- addr,
+ lval,
non_constant_p, overflow_p);
VERIFY_CONSTANT (args[i]);
}
@@ -2553,7 +2568,7 @@ var_in_constexpr_fn (tree t)
static tree
cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
constexpr_ctx new_ctx = *ctx;
@@ -2650,7 +2665,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
if (*non_constant_p)
return t;
- else if (addr)
+ else if (lval)
return target;
else
return init;
@@ -2660,7 +2675,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_increment_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p)
{
enum tree_code code = TREE_CODE (t);
@@ -2703,7 +2718,7 @@ cxx_eval_increment_expression (const constexpr_ctx *ctx, tree t,
if (code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR)
{
/* Prefix ops are lvalues. */
- if (addr)
+ if (lval)
return op;
else
/* But we optimize when the caller wants an rvalue. */
@@ -2878,7 +2893,7 @@ cxx_eval_switch_expr (const constexpr_ctx *ctx, tree t,
static tree
cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
- bool addr,
+ bool lval,
bool *non_constant_p, bool *overflow_p,
tree *jump_target)
{
@@ -2905,7 +2920,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
switch (TREE_CODE (t))
{
case RESULT_DECL:
- if (addr)
+ if (lval)
return t;
/* We ask for an rvalue for the RESULT_DECL when indirecting
through an invisible reference. */
@@ -2913,7 +2928,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
return (*ctx->values->get (t));
case VAR_DECL:
- if (addr)
+ if (lval)
return t;
/* else fall through. */
case CONST_DECL:
@@ -2946,11 +2961,11 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
if (!use_new_call && ctx
&& ctx->call && DECL_CONTEXT (t) == ctx->call->fundef->decl)
r = lookup_parameter_binding (ctx->call, t);
- else if (addr && TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE)
+ else if (lval && TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE)
/* glvalue use. */;
else if (tree *p = ctx->values->get (r))
r = *p;
- else if (addr)
+ else if (lval)
/* Defer in case this is only used for its type. */;
else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
/* Defer, there's no lvalue->rvalue conversion. */;
@@ -2970,7 +2985,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case CALL_EXPR:
case AGGR_INIT_EXPR:
- r = cxx_eval_call_expression (ctx, t, addr,
+ r = cxx_eval_call_expression (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3026,7 +3041,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
ctx->values->put (new_ctx.object, new_ctx.ctor);
ctx = &new_ctx;
}
- /* Pass false for 'addr' because this indicates
+ /* Pass false for 'lval' because this indicates
initialization of a temporary. */
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
false,
@@ -3034,7 +3049,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
if (!*non_constant_p)
/* Adjust the type of the result to the type of the temporary. */
r = adjust_temp_type (TREE_TYPE (t), r);
- if (addr)
+ if (lval)
{
tree slot = TARGET_EXPR_SLOT (t);
ctx->values->put (slot, r);
@@ -3054,19 +3069,19 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
}
/* else fall through */
case MODIFY_EXPR:
- r = cxx_eval_store_expression (ctx, t, addr,
+ r = cxx_eval_store_expression (ctx, t, lval,
non_constant_p, overflow_p);
break;
case SCOPE_REF:
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 1),
- addr,
+ lval,
non_constant_p, overflow_p);
break;
case RETURN_EXPR:
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
- addr,
+ lval,
non_constant_p, overflow_p);
*jump_target = t;
break;
@@ -3077,7 +3092,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
r = *p;
else
{
- r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0), addr,
+ r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0), false,
non_constant_p, overflow_p);
ctx->values->put (t, r);
}
@@ -3090,7 +3105,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case EXPR_STMT:
case EH_SPEC_BLOCK:
r = cxx_eval_constant_expression (ctx, TREE_OPERAND (t, 0),
- addr,
+ lval,
non_constant_p, overflow_p,
jump_target);
break;
@@ -3099,7 +3114,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
check for a constant operand or result; an address can be
constant without its operand being, and vice versa. */
case INDIRECT_REF:
- r = cxx_eval_indirect_ref (ctx, t, addr,
+ r = cxx_eval_indirect_ref (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3107,7 +3122,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
{
tree oldop = TREE_OPERAND (t, 0);
tree op = cxx_eval_constant_expression (ctx, oldop,
- /*addr*/true,
+ /*lval*/true,
non_constant_p, overflow_p);
/* Don't VERIFY_CONSTANT here. */
if (*non_constant_p)
@@ -3130,7 +3145,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
case FIXED_CONVERT_EXPR:
- r = cxx_eval_unary_expression (ctx, t, addr,
+ r = cxx_eval_unary_expression (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3160,17 +3175,17 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
if ((TREE_CODE (op0) == TARGET_EXPR && op1 == TARGET_EXPR_SLOT (op0))
|| TREE_CODE (op1) == EMPTY_CLASS_EXPR)
r = cxx_eval_constant_expression (ctx, op0,
- addr, non_constant_p, overflow_p,
+ lval, non_constant_p, overflow_p,
jump_target);
else
{
/* Check that the LHS is constant and then discard it. */
cxx_eval_constant_expression (ctx, op0,
- false, non_constant_p, overflow_p,
+ true, non_constant_p, overflow_p,
jump_target);
op1 = TREE_OPERAND (t, 1);
r = cxx_eval_constant_expression (ctx, op1,
- addr, non_constant_p, overflow_p,
+ lval, non_constant_p, overflow_p,
jump_target);
}
}
@@ -3215,7 +3230,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case LTGT_EXPR:
case RANGE_EXPR:
case COMPLEX_EXPR:
- r = cxx_eval_binary_expression (ctx, t, addr,
+ r = cxx_eval_binary_expression (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3225,7 +3240,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case TRUTH_ANDIF_EXPR:
r = cxx_eval_logical_expression (ctx, t, boolean_false_node,
boolean_true_node,
- addr,
+ lval,
non_constant_p, overflow_p);
break;
@@ -3233,12 +3248,12 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case TRUTH_ORIF_EXPR:
r = cxx_eval_logical_expression (ctx, t, boolean_true_node,
boolean_false_node,
- addr,
+ lval,
non_constant_p, overflow_p);
break;
case ARRAY_REF:
- r = cxx_eval_array_reference (ctx, t, addr,
+ r = cxx_eval_array_reference (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3253,24 +3268,24 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
*non_constant_p = true;
return t;
}
- r = cxx_eval_component_reference (ctx, t, addr,
+ r = cxx_eval_component_reference (ctx, t, lval,
non_constant_p, overflow_p);
break;
case BIT_FIELD_REF:
- r = cxx_eval_bit_field_ref (ctx, t, addr,
+ r = cxx_eval_bit_field_ref (ctx, t, lval,
non_constant_p, overflow_p);
break;
case COND_EXPR:
case VEC_COND_EXPR:
- r = cxx_eval_conditional_expression (ctx, t, addr,
+ r = cxx_eval_conditional_expression (ctx, t, lval,
non_constant_p, overflow_p,
jump_target);
break;
case CONSTRUCTOR:
- r = cxx_eval_bare_aggregate (ctx, t, addr,
+ r = cxx_eval_bare_aggregate (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3280,13 +3295,13 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
be NULL, meaning default-initialization, or it will be an lvalue
or xvalue of the same type, meaning direct-initialization from the
corresponding member. */
- r = cxx_eval_vec_init (ctx, t, addr,
+ r = cxx_eval_vec_init (ctx, t, lval,
non_constant_p, overflow_p);
break;
case FMA_EXPR:
case VEC_PERM_EXPR:
- r = cxx_eval_trinary_expression (ctx, t, addr,
+ r = cxx_eval_trinary_expression (ctx, t, lval,
non_constant_p, overflow_p);
break;
@@ -3296,7 +3311,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
{
tree oldop = TREE_OPERAND (t, 0);
tree op = cxx_eval_constant_expression (ctx, oldop,
- addr,
+ lval,
non_constant_p, overflow_p);
if (*non_constant_p)
return t;
@@ -3336,7 +3351,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case BIND_EXPR:
return cxx_eval_constant_expression (ctx, BIND_EXPR_BODY (t),
- addr,
+ lval,
non_constant_p, overflow_p,
jump_target);
@@ -3345,7 +3360,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case PREDECREMENT_EXPR:
case POSTDECREMENT_EXPR:
return cxx_eval_increment_expression (ctx, t,
- addr, non_constant_p, overflow_p);
+ lval, non_constant_p, overflow_p);
case LAMBDA_EXPR:
case NEW_EXPR:
@@ -3368,7 +3383,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
break;
case PLACEHOLDER_EXPR:
- if (!ctx || !ctx->ctor || (addr && !ctx->object))
+ if (!ctx || !ctx->ctor || (lval && !ctx->object))
{
/* A placeholder without a referent. We can get here when
checking whether NSDMIs are noexcept, or in massage_init_elt;
@@ -3382,11 +3397,11 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
/* Use of the value or address of the current object. We could
use ctx->object unconditionally, but using ctx->ctor when we
can is a minor optimization. */
- tree ctor = addr ? ctx->object : ctx->ctor;
+ tree ctor = lval ? ctx->object : ctx->ctor;
gcc_assert (same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (t), TREE_TYPE (ctor)));
return cxx_eval_constant_expression
- (ctx, ctor, addr,
+ (ctx, ctor, lval,
non_constant_p, overflow_p);
}
break;
@@ -3428,9 +3443,8 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
{
bool non_constant_p = false;
bool overflow_p = false;
- constexpr_ctx ctx = { NULL, NULL, NULL, NULL, allow_non_constant, strict };
hash_map<tree,tree> map;
- ctx.values = &map;
+ constexpr_ctx ctx = { NULL, &map, NULL, NULL, allow_non_constant, strict };
tree type = initialized_type (t);
tree r = t;
if (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type))
@@ -3537,9 +3551,8 @@ is_sub_constant_expr (tree t)
{
bool non_constant_p = false;
bool overflow_p = false;
- constexpr_ctx ctx = { NULL, NULL, NULL, NULL, true, true };
hash_map <tree, tree> map;
- ctx.values = &map;
+ constexpr_ctx ctx = { NULL, &map, NULL, NULL, true, true };
cxx_eval_constant_expression (&ctx, t, false, &non_constant_p,
&overflow_p);
return !non_constant_p && !overflow_p;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index e0e7690..9487e50 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1149,6 +1149,18 @@ struct processing_template_decl_sentinel
}
};
+/* RAII sentinel to disable certain warnings during template substitution
+ and elsewhere. */
+
+struct warning_sentinel
+{
+ int &flag;
+ int val;
+ warning_sentinel(int& flag, bool suppress=true)
+ : flag(flag), val(flag) { if (suppress) flag = 0; }
+ ~warning_sentinel() { flag = val; }
+};
+
/* The cached class binding level, from the most recently exited
class, or NULL if none. */
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 07bdd92..69201b0 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1996,19 +1996,30 @@ decl_needed_p (tree decl)
COMDAT until that point. */
gcc_assert (at_eof);
- /* All entities with external linkage that are not COMDAT should be
+ /* All entities with external linkage that are not COMDAT/EXTERN should be
emitted; they may be referred to from other object files. */
- if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl))
+ if (TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_REALLY_EXTERN (decl))
return true;
- /* If this entity was used, let the back end see it; it will decide
- whether or not to emit it into the object file. */
- if (TREE_USED (decl))
- return true;
/* Functions marked "dllexport" must be emitted so that they are
visible to other DLLs. */
if (flag_keep_inline_dllexport
&& lookup_attribute ("dllexport", DECL_ATTRIBUTES (decl)))
return true;
+
+ /* When not optimizing, do not bother to produce definitions for extern
+ symbols. */
+ if (DECL_REALLY_EXTERN (decl)
+ && ((TREE_CODE (decl) != FUNCTION_DECL
+ && !optimize)
+ || (TREE_CODE (decl) == FUNCTION_DECL
+ && !opt_for_fn (decl, optimize)))
+ && !lookup_attribute ("always_inline", decl))
+ return false;
+
+ /* If this entity was used, let the back end see it; it will decide
+ whether or not to emit it into the object file. */
+ if (TREE_USED (decl))
+ return true;
/* Virtual functions might be needed for devirtualization. */
if (flag_devirtualize
&& TREE_CODE (decl) == FUNCTION_DECL
@@ -5006,7 +5017,7 @@ mark_used (tree decl, tsubst_flags_t complain)
--function_depth;
}
- if (processing_template_decl)
+ if (processing_template_decl || in_template_function ())
return true;
/* Check this too in case we're within instantiate_non_dependent_expr. */
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 76725ef..8ff16ed 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -14862,23 +14862,26 @@ cp_parser_simple_type_specifier (cp_parser* parser,
maybe_warn_cpp0x (CPP0X_AUTO);
if (parser->auto_is_implicit_function_template_parm_p)
{
- type = synthesize_implicit_template_parm (parser);
+ if (cxx_dialect >= cxx14)
+ type = synthesize_implicit_template_parm (parser);
+ else
+ type = error_mark_node;
if (current_class_type && LAMBDA_TYPE_P (current_class_type))
{
if (cxx_dialect < cxx14)
- pedwarn (location_of (type), 0,
+ error_at (token->location,
"use of %<auto%> in lambda parameter declaration "
"only available with "
"-std=c++14 or -std=gnu++14");
}
else if (cxx_dialect < cxx14)
- pedwarn (location_of (type), 0,
+ error_at (token->location,
"use of %<auto%> in parameter declaration "
"only available with "
"-std=c++14 or -std=gnu++14");
else
- pedwarn (location_of (type), OPT_Wpedantic,
+ pedwarn (token->location, OPT_Wpedantic,
"ISO C++ forbids use of %<auto%> in parameter "
"declaration");
}
@@ -14971,6 +14974,9 @@ cp_parser_simple_type_specifier (cp_parser* parser,
/* Consume the token. */
cp_lexer_consume_token (parser->lexer);
+ if (type == error_mark_node)
+ return error_mark_node;
+
/* There is no valid C++ program where a non-template type is
followed by a "<". That usually indicates that the user thought
that the type was a template. */
@@ -21069,7 +21075,10 @@ cp_parser_member_declaration (cp_parser* parser)
if (decl)
{
/* Add DECL to the list of members. */
- if (!friend_p)
+ if (!friend_p
+ /* Explicitly include, eg, NSDMIs, for better error
+ recovery (c++/58650). */
+ || !DECL_DECLARES_FUNCTION_P (decl))
finish_member_declaration (decl);
if (TREE_CODE (decl) == FUNCTION_DECL)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 8a663d9..2a63a2e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14438,16 +14438,6 @@ tsubst_non_call_postfix_expression (tree t, tree args,
return t;
}
-/* Sentinel to disable certain warnings during template substitution. */
-
-struct warning_sentinel {
- int &flag;
- int val;
- warning_sentinel(int& flag, bool suppress=true)
- : flag(flag), val(flag) { if (suppress) flag = 0; }
- ~warning_sentinel() { flag = val; }
-};
-
/* Like tsubst but deals with expressions and performs semantic
analysis. FUNCTION_P is true if T is the "F" in "F (ARGS)". */
@@ -15125,7 +15115,7 @@ tsubst_copy_and_build (tree t,
/* Remember that there was a reference to this entity. */
if (DECL_P (function))
- mark_used (function);
+ mark_used (function, complain);
/* Put back tf_decltype for the actual call. */
complain |= decltype_flag;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5ad391e..bea3b1f 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1660,6 +1660,9 @@ force_paren_expr (tree expr)
tree type = unlowered_expr_type (expr);
bool rval = !!(kind & clk_rvalueref);
type = cp_build_reference_type (type, rval);
+ /* This inhibits warnings in, eg, cxx_mark_addressable
+ (c++/60955). */
+ warning_sentinel s (extra_warnings);
expr = build_static_cast (type, expr, tf_error);
if (expr != error_mark_node)
REF_PARENTHESIZED_P (expr) = true;
diff --git a/gcc/ddg.c b/gcc/ddg.c
index b370d51..2dd39f3 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -77,7 +77,7 @@ mark_mem_use (rtx *x, void *)
{
subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, *x, NONCONST)
- if (MEM_P (*x))
+ if (MEM_P (*iter))
{
mem_ref_p = true;
break;
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 19422d7..33a7ed2 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -701,7 +701,7 @@ Objective-C and Objective-C++ Dialects}.
-m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol
-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
--mstack-protector-guard=@var{guard}}
+-malign-data=@var{type} -mstack-protector-guard=@var{guard}}
@emph{i386 and x86-64 Windows Options}
@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
@@ -15682,6 +15682,14 @@ as well as modifying the function calling convention for functions taking
@code{long double}. Hence they are not binary-compatible
with code compiled without that switch.
+@item -malign-data=@var{type}
+@opindex malign-data
+Control how GCC aligns variables. Supported values for @var{type} are
+@samp{compat} uses increased alignment value compatible uses GCC 4.8
+and earlier, @samp{abi} uses alignment value as specified by the
+psABI, and @samp{cacheline} uses increased alignment value to match
+the cache line size. @samp{compat} is the default.
+
@item -mlarge-data-threshold=@var{threshold}
@opindex mlarge-data-threshold
When @option{-mcmodel=medium} is specified, data objects larger than
@@ -16248,6 +16256,19 @@ the profiling functions as nops. This is useful when they
should be patched in later dynamically. This is likely only
useful together with @option{-mrecord-mcount}.
+@item -mskip-rax-setup
+@itemx -mno-skip-rax-setup
+@opindex mskip-rax-setup
+When generating code for the x86-64 architecture with SSE extensions
+disabled, @option{-skip-rax-setup} can be used to skip setting up RAX
+register when there are no variable arguments passed in vector registers.
+
+@strong{Warning:} Since RAX register is used to avoid unnecessarily
+saving vector registers on stack when passing variable arguments, the
+impacts of this option are callees may waste some stack space,
+misbehave or jump to a random location. GCC 4.4 or newer don't have
+those issues, regardless the RAX register value.
+
@item -m8bit-idiv
@itemx -mno-8bit-idiv
@opindex 8bit-idiv
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 4c2ff8d..601be85 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3029,6 +3029,15 @@ static bool frame_pointer_fb_offset_valid;
static vec<dw_die_ref> base_types;
+/* Flags to represent a set of attribute classes for attributes that represent
+ a scalar value (bounds, pointers, ...). */
+enum dw_scalar_form
+{
+ dw_scalar_form_constant = 0x01,
+ dw_scalar_form_exprloc = 0x02,
+ dw_scalar_form_reference = 0x04
+};
+
/* Forward declarations for functions defined in this file. */
static int is_pseudo_reg (const_rtx);
@@ -3203,8 +3212,11 @@ static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx,
enum var_init_status);
static dw_loc_descr_ref loc_descriptor (rtx, machine_mode mode,
enum var_init_status);
-static dw_loc_list_ref loc_list_from_tree (tree, int);
-static dw_loc_descr_ref loc_descriptor_from_tree (tree, int);
+struct loc_descr_context;
+static dw_loc_list_ref loc_list_from_tree (tree, int,
+ const struct loc_descr_context *);
+static dw_loc_descr_ref loc_descriptor_from_tree (tree, int,
+ const struct loc_descr_context *);
static HOST_WIDE_INT ceiling (HOST_WIDE_INT, unsigned int);
static tree field_type (const_tree);
static unsigned int simple_type_align_in_bits (const_tree);
@@ -3226,7 +3238,10 @@ static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
static void add_name_attribute (dw_die_ref, const char *);
static void add_gnat_descriptive_type_attribute (dw_die_ref, tree, dw_die_ref);
static void add_comp_dir_attribute (dw_die_ref);
-static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree);
+static void add_scalar_info (dw_die_ref, enum dwarf_attribute, tree, int,
+ const struct loc_descr_context *);
+static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree,
+ const struct loc_descr_context *);
static void add_subscript_info (dw_die_ref, tree, bool);
static void add_byte_size_attribute (dw_die_ref, tree);
static void add_bit_offset_attribute (dw_die_ref, tree);
@@ -5370,6 +5385,173 @@ print_signature (FILE *outfile, char *sig)
fprintf (outfile, "%02x", sig[i] & 0xff);
}
+static void print_loc_descr (dw_loc_descr_ref, FILE *);
+
+/* Print the value associated to the VAL DWARF value node to OUTFILE. If
+ RECURSE, output location descriptor operations. */
+
+static void
+print_dw_val (dw_val_node *val, bool recurse, FILE *outfile)
+{
+ switch (val->val_class)
+ {
+ case dw_val_class_addr:
+ fprintf (outfile, "address");
+ break;
+ case dw_val_class_offset:
+ fprintf (outfile, "offset");
+ break;
+ case dw_val_class_loc:
+ fprintf (outfile, "location descriptor");
+ if (val->v.val_loc == NULL)
+ fprintf (outfile, " -> <null>\n");
+ else if (recurse)
+ {
+ fprintf (outfile, ":\n");
+ print_indent += 4;
+ print_loc_descr (val->v.val_loc, outfile);
+ print_indent -= 4;
+ }
+ else
+ fprintf (outfile, " (%p)\n", (void *) val->v.val_loc);
+ break;
+ case dw_val_class_loc_list:
+ fprintf (outfile, "location list -> label:%s",
+ val->v.val_loc_list->ll_symbol);
+ break;
+ case dw_val_class_range_list:
+ fprintf (outfile, "range list");
+ break;
+ case dw_val_class_const:
+ fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, val->v.val_int);
+ break;
+ case dw_val_class_unsigned_const:
+ fprintf (outfile, HOST_WIDE_INT_PRINT_UNSIGNED, val->v.val_unsigned);
+ break;
+ case dw_val_class_const_double:
+ fprintf (outfile, "constant ("HOST_WIDE_INT_PRINT_DEC","\
+ HOST_WIDE_INT_PRINT_UNSIGNED")",
+ val->v.val_double.high,
+ val->v.val_double.low);
+ break;
+ case dw_val_class_wide_int:
+ {
+ int i = val->v.val_wide->get_len ();
+ fprintf (outfile, "constant (");
+ gcc_assert (i > 0);
+ if (val->v.val_wide->elt (i - 1) == 0)
+ fprintf (outfile, "0x");
+ fprintf (outfile, HOST_WIDE_INT_PRINT_HEX,
+ val->v.val_wide->elt (--i));
+ while (--i >= 0)
+ fprintf (outfile, HOST_WIDE_INT_PRINT_PADDED_HEX,
+ val->v.val_wide->elt (i));
+ fprintf (outfile, ")");
+ break;
+ }
+ case dw_val_class_vec:
+ fprintf (outfile, "floating-point or vector constant");
+ break;
+ case dw_val_class_flag:
+ fprintf (outfile, "%u", val->v.val_flag);
+ break;
+ case dw_val_class_die_ref:
+ if (val->v.val_die_ref.die != NULL)
+ {
+ dw_die_ref die = val->v.val_die_ref.die;
+
+ if (die->comdat_type_p)
+ {
+ fprintf (outfile, "die -> signature: ");
+ print_signature (outfile,
+ die->die_id.die_type_node->signature);
+ }
+ else if (die->die_id.die_symbol)
+ fprintf (outfile, "die -> label: %s", die->die_id.die_symbol);
+ else
+ fprintf (outfile, "die -> %ld", die->die_offset);
+ fprintf (outfile, " (%p)", (void *) die);
+ }
+ else
+ fprintf (outfile, "die -> <null>");
+ break;
+ case dw_val_class_vms_delta:
+ fprintf (outfile, "delta: @slotcount(%s-%s)",
+ val->v.val_vms_delta.lbl2, val->v.val_vms_delta.lbl1);
+ break;
+ case dw_val_class_lbl_id:
+ case dw_val_class_lineptr:
+ case dw_val_class_macptr:
+ case dw_val_class_high_pc:
+ fprintf (outfile, "label: %s", val->v.val_lbl_id);
+ break;
+ case dw_val_class_str:
+ if (val->v.val_str->str != NULL)
+ fprintf (outfile, "\"%s\"", val->v.val_str->str);
+ else
+ fprintf (outfile, "<null>");
+ break;
+ case dw_val_class_file:
+ fprintf (outfile, "\"%s\" (%d)", val->v.val_file->filename,
+ val->v.val_file->emitted_number);
+ break;
+ case dw_val_class_data8:
+ {
+ int i;
+
+ for (i = 0; i < 8; i++)
+ fprintf (outfile, "%02x", val->v.val_data8[i]);
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+/* Likewise, for a DIE attribute. */
+
+static void
+print_attribute (dw_attr_ref a, bool recurse, FILE *outfile)
+{
+ print_dw_val (&a->dw_attr_val, recurse, outfile);
+}
+
+
+/* Print the list of operands in the LOC location description to OUTFILE. This
+ routine is a debugging aid only. */
+
+static void
+print_loc_descr (dw_loc_descr_ref loc, FILE *outfile)
+{
+ dw_loc_descr_ref l = loc;
+
+ if (loc == NULL)
+ {
+ print_spaces (outfile);
+ fprintf (outfile, "<null>\n");
+ return;
+ }
+
+ for (l = loc; l != NULL; l = l->dw_loc_next)
+ {
+ print_spaces (outfile);
+ fprintf (outfile, "(%p) %s",
+ (void *) l,
+ dwarf_stack_op_name (l->dw_loc_opc));
+ if (l->dw_loc_oprnd1.val_class != dw_val_class_none)
+ {
+ fprintf (outfile, " ");
+ print_dw_val (&l->dw_loc_oprnd1, false, outfile);
+ }
+ if (l->dw_loc_oprnd2.val_class != dw_val_class_none)
+ {
+ fprintf (outfile, ", ");
+ print_dw_val (&l->dw_loc_oprnd2, false, outfile);
+ }
+ fprintf (outfile, "\n");
+ }
+}
+
/* Print the information associated with a given DIE, and its children.
This routine is a debugging aid only. */
@@ -5402,108 +5584,7 @@ print_die (dw_die_ref die, FILE *outfile)
print_spaces (outfile);
fprintf (outfile, " %s: ", dwarf_attr_name (a->dw_attr));
- switch (AT_class (a))
- {
- case dw_val_class_addr:
- fprintf (outfile, "address");
- break;
- case dw_val_class_offset:
- fprintf (outfile, "offset");
- break;
- case dw_val_class_loc:
- fprintf (outfile, "location descriptor");
- break;
- case dw_val_class_loc_list:
- fprintf (outfile, "location list -> label:%s",
- AT_loc_list (a)->ll_symbol);
- break;
- case dw_val_class_range_list:
- fprintf (outfile, "range list");
- break;
- case dw_val_class_const:
- fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, AT_int (a));
- break;
- case dw_val_class_unsigned_const:
- fprintf (outfile, HOST_WIDE_INT_PRINT_UNSIGNED, AT_unsigned (a));
- break;
- case dw_val_class_const_double:
- fprintf (outfile, "constant ("HOST_WIDE_INT_PRINT_DEC","\
- HOST_WIDE_INT_PRINT_UNSIGNED")",
- a->dw_attr_val.v.val_double.high,
- a->dw_attr_val.v.val_double.low);
- break;
- case dw_val_class_wide_int:
- {
- int i = a->dw_attr_val.v.val_wide->get_len ();
- fprintf (outfile, "constant (");
- gcc_assert (i > 0);
- if (a->dw_attr_val.v.val_wide->elt (i - 1) == 0)
- fprintf (outfile, "0x");
- fprintf (outfile, HOST_WIDE_INT_PRINT_HEX,
- a->dw_attr_val.v.val_wide->elt (--i));
- while (--i >= 0)
- fprintf (outfile, HOST_WIDE_INT_PRINT_PADDED_HEX,
- a->dw_attr_val.v.val_wide->elt (i));
- fprintf (outfile, ")");
- break;
- }
- case dw_val_class_vec:
- fprintf (outfile, "floating-point or vector constant");
- break;
- case dw_val_class_flag:
- fprintf (outfile, "%u", AT_flag (a));
- break;
- case dw_val_class_die_ref:
- if (AT_ref (a) != NULL)
- {
- if (AT_ref (a)->comdat_type_p)
- {
- fprintf (outfile, "die -> signature: ");
- print_signature (outfile,
- AT_ref (a)->die_id.die_type_node->signature);
- }
- else if (AT_ref (a)->die_id.die_symbol)
- fprintf (outfile, "die -> label: %s",
- AT_ref (a)->die_id.die_symbol);
- else
- fprintf (outfile, "die -> %ld", AT_ref (a)->die_offset);
- fprintf (outfile, " (%p)", (void *) AT_ref (a));
- }
- else
- fprintf (outfile, "die -> <null>");
- break;
- case dw_val_class_vms_delta:
- fprintf (outfile, "delta: @slotcount(%s-%s)",
- AT_vms_delta2 (a), AT_vms_delta1 (a));
- break;
- case dw_val_class_lbl_id:
- case dw_val_class_lineptr:
- case dw_val_class_macptr:
- case dw_val_class_high_pc:
- fprintf (outfile, "label: %s", AT_lbl (a));
- break;
- case dw_val_class_str:
- if (AT_string (a) != NULL)
- fprintf (outfile, "\"%s\"", AT_string (a));
- else
- fprintf (outfile, "<null>");
- break;
- case dw_val_class_file:
- fprintf (outfile, "\"%s\" (%d)", AT_file (a)->filename,
- AT_file (a)->emitted_number);
- break;
- case dw_val_class_data8:
- {
- int i;
-
- for (i = 0; i < 8; i++)
- fprintf (outfile, "%02x", a->dw_attr_val.v.val_data8[i]);
- break;
- }
- default:
- break;
- }
-
+ print_attribute (a, true, outfile);
fprintf (outfile, "\n");
}
@@ -5517,6 +5598,14 @@ print_die (dw_die_ref die, FILE *outfile)
fprintf (outfile, "\n");
}
+/* Print the list of operations in the LOC location description. */
+
+DEBUG_FUNCTION void
+debug_dwarf_loc_descr (dw_loc_descr_ref loc)
+{
+ print_loc_descr (loc, stderr);
+}
+
/* Print the information collected for a given DIE. */
DEBUG_FUNCTION void
@@ -10482,9 +10571,9 @@ subrange_type_die (tree type, tree low, tree high, dw_die_ref context_die)
}
if (low)
- add_bound_info (subrange_die, DW_AT_lower_bound, low);
+ add_bound_info (subrange_die, DW_AT_lower_bound, low, NULL);
if (high)
- add_bound_info (subrange_die, DW_AT_upper_bound, high);
+ add_bound_info (subrange_die, DW_AT_upper_bound, high, NULL);
return subrange_die;
}
@@ -11465,7 +11554,7 @@ tls_mem_loc_descriptor (rtx mem)
|| !DECL_THREAD_LOCAL_P (base))
return NULL;
- loc_result = loc_descriptor_from_tree (MEM_EXPR (mem), 1);
+ loc_result = loc_descriptor_from_tree (MEM_EXPR (mem), 1, NULL);
if (loc_result == NULL)
return NULL;
@@ -14203,10 +14292,13 @@ cst_pool_loc_descr (tree loc)
/* Return dw_loc_list representing address of addr_expr LOC
by looking for inner INDIRECT_REF expression and turning
- it into simple arithmetics. */
+ it into simple arithmetics.
+
+ See loc_list_from_tree for the meaning of CONTEXT. */
static dw_loc_list_ref
-loc_list_for_address_of_addr_expr_of_indirect_ref (tree loc, bool toplev)
+loc_list_for_address_of_addr_expr_of_indirect_ref (tree loc, bool toplev,
+ const loc_descr_context *context)
{
tree obj, offset;
HOST_WIDE_INT bitsize, bitpos, bytepos;
@@ -14230,18 +14322,19 @@ loc_list_for_address_of_addr_expr_of_indirect_ref (tree loc, bool toplev)
return 0;
}
if (!offset && !bitpos)
- list_ret = loc_list_from_tree (TREE_OPERAND (obj, 0), toplev ? 2 : 1);
+ list_ret = loc_list_from_tree (TREE_OPERAND (obj, 0), toplev ? 2 : 1,
+ context);
else if (toplev
&& int_size_in_bytes (TREE_TYPE (loc)) <= DWARF2_ADDR_SIZE
&& (dwarf_version >= 4 || !dwarf_strict))
{
- list_ret = loc_list_from_tree (TREE_OPERAND (obj, 0), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (obj, 0), 0, context);
if (!list_ret)
return 0;
if (offset)
{
/* Variable offset. */
- list_ret1 = loc_list_from_tree (offset, 0);
+ list_ret1 = loc_list_from_tree (offset, 0, context);
if (list_ret1 == 0)
return 0;
add_loc_list (&list_ret, list_ret1);
@@ -14264,15 +14357,36 @@ loc_list_for_address_of_addr_expr_of_indirect_ref (tree loc, bool toplev)
}
+/* Helper structure for location descriptions generation. */
+struct loc_descr_context
+{
+ /* The type that is implicitly referenced by DW_OP_push_object_address, or
+ NULL_TREE if DW_OP_push_object_address in invalid for this location
+ description. This is used when processing PLACEHOLDER_EXPR nodes. */
+ tree context_type;
+ /* The ..._DECL node that should be translated as a
+ DW_OP_push_object_address operation. */
+ tree base_decl;
+};
+
/* Generate Dwarf location list representing LOC.
If WANT_ADDRESS is false, expression computing LOC will be computed
If WANT_ADDRESS is 1, expression computing address of LOC will be returned
if WANT_ADDRESS is 2, expression computing address useable in location
will be returned (i.e. DW_OP_reg can be used
- to refer to register values). */
+ to refer to register values).
+
+ CONTEXT provides information to customize the location descriptions
+ generation. Its context_type field specifies what type is implicitly
+ referenced by DW_OP_push_object_address. If it is NULL_TREE, this operation
+ will not be generated.
+
+ If CONTEXT is NULL, the behavior is the same as if both context_type and
+ base_decl fields were NULL_TREE. */
static dw_loc_list_ref
-loc_list_from_tree (tree loc, int want_address)
+loc_list_from_tree (tree loc, int want_address,
+ const struct loc_descr_context *context)
{
dw_loc_descr_ref ret = NULL, ret1 = NULL;
dw_loc_list_ref list_ret = NULL, list_ret1 = NULL;
@@ -14283,6 +14397,17 @@ loc_list_from_tree (tree loc, int want_address)
extending the values properly. Hopefully this won't be a real
problem... */
+ if (context != NULL
+ && context->base_decl == loc
+ && want_address == 0)
+ {
+ if (dwarf_version >= 3 || !dwarf_strict)
+ return new_loc_list (new_loc_descr (DW_OP_push_object_address, 0, 0),
+ NULL, NULL, NULL);
+ else
+ return NULL;
+ }
+
switch (TREE_CODE (loc))
{
case ERROR_MARK:
@@ -14291,11 +14416,26 @@ loc_list_from_tree (tree loc, int want_address)
case PLACEHOLDER_EXPR:
/* This case involves extracting fields from an object to determine the
- position of other fields. We don't try to encode this here. The
- only user of this is Ada, which encodes the needed information using
- the names of types. */
- expansion_failed (loc, NULL_RTX, "PLACEHOLDER_EXPR");
- return 0;
+ position of other fields. It is supposed to appear only as the first
+ operand of COMPONENT_REF nodes and to reference precisely the type
+ that the context allows. */
+ if (context != NULL
+ && TREE_TYPE (loc) == context->context_type
+ && want_address >= 1)
+ {
+ if (dwarf_version >= 3 || !dwarf_strict)
+ {
+ ret = new_loc_descr (DW_OP_push_object_address, 0, 0);
+ have_address = 1;
+ break;
+ }
+ else
+ return NULL;
+ }
+ else
+ expansion_failed (loc, NULL_RTX,
+ "PLACEHOLDER_EXPR for an unexpected type");
+ break;
case CALL_EXPR:
expansion_failed (loc, NULL_RTX, "CALL_EXPR");
@@ -14316,7 +14456,7 @@ loc_list_from_tree (tree loc, int want_address)
if (want_address)
{
list_ret = loc_list_for_address_of_addr_expr_of_indirect_ref
- (loc, want_address == 2);
+ (loc, want_address == 2, context);
if (list_ret)
have_address = 1;
else if (decl_address_ip_invariant_p (TREE_OPERAND (loc, 0))
@@ -14325,7 +14465,7 @@ loc_list_from_tree (tree loc, int want_address)
}
/* Otherwise, process the argument and look for the address. */
if (!list_ret && !ret)
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 1);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 1, context);
else
{
if (want_address)
@@ -14395,7 +14535,7 @@ loc_list_from_tree (tree loc, int want_address)
case RESULT_DECL:
if (DECL_HAS_VALUE_EXPR_P (loc))
return loc_list_from_tree (DECL_VALUE_EXPR (loc),
- want_address);
+ want_address, context);
/* FALLTHRU */
case FUNCTION_DECL:
@@ -14469,7 +14609,7 @@ loc_list_from_tree (tree loc, int want_address)
}
/* Fallthru. */
case INDIRECT_REF:
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0, context);
have_address = 1;
break;
@@ -14478,13 +14618,13 @@ loc_list_from_tree (tree loc, int want_address)
return NULL;
case COMPOUND_EXPR:
- return loc_list_from_tree (TREE_OPERAND (loc, 1), want_address);
+ return loc_list_from_tree (TREE_OPERAND (loc, 1), want_address, context);
CASE_CONVERT:
case VIEW_CONVERT_EXPR:
case SAVE_EXPR:
case MODIFY_EXPR:
- return loc_list_from_tree (TREE_OPERAND (loc, 0), want_address);
+ return loc_list_from_tree (TREE_OPERAND (loc, 0), want_address, context);
case COMPONENT_REF:
case BIT_FIELD_REF:
@@ -14505,7 +14645,8 @@ loc_list_from_tree (tree loc, int want_address)
list_ret = loc_list_from_tree (obj,
want_address == 2
- && !bitpos && !offset ? 2 : 1);
+ && !bitpos && !offset ? 2 : 1,
+ context);
/* TODO: We can extract value of the small expression via shifting even
for nonzero bitpos. */
if (list_ret == 0)
@@ -14520,7 +14661,7 @@ loc_list_from_tree (tree loc, int want_address)
if (offset != NULL_TREE)
{
/* Variable offset. */
- list_ret1 = loc_list_from_tree (offset, 0);
+ list_ret1 = loc_list_from_tree (offset, 0, context);
if (list_ret1 == 0)
return 0;
add_loc_list (&list_ret, list_ret1);
@@ -14610,8 +14751,8 @@ loc_list_from_tree (tree loc, int want_address)
op = DW_OP_mod;
goto do_binop;
}
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
- list_ret1 = loc_list_from_tree (TREE_OPERAND (loc, 1), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0, context);
+ list_ret1 = loc_list_from_tree (TREE_OPERAND (loc, 1), 0, context);
if (list_ret == 0 || list_ret1 == 0)
return 0;
@@ -14642,7 +14783,7 @@ loc_list_from_tree (tree loc, int want_address)
do_plus:
if (tree_fits_shwi_p (TREE_OPERAND (loc, 1)))
{
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0, context);
if (list_ret == 0)
return 0;
@@ -14690,8 +14831,8 @@ loc_list_from_tree (tree loc, int want_address)
goto do_binop;
do_binop:
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
- list_ret1 = loc_list_from_tree (TREE_OPERAND (loc, 1), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0, context);
+ list_ret1 = loc_list_from_tree (TREE_OPERAND (loc, 1), 0, context);
if (list_ret == 0 || list_ret1 == 0)
return 0;
@@ -14715,7 +14856,7 @@ loc_list_from_tree (tree loc, int want_address)
goto do_unop;
do_unop:
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0, context);
if (list_ret == 0)
return 0;
@@ -14739,12 +14880,12 @@ loc_list_from_tree (tree loc, int want_address)
case COND_EXPR:
{
dw_loc_descr_ref lhs
- = loc_descriptor_from_tree (TREE_OPERAND (loc, 1), 0);
+ = loc_descriptor_from_tree (TREE_OPERAND (loc, 1), 0, context);
dw_loc_list_ref rhs
- = loc_list_from_tree (TREE_OPERAND (loc, 2), 0);
+ = loc_list_from_tree (TREE_OPERAND (loc, 2), 0, context);
dw_loc_descr_ref bra_node, jump_node, tmp;
- list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0);
+ list_ret = loc_list_from_tree (TREE_OPERAND (loc, 0), 0, context);
if (list_ret == 0 || lhs == 0 || rhs == 0)
return 0;
@@ -14850,9 +14991,10 @@ loc_list_from_tree (tree loc, int want_address)
/* Same as above but return only single location expression. */
static dw_loc_descr_ref
-loc_descriptor_from_tree (tree loc, int want_address)
+loc_descriptor_from_tree (tree loc, int want_address,
+ const struct loc_descr_context *context)
{
- dw_loc_list_ref ret = loc_list_from_tree (loc, want_address);
+ dw_loc_list_ref ret = loc_list_from_tree (loc, want_address, context);
if (!ret)
return NULL;
if (ret->dw_loc_next)
@@ -15910,7 +16052,8 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p,
}
if (list == NULL)
{
- list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2);
+ list = loc_list_from_tree (decl, decl_by_reference_p (decl) ? 0 : 2,
+ NULL);
/* It is usually worth caching this result if the decl is from
BLOCK_NONLOCALIZED_VARS and if the list has at least two elements. */
if (cache_p && list && list->dw_loc_next)
@@ -16404,6 +16547,143 @@ add_comp_dir_attribute (dw_die_ref die)
add_AT_string (die, DW_AT_comp_dir, wd);
}
+/* Given a tree node VALUE describing a scalar attribute ATTR (i.e. a bound, a
+ pointer computation, ...), output a representation for that bound according
+ to the accepted FORMS (see enum dw_scalar_form) and add it to DIE. See
+ loc_list_from_tree for the meaning of CONTEXT. */
+
+static void
+add_scalar_info (dw_die_ref die, enum dwarf_attribute attr, tree value,
+ int forms, const struct loc_descr_context *context)
+{
+ dw_die_ref ctx, decl_die;
+ dw_loc_list_ref list;
+
+ bool strip_conversions = true;
+
+ while (strip_conversions)
+ switch (TREE_CODE (value))
+ {
+ case ERROR_MARK:
+ case SAVE_EXPR:
+ return;
+
+ CASE_CONVERT:
+ case VIEW_CONVERT_EXPR:
+ value = TREE_OPERAND (value, 0);
+ break;
+
+ default:
+ strip_conversions = false;
+ break;
+ }
+
+ /* If possible and permitted, output the attribute as a constant. */
+ if ((forms & dw_scalar_form_constant) != 0
+ && TREE_CODE (value) == INTEGER_CST)
+ {
+ unsigned int prec = simple_type_size_in_bits (TREE_TYPE (value));
+
+ /* If HOST_WIDE_INT is big enough then represent the bound as
+ a constant value. We need to choose a form based on
+ whether the type is signed or unsigned. We cannot just
+ call add_AT_unsigned if the value itself is positive
+ (add_AT_unsigned might add the unsigned value encoded as
+ DW_FORM_data[1248]). Some DWARF consumers will lookup the
+ bounds type and then sign extend any unsigned values found
+ for signed types. This is needed only for
+ DW_AT_{lower,upper}_bound, since for most other attributes,
+ consumers will treat DW_FORM_data[1248] as unsigned values,
+ regardless of the underlying type. */
+ if (prec <= HOST_BITS_PER_WIDE_INT
+ || tree_fits_uhwi_p (value))
+ {
+ if (TYPE_UNSIGNED (TREE_TYPE (value)))
+ add_AT_unsigned (die, attr, TREE_INT_CST_LOW (value));
+ else
+ add_AT_int (die, attr, TREE_INT_CST_LOW (value));
+ }
+ else
+ /* Otherwise represent the bound as an unsigned value with
+ the precision of its type. The precision and signedness
+ of the type will be necessary to re-interpret it
+ unambiguously. */
+ add_AT_wide (die, attr, value);
+ return;
+ }
+
+ /* Otherwise, if it's possible and permitted too, output a reference to
+ another DIE. */
+ if ((forms & dw_scalar_form_reference) != 0)
+ {
+ tree decl = NULL_TREE;
+
+ /* Some type attributes reference an outer type. For instance, the upper
+ bound of an array may reference an embedding record (this happens in
+ Ada). */
+ if (TREE_CODE (value) == COMPONENT_REF
+ && TREE_CODE (TREE_OPERAND (value, 0)) == PLACEHOLDER_EXPR
+ && TREE_CODE (TREE_OPERAND (value, 1)) == FIELD_DECL)
+ decl = TREE_OPERAND (value, 1);
+
+ else if (TREE_CODE (value) == VAR_DECL
+ || TREE_CODE (value) == PARM_DECL
+ || TREE_CODE (value) == RESULT_DECL)
+ decl = value;
+
+ if (decl != NULL_TREE)
+ {
+ dw_die_ref decl_die = lookup_decl_die (decl);
+
+ /* ??? Can this happen, or should the variable have been bound
+ first? Probably it can, since I imagine that we try to create
+ the types of parameters in the order in which they exist in
+ the list, and won't have created a forward reference to a
+ later parameter. */
+ if (decl_die != NULL)
+ {
+ add_AT_die_ref (die, attr, decl_die);
+ return;
+ }
+ }
+ }
+
+ /* Last chance: try to create a stack operation procedure to evaluate the
+ value. Do nothing if even that is not possible or permitted. */
+ if ((forms & dw_scalar_form_exprloc) == 0)
+ return;
+
+ list = loc_list_from_tree (value, 2, context);
+ if (list == NULL || single_element_loc_list_p (list))
+ {
+ /* If this attribute is not a reference nor constant, it is
+ a DWARF expression rather than location description. For that
+ loc_list_from_tree (value, 0, &context) is needed. */
+ dw_loc_list_ref list2 = loc_list_from_tree (value, 0, context);
+ if (list2 && single_element_loc_list_p (list2))
+ {
+ add_AT_loc (die, attr, list2->expr);
+ return;
+ }
+ }
+
+ /* If that failed to give a single element location list, fall back to
+ outputting this as a reference... still if permitted. */
+ if (list == NULL || (forms & dw_scalar_form_reference) == 0)
+ return;
+
+ if (current_function_decl == 0)
+ ctx = comp_unit_die ();
+ else
+ ctx = lookup_decl_die (current_function_decl);
+
+ decl_die = new_die (DW_TAG_variable, ctx, value);
+ add_AT_flag (decl_die, DW_AT_artificial, 1);
+ add_type_attribute (decl_die, TREE_TYPE (value), TYPE_QUAL_CONST, ctx);
+ add_AT_location_description (decl_die, DW_AT_location, list);
+ add_AT_die_ref (die, attr, decl_die);
+}
+
/* Return the default for DW_AT_lower_bound, or -1 if there is not any
default. */
@@ -16448,121 +16728,41 @@ lower_bound_default (void)
a representation for that bound. */
static void
-add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr, tree bound)
+add_bound_info (dw_die_ref subrange_die, enum dwarf_attribute bound_attr,
+ tree bound, const struct loc_descr_context *context)
{
- switch (TREE_CODE (bound))
- {
- case ERROR_MARK:
- return;
+ int dflt;
- /* All fixed-bounds are represented by INTEGER_CST nodes. */
- case INTEGER_CST:
+ while (1)
+ switch (TREE_CODE (bound))
{
- unsigned int prec = simple_type_size_in_bits (TREE_TYPE (bound));
- int dflt;
+ /* Strip all conversions. */
+ CASE_CONVERT:
+ case VIEW_CONVERT_EXPR:
+ bound = TREE_OPERAND (bound, 0);
+ break;
- /* Use the default if possible. */
+ /* All fixed-bounds are represented by INTEGER_CST nodes. Lower bounds
+ are even omitted when they are the default. */
+ case INTEGER_CST:
+ /* If the value for this bound is the default one, we can even omit the
+ attribute. */
if (bound_attr == DW_AT_lower_bound
&& tree_fits_shwi_p (bound)
&& (dflt = lower_bound_default ()) != -1
&& tree_to_shwi (bound) == dflt)
- ;
-
- /* If HOST_WIDE_INT is big enough then represent the bound as
- a constant value. We need to choose a form based on
- whether the type is signed or unsigned. We cannot just
- call add_AT_unsigned if the value itself is positive
- (add_AT_unsigned might add the unsigned value encoded as
- DW_FORM_data[1248]). Some DWARF consumers will lookup the
- bounds type and then sign extend any unsigned values found
- for signed types. This is needed only for
- DW_AT_{lower,upper}_bound, since for most other attributes,
- consumers will treat DW_FORM_data[1248] as unsigned values,
- regardless of the underlying type. */
- else if (prec <= HOST_BITS_PER_WIDE_INT
- || tree_fits_uhwi_p (bound))
- {
- if (TYPE_UNSIGNED (TREE_TYPE (bound)))
- add_AT_unsigned (subrange_die, bound_attr,
- TREE_INT_CST_LOW (bound));
- else
- add_AT_int (subrange_die, bound_attr, TREE_INT_CST_LOW (bound));
- }
- else
- /* Otherwise represent the bound as an unsigned value with
- the precision of its type. The precision and signedness
- of the type will be necessary to re-interpret it
- unambiguously. */
- add_AT_wide (subrange_die, bound_attr, bound);
- }
- break;
-
- CASE_CONVERT:
- case VIEW_CONVERT_EXPR:
- add_bound_info (subrange_die, bound_attr, TREE_OPERAND (bound, 0));
- break;
-
- case SAVE_EXPR:
- break;
-
- case VAR_DECL:
- case PARM_DECL:
- case RESULT_DECL:
- {
- dw_die_ref decl_die = lookup_decl_die (bound);
-
- /* ??? Can this happen, or should the variable have been bound
- first? Probably it can, since I imagine that we try to create
- the types of parameters in the order in which they exist in
- the list, and won't have created a forward reference to a
- later parameter. */
- if (decl_die != NULL)
- {
- add_AT_die_ref (subrange_die, bound_attr, decl_die);
- break;
- }
- }
- /* FALLTHRU */
-
- default:
- {
- /* Otherwise try to create a stack operation procedure to
- evaluate the value of the array bound. */
-
- dw_die_ref ctx, decl_die;
- dw_loc_list_ref list;
-
- list = loc_list_from_tree (bound, 2);
- if (list == NULL || single_element_loc_list_p (list))
- {
- /* If DW_AT_*bound is not a reference nor constant, it is
- a DWARF expression rather than location description.
- For that loc_list_from_tree (bound, 0) is needed.
- If that fails to give a single element list,
- fall back to outputting this as a reference anyway. */
- dw_loc_list_ref list2 = loc_list_from_tree (bound, 0);
- if (list2 && single_element_loc_list_p (list2))
- {
- add_AT_loc (subrange_die, bound_attr, list2->expr);
- break;
- }
- }
- if (list == NULL)
- break;
+ return;
- if (current_function_decl == 0)
- ctx = comp_unit_die ();
- else
- ctx = lookup_decl_die (current_function_decl);
+ /* FALLTHRU */
- decl_die = new_die (DW_TAG_variable, ctx, bound);
- add_AT_flag (decl_die, DW_AT_artificial, 1);
- add_type_attribute (decl_die, TREE_TYPE (bound), TYPE_QUAL_CONST, ctx);
- add_AT_location_description (decl_die, DW_AT_location, list);
- add_AT_die_ref (subrange_die, bound_attr, decl_die);
- break;
+ default:
+ add_scalar_info (subrange_die, bound_attr, bound,
+ dw_scalar_form_constant
+ | dw_scalar_form_exprloc
+ | dw_scalar_form_reference,
+ context);
+ return;
}
- }
}
/* Add subscript info to TYPE_DIE, describing an array TYPE, collapsing
@@ -16619,9 +16819,9 @@ add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p)
to produce useful results, go ahead and output the lower
bound solo, and hope the debugger can cope. */
- add_bound_info (subrange_die, DW_AT_lower_bound, lower);
+ add_bound_info (subrange_die, DW_AT_lower_bound, lower, NULL);
if (upper)
- add_bound_info (subrange_die, DW_AT_upper_bound, upper);
+ add_bound_info (subrange_die, DW_AT_upper_bound, upper, NULL);
}
/* Otherwise we have an array type with an unspecified length. The
@@ -17290,7 +17490,7 @@ gen_array_type_die (tree type, dw_die_ref context_die)
&& DECL_P (TYPE_MAX_VALUE (TYPE_DOMAIN (type))))
{
tree szdecl = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
- dw_loc_list_ref loc = loc_list_from_tree (szdecl, 2);
+ dw_loc_list_ref loc = loc_list_from_tree (szdecl, 2, NULL);
size = int_size_in_bytes (TREE_TYPE (szdecl));
if (loc && size > 0)
@@ -17332,9 +17532,9 @@ gen_array_type_die (tree type, dw_die_ref context_die)
{
/* For VECTOR_TYPEs we use an array die with appropriate bounds. */
dw_die_ref subrange_die = new_die (DW_TAG_subrange_type, array_die, NULL);
- add_bound_info (subrange_die, DW_AT_lower_bound, size_zero_node);
+ add_bound_info (subrange_die, DW_AT_lower_bound, size_zero_node, NULL);
add_bound_info (subrange_die, DW_AT_upper_bound,
- size_int (TYPE_VECTOR_SUBPARTS (type) - 1));
+ size_int (TYPE_VECTOR_SUBPARTS (type) - 1), NULL);
}
else
add_subscript_info (array_die, type, collapse_nested_arrays);
@@ -17360,99 +17560,6 @@ gen_array_type_die (tree type, dw_die_ref context_die)
add_pubtype (type, array_die);
}
-static dw_loc_descr_ref
-descr_info_loc (tree val, tree base_decl)
-{
- HOST_WIDE_INT size;
- dw_loc_descr_ref loc, loc2;
- enum dwarf_location_atom op;
-
- if (val == base_decl)
- return new_loc_descr (DW_OP_push_object_address, 0, 0);
-
- switch (TREE_CODE (val))
- {
- CASE_CONVERT:
- return descr_info_loc (TREE_OPERAND (val, 0), base_decl);
- case VAR_DECL:
- return loc_descriptor_from_tree (val, 0);
- case INTEGER_CST:
- if (tree_fits_shwi_p (val))
- return int_loc_descriptor (tree_to_shwi (val));
- break;
- case INDIRECT_REF:
- size = int_size_in_bytes (TREE_TYPE (val));
- if (size < 0)
- break;
- loc = descr_info_loc (TREE_OPERAND (val, 0), base_decl);
- if (!loc)
- break;
- if (size == DWARF2_ADDR_SIZE)
- add_loc_descr (&loc, new_loc_descr (DW_OP_deref, 0, 0));
- else
- add_loc_descr (&loc, new_loc_descr (DW_OP_deref_size, size, 0));
- return loc;
- case POINTER_PLUS_EXPR:
- case PLUS_EXPR:
- if (tree_fits_uhwi_p (TREE_OPERAND (val, 1))
- && tree_to_uhwi (TREE_OPERAND (val, 1)) < 16384)
- {
- loc = descr_info_loc (TREE_OPERAND (val, 0), base_decl);
- if (!loc)
- break;
- loc_descr_plus_const (&loc, tree_to_shwi (TREE_OPERAND (val, 1)));
- }
- else
- {
- op = DW_OP_plus;
- do_binop:
- loc = descr_info_loc (TREE_OPERAND (val, 0), base_decl);
- if (!loc)
- break;
- loc2 = descr_info_loc (TREE_OPERAND (val, 1), base_decl);
- if (!loc2)
- break;
- add_loc_descr (&loc, loc2);
- add_loc_descr (&loc2, new_loc_descr (op, 0, 0));
- }
- return loc;
- case MINUS_EXPR:
- op = DW_OP_minus;
- goto do_binop;
- case MULT_EXPR:
- op = DW_OP_mul;
- goto do_binop;
- case EQ_EXPR:
- op = DW_OP_eq;
- goto do_binop;
- case NE_EXPR:
- op = DW_OP_ne;
- goto do_binop;
- default:
- break;
- }
- return NULL;
-}
-
-static void
-add_descr_info_field (dw_die_ref die, enum dwarf_attribute attr,
- tree val, tree base_decl)
-{
- dw_loc_descr_ref loc;
-
- if (tree_fits_shwi_p (val))
- {
- add_AT_unsigned (die, attr, tree_to_shwi (val));
- return;
- }
-
- loc = descr_info_loc (val, base_decl);
- if (!loc)
- return;
-
- add_AT_loc (die, attr, loc);
-}
-
/* This routine generates DIE for array with hidden descriptor, details
are filled into *info by a langhook. */
@@ -17460,56 +17567,68 @@ static void
gen_descr_array_type_die (tree type, struct array_descr_info *info,
dw_die_ref context_die)
{
- dw_die_ref scope_die = scope_die_for (type, context_die);
- dw_die_ref array_die;
+ const dw_die_ref scope_die = scope_die_for (type, context_die);
+ const dw_die_ref array_die = new_die (DW_TAG_array_type, scope_die, type);
+ const struct loc_descr_context context = { type, info->base_decl };
int dim;
- array_die = new_die (DW_TAG_array_type, scope_die, type);
add_name_attribute (array_die, type_tag (type));
equate_type_number_to_die (type, array_die);
- /* For Fortran multidimensional arrays use DW_ORD_col_major ordering. */
- if (is_fortran ()
- && info->ndimensions >= 2)
- add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_col_major);
+ if (info->ndimensions > 1)
+ switch (info->ordering)
+ {
+ case array_descr_ordering_row_major:
+ add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_row_major);
+ break;
+ case array_descr_ordering_column_major:
+ add_AT_unsigned (array_die, DW_AT_ordering, DW_ORD_col_major);
+ break;
+ default:
+ break;
+ }
- if (info->data_location)
- add_descr_info_field (array_die, DW_AT_data_location, info->data_location,
- info->base_decl);
- if (info->associated)
- add_descr_info_field (array_die, DW_AT_associated, info->associated,
- info->base_decl);
- if (info->allocated)
- add_descr_info_field (array_die, DW_AT_allocated, info->allocated,
- info->base_decl);
+ if (dwarf_version >= 3 || !dwarf_strict)
+ {
+ if (info->data_location)
+ add_scalar_info (array_die, DW_AT_data_location, info->data_location,
+ dw_scalar_form_exprloc, &context);
+ if (info->associated)
+ add_scalar_info (array_die, DW_AT_associated, info->associated,
+ dw_scalar_form_constant
+ | dw_scalar_form_exprloc
+ | dw_scalar_form_reference, &context);
+ if (info->allocated)
+ add_scalar_info (array_die, DW_AT_allocated, info->allocated,
+ dw_scalar_form_constant
+ | dw_scalar_form_exprloc
+ | dw_scalar_form_reference, &context);
+ }
+
+ add_gnat_descriptive_type_attribute (array_die, type, context_die);
for (dim = 0; dim < info->ndimensions; dim++)
{
dw_die_ref subrange_die
= new_die (DW_TAG_subrange_type, array_die, NULL);
+ if (info->dimen[dim].bounds_type)
+ add_type_attribute (subrange_die,
+ info->dimen[dim].bounds_type, 0,
+ context_die);
if (info->dimen[dim].lower_bound)
- {
- /* If it is the default value, omit it. */
- int dflt;
-
- if (tree_fits_shwi_p (info->dimen[dim].lower_bound)
- && (dflt = lower_bound_default ()) != -1
- && tree_to_shwi (info->dimen[dim].lower_bound) == dflt)
- ;
- else
- add_descr_info_field (subrange_die, DW_AT_lower_bound,
- info->dimen[dim].lower_bound,
- info->base_decl);
- }
+ add_bound_info (subrange_die, DW_AT_lower_bound,
+ info->dimen[dim].lower_bound, &context);
if (info->dimen[dim].upper_bound)
- add_descr_info_field (subrange_die, DW_AT_upper_bound,
- info->dimen[dim].upper_bound,
- info->base_decl);
- if (info->dimen[dim].stride)
- add_descr_info_field (subrange_die, DW_AT_byte_stride,
- info->dimen[dim].stride,
- info->base_decl);
+ add_bound_info (subrange_die, DW_AT_upper_bound,
+ info->dimen[dim].upper_bound, &context);
+ if ((dwarf_version >= 3 || !dwarf_strict) && info->dimen[dim].stride)
+ add_scalar_info (subrange_die, DW_AT_byte_stride,
+ info->dimen[dim].stride,
+ dw_scalar_form_constant
+ | dw_scalar_form_exprloc
+ | dw_scalar_form_reference,
+ &context);
}
gen_type_die (info->element_type, context_die);
@@ -18576,7 +18695,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
if (fun->static_chain_decl)
add_AT_location_description (subr_die, DW_AT_static_link,
- loc_list_from_tree (fun->static_chain_decl, 2));
+ loc_list_from_tree (fun->static_chain_decl, 2, NULL));
}
/* Generate child dies for template paramaters. */
@@ -18905,7 +19024,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
{
if (get_AT (var_die, DW_AT_location) == NULL)
{
- loc = loc_list_from_tree (com_decl, off ? 1 : 2);
+ loc = loc_list_from_tree (com_decl, off ? 1 : 2, NULL);
if (loc)
{
if (off)
@@ -18937,7 +19056,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
com_die_arg.decl_id = DECL_UID (com_decl);
com_die_arg.die_parent = context_die;
com_die = common_block_die_table->find (&com_die_arg);
- loc = loc_list_from_tree (com_decl, 2);
+ loc = loc_list_from_tree (com_decl, 2, NULL);
if (com_die == NULL)
{
const char *cnam
@@ -18951,7 +19070,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
add_AT_location_description (com_die, DW_AT_location, loc);
/* Avoid sharing the same loc descriptor between
DW_TAG_common_block and DW_TAG_variable. */
- loc = loc_list_from_tree (com_decl, 2);
+ loc = loc_list_from_tree (com_decl, 2, NULL);
}
else if (DECL_EXTERNAL (decl))
add_AT_flag (com_die, DW_AT_declaration, 1);
@@ -18964,7 +19083,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
else if (get_AT (com_die, DW_AT_location) == NULL && loc)
{
add_AT_location_description (com_die, DW_AT_location, loc);
- loc = loc_list_from_tree (com_decl, 2);
+ loc = loc_list_from_tree (com_decl, 2, NULL);
remove_AT (com_die, DW_AT_declaration);
}
var_die = new_die (DW_TAG_variable, com_die, decl);
@@ -20097,17 +20216,6 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
return;
}
- /* If this is an array type with hidden descriptor, handle it first. */
- if (!TREE_ASM_WRITTEN (type)
- && lang_hooks.types.get_array_descr_info
- && lang_hooks.types.get_array_descr_info (type, &info)
- && (dwarf_version >= 3 || !dwarf_strict))
- {
- gen_descr_array_type_die (type, &info, context_die);
- TREE_ASM_WRITTEN (type) = 1;
- return;
- }
-
/* We are going to output a DIE to represent the unqualified version
of this type (i.e. without any const or volatile qualifiers) so
get the main variant (i.e. the unqualified version) of this type
@@ -20116,6 +20224,19 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die,
if (TREE_CODE (type) != VECTOR_TYPE)
type = type_main_variant (type);
+ /* If this is an array type with hidden descriptor, handle it first. */
+ if (!TREE_ASM_WRITTEN (type)
+ && lang_hooks.types.get_array_descr_info)
+ {
+ memset (&info, 0, sizeof (info));
+ if (lang_hooks.types.get_array_descr_info (type, &info))
+ {
+ gen_descr_array_type_die (type, &info, context_die);
+ TREE_ASM_WRITTEN (type) = 1;
+ return;
+ }
+ }
+
if (TREE_ASM_WRITTEN (type))
return;
diff --git a/gcc/dwarf2out.h b/gcc/dwarf2out.h
index a10cee8..a61f587 100644
--- a/gcc/dwarf2out.h
+++ b/gcc/dwarf2out.h
@@ -254,6 +254,7 @@ extern void dwarf2out_emit_cfi (dw_cfi_ref cfi);
extern void debug_dwarf (void);
struct die_struct;
extern void debug_dwarf_die (struct die_struct *);
+extern void debug_dwarf_loc_descr (dw_loc_descr_ref);
extern void debug (die_struct &ref);
extern void debug (die_struct *ptr);
extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
@@ -261,9 +262,17 @@ extern void dwarf2out_set_demangle_name_func (const char *(*) (const char *));
extern void dwarf2out_vms_debug_main_pointer (void);
#endif
+enum array_descr_ordering
+{
+ array_descr_ordering_default,
+ array_descr_ordering_row_major,
+ array_descr_ordering_column_major
+};
+
struct array_descr_info
{
int ndimensions;
+ enum array_descr_ordering ordering;
tree element_type;
tree base_decl;
tree data_location;
@@ -271,6 +280,10 @@ struct array_descr_info
tree associated;
struct array_descr_dimen
{
+ /* GCC uses sizetype for array indices, so lower_bound and upper_bound
+ will likely be "sizetype" values. However, bounds may have another
+ type in the original source code. */
+ tree bounds_type;
tree lower_bound;
tree upper_bound;
tree stride;
diff --git a/gcc/fibonacci_heap.h b/gcc/fibonacci_heap.h
index 3fce370..5bbde26 100644
--- a/gcc/fibonacci_heap.h
+++ b/gcc/fibonacci_heap.h
@@ -211,7 +211,7 @@ public:
if (m_min == NULL)
return NULL;
- return m_min->data;
+ return m_min->m_data;
}
/* Replace data associated with NODE and replace it with DATA. */
diff --git a/gcc/flag-types.h b/gcc/flag-types.h
index 52ff7ee..81e8fb8 100644
--- a/gcc/flag-types.h
+++ b/gcc/flag-types.h
@@ -263,4 +263,38 @@ enum lto_partition_model {
LTO_PARTITION_MAX = 4
};
+
+/* gfortran -finit-real= values. */
+
+enum gfc_init_local_real
+{
+ GFC_INIT_REAL_OFF = 0,
+ GFC_INIT_REAL_ZERO,
+ GFC_INIT_REAL_NAN,
+ GFC_INIT_REAL_SNAN,
+ GFC_INIT_REAL_INF,
+ GFC_INIT_REAL_NEG_INF
+};
+
+/* gfortran -fcoarray= values. */
+
+enum gfc_fcoarray
+{
+ GFC_FCOARRAY_NONE = 0,
+ GFC_FCOARRAY_SINGLE,
+ GFC_FCOARRAY_LIB
+};
+
+
+/* gfortran -fconvert= values; used for unformatted I/O.
+ Keep in sync with GFC_CONVERT_* in gcc/fortran/libgfortran.h. */
+enum gfc_convert
+{
+ GFC_FLAG_CONVERT_NATIVE = 0,
+ GFC_FLAG_CONVERT_SWAP,
+ GFC_FLAG_CONVERT_BIG,
+ GFC_FLAG_CONVERT_LITTLE
+};
+
+
#endif /* ! GCC_FLAG_TYPES_H */
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 83f2aba..067b133 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,121 @@
+2014-12-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/64173
+ * trans-array.c (structure_alloc_comps): Do not nullify procedure
+ pointer components.
+
+2014-12-17 Pierre-Marie de Rodat <derodat@adacore.com>
+
+ * trans-types.c (gfc_get_array_descr_info): Describe all Fortran arrays
+ with column major ordering.
+
+2014-12-17 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54687
+ * gfortran.h (gfc_option_t): Remove flags which now
+ have a Var().
+ (init_local_real, gfc_fcoarray): Moved to ../flag-types.h.
+ * libgfortran.h (unit_convert): Add comment.
+ * lang.opt (flag-convert, flag-init_real, flag-coarray):
+ Add Var() and Enum().
+ * options.c (gfc_handle_coarray_option): Remove.
+ (gfc_init_options, gfc_post_options, gfc_handle_option):
+ Update for *.opt changes.
+ * array.c: Update for flag-variable name changes.
+ * check.c: Ditto.
+ * match.c: Ditto.
+ * resolve.c: Ditto.
+ * simplify.c: Ditto.
+ * trans-array.c: Ditto.
+ * trans-decl.c: Ditto.
+ * trans-expr.c: Ditto.
+ * trans-intrinsic.c: Ditto.
+ * trans-stmt.c: Ditto.
+ * trans-types.c: Ditto.
+ * trans.c: Ditto.
+
+2014-12-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54687
+ * gfortran.h (gfc_option_t): Remove flags which now
+ have a Var().
+ * lang.opt (flag-aggressive_function_elimination,
+ flag-align_commons, flag-all_intrinsics,
+ flag-allow_leading_underscore, flag-automatic, flag-backslash,
+ flag-backtrace, flag-blas_matmul_limit, flag-cray_pointer,
+ flag-dollar_ok, flag-dump_fortran_original,
+ flag-dump_fortran_optimized, flag-external_blas, flag-f2c,
+ flag-implicit_none, flag-max_array_constructor,
+ flag-module_private, flag-pack_derived, flag-range_check,
+ flag-recursive, flag-repack_arrays, flag-sign_zero,
+ flag-underscoring): Add Var() and, where applicable, Enum().
+ * options.c (gfc_init_options, gfc_post_options,
+ gfc_handle_option): Update for *.opt changes.
+ * arith.c: Update for flag-variable name changes.
+ * array.c: Ditto.
+ * cpp.c: Ditto.
+ * decl.c: Ditto.
+ * expr.c: Ditto.
+ * f95-lang.c: Ditto.
+ * frontend-passes.c: Ditto.
+ * intrinsic.c: Ditto.
+ * io.c: Ditto.
+ * match.c: Ditto.
+ * module.c: Ditto.
+ * parse.c: Ditto.
+ * primary.c: Ditto.
+ * resolve.c: Ditto.
+ * scanner.c: Ditto.
+ * simplify.c: Ditto.
+ * symbol.c: Ditto.
+ * trans-array.c: Ditto.
+ * trans-common.c: Ditto.
+ * trans-decl.c: Ditto.
+ * trans-expr.c: Ditto.
+ * trans-intrinsic.c: Ditto.
+ * trans-openmp.c: Ditto.
+ * trans-types.c: Ditto.
+
+2014-12-16 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54687
+ * lang.opt (fsecond-underscore, frecord-marker=8, frecord-marker=4,
+ frealloc-lhs, freal-8-real-16, freal-8-real-10, freal-8-real-4,
+ freal-4-real-16, freal-4-real-10, freal-4-real-8, fprotect-parens,
+ fstack-arrays, fmax-stack-var-size=, fmax-subrecord-length=,
+ ffrontend-optimize, ffree-line-length-, ffixed-line-length-,
+ finteger-4-integer-8, fdefault-real-8, fdefault-integer-8,
+ fdefault-double-8): Add Var() and Init().
+ * gfortran.h (gfc_option_t): Remove moved flags.
+ * options.c (gfc_init_options, gfc_handle_option): Ditto.
+ (gfc_post_options): Update for name change.
+ * decl.c (gfc_match_old_kind_spec, gfc_match_kind_spec): Handle
+ flag-name change.
+ * frontend-passes.c (gfc_run_passes): Ditto.
+ * module.c (use_iso_fortran_env_module): Ditto.
+ * primary.c (match_integer_constant, match_real_constant): Ditto.
+ * resolve.c (resolve_ordinary_assign): Ditto.
+ * scanner.c (gfc_next_char_literal, load_line): Ditto.
+ * trans-array.c (gfc_trans_allocate_array_storage,
+ gfc_conv_resolve_dependencies, gfc_trans_auto_array_allocation,
+ gfc_conv_ss_startstride): Ditto.
+ * trans-common.c (gfc_sym_mangled_common_id): Ditto.
+ * trans-decl.c (gfc_sym_mangled_function_id,
+ create_main_function): Ditto.
+ * trans-expr.c (gfc_conv_expr_op, gfc_conv_procedure_call,
+ arrayfunc_assign_needs_temporary, gfc_trans_arrayfunc_assign,
+ gfc_trans_assignment_1): Ditto.
+ * trans-stmt.c (gfc_trans_allocate): Ditto.
+ * trans-types.c (gfc_init_kinds): Ditto.
+
+2014-12-16 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/64244
+ * resolve.c (resolve_typebound_call): New argument to pass out the
+ non-overridable attribute of the specific procedure.
+ (resolve_typebound_subroutine): Get overridable flag from
+ resolve_typebound_call.
+
2014-12-15 Steven Bosscher <steven@gcc.gnu.org>
PR fortran/61669
diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c
index 6394547..e8a5efe 100644
--- a/gcc/fortran/arith.c
+++ b/gcc/fortran/arith.c
@@ -301,7 +301,7 @@ gfc_check_integer_range (mpz_t p, int kind)
}
- if (gfc_option.flag_range_check == 0)
+ if (flag_range_check == 0)
return result;
if (mpz_cmp (p, gfc_integer_kinds[i].min_int) < 0
@@ -333,12 +333,12 @@ gfc_check_real_range (mpfr_t p, int kind)
if (mpfr_inf_p (p))
{
- if (gfc_option.flag_range_check != 0)
+ if (flag_range_check != 0)
retval = ARITH_OVERFLOW;
}
else if (mpfr_nan_p (p))
{
- if (gfc_option.flag_range_check != 0)
+ if (flag_range_check != 0)
retval = ARITH_NAN;
}
else if (mpfr_sgn (q) == 0)
@@ -348,14 +348,14 @@ gfc_check_real_range (mpfr_t p, int kind)
}
else if (mpfr_cmp (q, gfc_real_kinds[i].huge) > 0)
{
- if (gfc_option.flag_range_check == 0)
+ if (flag_range_check == 0)
mpfr_set_inf (p, mpfr_sgn (p));
else
retval = ARITH_OVERFLOW;
}
else if (mpfr_cmp (q, gfc_real_kinds[i].subnormal) < 0)
{
- if (gfc_option.flag_range_check == 0)
+ if (flag_range_check == 0)
{
if (mpfr_sgn (p) < 0)
{
@@ -736,7 +736,7 @@ gfc_arith_divide (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
break;
case BT_REAL:
- if (mpfr_sgn (op2->value.real) == 0 && gfc_option.flag_range_check == 1)
+ if (mpfr_sgn (op2->value.real) == 0 && flag_range_check == 1)
{
rc = ARITH_DIV0;
break;
@@ -748,7 +748,7 @@ gfc_arith_divide (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
case BT_COMPLEX:
if (mpc_cmp_si_si (op2->value.complex, 0, 0) == 0
- && gfc_option.flag_range_check == 1)
+ && flag_range_check == 1)
{
rc = ARITH_DIV0;
break;
@@ -863,7 +863,7 @@ arith_power (gfc_expr *op1, gfc_expr *op2, gfc_expr **resultp)
int i;
i = gfc_validate_kind (BT_INTEGER, result->ts.kind, false);
- if (gfc_option.flag_range_check)
+ if (flag_range_check)
rc = ARITH_OVERFLOW;
/* Still, we want to give the same value as the
@@ -1978,7 +1978,7 @@ gfc_int2int (gfc_expr *src, int kind)
/* If we do not trap numeric overflow, we need to convert the number to
signed, throwing away high-order bits if necessary. */
- if (gfc_option.flag_range_check == 0)
+ if (flag_range_check == 0)
{
int k;
diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 300bfeb..e60b938 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
+#include "flags.h"
#include "gfortran.h"
#include "match.h"
#include "constructor.h"
@@ -207,7 +208,7 @@ coarray:
return MATCH_ERROR;
}
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return MATCH_ERROR;
@@ -590,7 +591,7 @@ coarray:
if (!gfc_notify_std (GFC_STD_F2008, "Coarray declaration at %C"))
goto cleanup;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
goto cleanup;
@@ -1654,7 +1655,7 @@ gfc_expand_constructor (gfc_expr *e, bool fatal)
/* If we can successfully get an array element at the max array size then
the array is too big to expand, so we just return. */
- f = gfc_get_array_element (e, gfc_option.flag_max_array_constructor);
+ f = gfc_get_array_element (e, flag_max_array_constructor);
if (f != NULL)
{
gfc_free_expr (f);
@@ -1663,8 +1664,7 @@ gfc_expand_constructor (gfc_expr *e, bool fatal)
gfc_error ("The number of elements in the array constructor "
"at %L requires an increase of the allowed %d "
"upper limit. See %<-fmax-array-constructor%> "
- "option", &e->where,
- gfc_option.flag_max_array_constructor);
+ "option", &e->where, flag_max_array_constructor);
return false;
}
return true;
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 527123d..95c5223 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -1481,7 +1481,7 @@ check_co_collective (gfc_expr *a, gfc_expr *image_idx, gfc_expr *stat,
}
}
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %L, use %<-fcoarray=%> to enable",
&a->where);
@@ -2569,7 +2569,7 @@ gfc_check_lbound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
bool
gfc_check_lcobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
@@ -4847,7 +4847,7 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub)
{
mpz_t nelems;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
@@ -4885,7 +4885,7 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub)
bool
gfc_check_num_images (gfc_expr *distance, gfc_expr *failed)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
@@ -4927,7 +4927,7 @@ gfc_check_num_images (gfc_expr *distance, gfc_expr *failed)
bool
gfc_check_this_image (gfc_expr *coarray, gfc_expr *dim, gfc_expr *distance)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
@@ -5126,7 +5126,7 @@ gfc_check_ubound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind)
bool
gfc_check_ucobound (gfc_expr *coarray, gfc_expr *dim, gfc_expr *kind)
{
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return false;
diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c
index 090e209..70f83ee 100644
--- a/gcc/fortran/cpp.c
+++ b/gcc/fortran/cpp.c
@@ -170,7 +170,7 @@ cpp_define_builtins (cpp_reader *pfile)
cpp_define (pfile, "__GFORTRAN__=1");
cpp_define (pfile, "_LANGUAGE_FORTRAN=1");
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
cpp_define (pfile, "_OPENMP=201307");
/* The defines below are necessary for the TARGET_* macros.
@@ -470,7 +470,7 @@ gfc_cpp_post_options (void)
cpp_option->cpp_pedantic = pedantic;
- cpp_option->dollars_in_ident = gfc_option.flag_dollar_ok;
+ cpp_option->dollars_in_ident = flag_dollar_ok;
cpp_option->discard_comments = gfc_cpp_option.discard_comments;
cpp_option->discard_comments_in_macro_exp = gfc_cpp_option.discard_comments_in_macro_exp;
cpp_option->print_include_names = gfc_cpp_option.print_include_names;
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 28a7aca..8d01c45 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1852,7 +1852,7 @@ variable_decl (int elem)
goto cleanup;
}
- if (gfc_option.flag_cray_pointer)
+ if (flag_cray_pointer)
cp_as = gfc_copy_array_spec (as);
/* At this point, we know for sure if the symbol is PARAMETER and can thus
@@ -1921,7 +1921,7 @@ variable_decl (int elem)
/* If this symbol has already shown up in a Cray Pointer declaration,
and this is not a component declaration,
then we want to set the type & bail out. */
- if (gfc_option.flag_cray_pointer && gfc_current_state () != COMP_DERIVED)
+ if (flag_cray_pointer && gfc_current_state () != COMP_DERIVED)
{
gfc_find_symbol (name, gfc_current_ns, 1, &sym);
if (sym != NULL && sym->attr.cray_pointee)
@@ -2140,28 +2140,28 @@ gfc_match_old_kind_spec (gfc_typespec *ts)
}
- if (ts->type == BT_INTEGER && ts->kind == 4 && gfc_option.flag_integer4_kind == 8)
+ if (ts->type == BT_INTEGER && ts->kind == 4 && flag_integer4_kind == 8)
ts->kind = 8;
if (ts->type == BT_REAL || ts->type == BT_COMPLEX)
{
if (ts->kind == 4)
{
- if (gfc_option.flag_real4_kind == 8)
+ if (flag_real4_kind == 8)
ts->kind = 8;
- if (gfc_option.flag_real4_kind == 10)
+ if (flag_real4_kind == 10)
ts->kind = 10;
- if (gfc_option.flag_real4_kind == 16)
+ if (flag_real4_kind == 16)
ts->kind = 16;
}
if (ts->kind == 8)
{
- if (gfc_option.flag_real8_kind == 4)
+ if (flag_real8_kind == 4)
ts->kind = 4;
- if (gfc_option.flag_real8_kind == 10)
+ if (flag_real8_kind == 10)
ts->kind = 10;
- if (gfc_option.flag_real8_kind == 16)
+ if (flag_real8_kind == 16)
ts->kind = 16;
}
}
@@ -2311,28 +2311,28 @@ kind_expr:
if(m == MATCH_ERROR)
gfc_current_locus = where;
- if (ts->type == BT_INTEGER && ts->kind == 4 && gfc_option.flag_integer4_kind == 8)
+ if (ts->type == BT_INTEGER && ts->kind == 4 && flag_integer4_kind == 8)
ts->kind = 8;
if (ts->type == BT_REAL || ts->type == BT_COMPLEX)
{
if (ts->kind == 4)
{
- if (gfc_option.flag_real4_kind == 8)
+ if (flag_real4_kind == 8)
ts->kind = 8;
- if (gfc_option.flag_real4_kind == 10)
+ if (flag_real4_kind == 10)
ts->kind = 10;
- if (gfc_option.flag_real4_kind == 16)
+ if (flag_real4_kind == 16)
ts->kind = 16;
}
if (ts->kind == 8)
{
- if (gfc_option.flag_real8_kind == 4)
+ if (flag_real8_kind == 4)
ts->kind = 4;
- if (gfc_option.flag_real8_kind == 10)
+ if (flag_real8_kind == 10)
ts->kind = 10;
- if (gfc_option.flag_real8_kind == 16)
+ if (flag_real8_kind == 16)
ts->kind = 16;
}
}
@@ -6769,7 +6769,7 @@ gfc_match_pointer (void)
gfc_gobble_whitespace ();
if (gfc_peek_ascii_char () == '(')
{
- if (!gfc_option.flag_cray_pointer)
+ if (!flag_cray_pointer)
{
gfc_error ("Cray pointer declaration at %C requires -fcray-pointer "
"flag");
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 5c2a306..a887d4c 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -1530,13 +1530,12 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
}
limit = mpz_get_ui (ptr);
- if (limit >= gfc_option.flag_max_array_constructor)
+ if (limit >= flag_max_array_constructor)
{
gfc_error ("The number of elements in the array constructor "
"at %L requires an increase of the allowed %d "
"upper limit. See -fmax-array-constructor "
- "option", &expr->where,
- gfc_option.flag_max_array_constructor);
+ "option", &expr->where, flag_max_array_constructor);
return false;
}
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 223e938..1054230 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -1139,9 +1139,7 @@ gfc_init_builtin_functions (void)
#include "../sync-builtins.def"
#undef DEF_SYNC_BUILTIN
- if (gfc_option.gfc_flag_openmp
- || gfc_option.gfc_flag_openmp_simd
- || flag_tree_parallelize_loops)
+ if (flag_openmp || flag_openmp_simd || flag_tree_parallelize_loops)
{
#undef DEF_GOMP_BUILTIN
#define DEF_GOMP_BUILTIN(code, name, type, attr) \
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c
index 5485cd1..7d59f2e 100644
--- a/gcc/fortran/frontend-passes.c
+++ b/gcc/fortran/frontend-passes.c
@@ -104,11 +104,11 @@ gfc_run_passes (gfc_namespace *ns)
doloop_warn (ns);
doloop_list.release ();
- if (gfc_option.flag_frontend_optimize)
+ if (flag_frontend_optimize)
{
optimize_namespace (ns);
optimize_reduction (ns);
- if (gfc_option.dump_fortran_optimized)
+ if (flag_dump_fortran_optimized)
gfc_dump_parse_tree (ns, stdout);
expr_array.release ();
@@ -376,7 +376,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED,
temporary variable to hold the intermediate result, but only if
allocation on assignment is active. */
- if ((*e)->rank > 0 && (*e)->shape == NULL && !gfc_option.flag_realloc_lhs)
+ if ((*e)->rank > 0 && (*e)->shape == NULL && !flag_realloc_lhs)
return 0;
/* Skip the test for pure functions if -faggressive-function-elimination
@@ -389,7 +389,7 @@ cfe_register_funcs (gfc_expr **e, int *walk_subtrees ATTRIBUTE_UNUSED,
/* Only eliminate potentially impure functions if the
user specifically requested it. */
- if (!gfc_option.flag_aggressive_function_elimination
+ if (!flag_aggressive_function_elimination
&& !(*e)->value.function.esym->attr.pure
&& !(*e)->value.function.esym->attr.implicit_pure)
return 0;
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index e0e5838..41c6c57 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -599,18 +599,6 @@ enum gfc_isym_id
};
typedef enum gfc_isym_id gfc_isym_id;
-
-typedef enum
-{
- GFC_INIT_REAL_OFF = 0,
- GFC_INIT_REAL_ZERO,
- GFC_INIT_REAL_NAN,
- GFC_INIT_REAL_SNAN,
- GFC_INIT_REAL_INF,
- GFC_INIT_REAL_NEG_INF
-}
-init_local_real;
-
typedef enum
{
GFC_INIT_LOGICAL_OFF = 0,
@@ -635,14 +623,6 @@ init_local_integer;
typedef enum
{
- GFC_FCOARRAY_NONE = 0,
- GFC_FCOARRAY_SINGLE,
- GFC_FCOARRAY_LIB
-}
-gfc_fcoarray;
-
-typedef enum
-{
GFC_ENABLE_REVERSE,
GFC_FORWARD_SET,
GFC_REVERSE_SET,
@@ -2426,79 +2406,26 @@ typedef struct
{
char *module_dir;
gfc_source_form source_form;
- /* Maximum line lengths in fixed- and free-form source, respectively.
- When fixed_line_length or free_line_length are 0, the whole line is used,
- regardless of length.
-
- If the user requests a fixed_line_length <7 then gfc_init_options()
- emits a fatal error. */
- int fixed_line_length;
- int free_line_length;
- /* Maximum number of continuation lines in fixed- and free-form source,
- respectively. */
int max_continue_fixed;
int max_continue_free;
int max_identifier_length;
- int dump_fortran_original;
- int dump_fortran_optimized;
int max_errors;
- int flag_all_intrinsics;
- int flag_default_double;
- int flag_default_integer;
- int flag_default_real;
- int flag_integer4_kind;
- int flag_real4_kind;
- int flag_real8_kind;
- int flag_dollar_ok;
- int flag_underscoring;
- int flag_second_underscore;
- int flag_implicit_none;
- int flag_max_stack_var_size;
- int flag_max_array_constructor;
- int flag_range_check;
- int flag_pack_derived;
- int flag_repack_arrays;
int flag_preprocessed;
- int flag_f2c;
- int flag_automatic;
- int flag_backslash;
- int flag_backtrace;
- int flag_allow_leading_underscore;
- int flag_external_blas;
- int blas_matmul_limit;
- int flag_cray_pointer;
int flag_d_lines;
- int gfc_flag_openmp;
- int gfc_flag_openmp_simd;
- int flag_sign_zero;
- int flag_stack_arrays;
- int flag_module_private;
- int flag_recursive;
- int flag_init_local_zero;
int flag_init_integer;
int flag_init_integer_value;
- int flag_init_real;
int flag_init_logical;
int flag_init_character;
char flag_init_character_value;
- int flag_align_commons;
- int flag_protect_parens;
- int flag_realloc_lhs;
- int flag_aggressive_function_elimination;
- int flag_frontend_optimize;
int fpe;
int fpe_summary;
int rtcheck;
- gfc_fcoarray coarray;
int warn_std;
int allow_std;
- int convert;
- int record_marker;
- int max_subrecord_length;
}
gfc_option_t;
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c
index e920a42..415a7c9 100644
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -4264,7 +4264,7 @@ gfc_check_intrinsic_standard (const gfc_intrinsic_sym* isym,
const char* symstd_msg;
/* For -fall-intrinsics, just succeed. */
- if (gfc_option.flag_all_intrinsics)
+ if (flag_all_intrinsics)
return true;
/* Find the symbol's standard message for later usage. */
@@ -4623,8 +4623,7 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag)
}
else if (wflag)
{
- if (gfc_option.flag_range_check
- && expr->expr_type == EXPR_CONSTANT
+ if (flag_range_check && expr->expr_type == EXPR_CONSTANT
&& from_ts.type == ts->type)
{
/* Do nothing. Constants of the same type are range-checked
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index ef0e59a..dca0829 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -157,7 +157,7 @@ next_char (gfc_instring in_string)
c = '\0';
}
- if (gfc_option.flag_backslash && c == '\\')
+ if (flag_backslash && c == '\\')
{
locus old_locus = gfc_current_locus;
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index c297817..95be3658 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -346,59 +346,62 @@ Fortran Joined
; Documented in common.opt
faggressive-function-elimination
-Fortran
+Fortran Var(flag_aggressive_function_elimination)
Eliminate multiple function invokations also for impure functions
falign-commons
-Fortran
+Fortran Var(flag_align_commons) Init(1)
Enable alignment of COMMON blocks
fall-intrinsics
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_all_intrinsics)
All intrinsics procedures are available regardless of selected standard
fallow-leading-underscore
-Fortran Undocumented
+Fortran Undocumented Var(flag_allow_leading_underscore)
; For internal use only: allow the first character of symbol names to be an underscore
fautomatic
-Fortran
+Fortran Var(flag_automatic) Init(1)
Do not treat local variables and COMMON blocks as if they were named in SAVE statements
fbackslash
-Fortran
+Fortran Var(flag_backslash)
Specify that backslash in string introduces an escape character
fbacktrace
-Fortran
+Fortran Var(flag_backtrace) Init(1)
Produce a backtrace when a runtime error is encountered
fblas-matmul-limit=
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_blas_matmul_limit) Init(30)
-fblas-matmul-limit=<n> Size of the smallest matrix for which matmul will use BLAS
fcheck-array-temporaries
Fortran
Produce a warning at runtime if a array temporary has been created for a procedure argument
-fconvert=big-endian
-Fortran RejectNegative
-Use big-endian format for unformatted files
+fconvert=
+Fortran RejectNegative Joined Enum(gfc_convert) Var(flag_convert) Init(GFC_FLAG_CONVERT_NATIVE)
+-fconvert=<big-endian|little-endian|native|swap> The endianness used for unformatted files.
-fconvert=little-endian
-Fortran RejectNegative
-Use little-endian format for unformatted files
+Enum
+Name(gfc_convert) Type(enum gfc_convert) UnknownError(Unrecognized option to endianess value: %qs)
-fconvert=native
-Fortran RejectNegative
-Use native format for unformatted files
+EnumValue
+Enum(gfc_convert) String(big-endian) Value(GFC_FLAG_CONVERT_BIG)
-fconvert=swap
-Fortran RejectNegative
-Swap endianness for unformatted files
+EnumValue
+Enum(gfc_convert) String(little-endian) Value(GFC_FLAG_CONVERT_LITTLE)
+
+EnumValue
+Enum(gfc_convert) String(native) Value(GFC_FLAG_CONVERT_NATIVE)
+
+EnumValue
+Enum(gfc_convert) String(swap) Value(GFC_FLAG_CONVERT_SWAP)
fcray-pointer
-Fortran
+Fortran Var(flag_cray_pointer)
Use the Cray Pointer extension
fd-lines-as-code
@@ -410,19 +413,19 @@ Fortran RejectNegative
Treat lines with 'D' in column one as comments
fdefault-double-8
-Fortran
+Fortran Var(flag_default_double)
Set the default double precision kind to an 8 byte wide type
fdefault-integer-8
-Fortran
+Fortran Var(flag_default_integer)
Set the default integer kind to an 8 byte wide type
fdefault-real-8
-Fortran
+Fortran Var(flag_default_real)
Set the default real kind to an 8 byte wide type
fdollar-ok
-Fortran
+Fortran Var(flag_dollar_ok)
Allow dollar signs in entity names
fdump-core
@@ -430,23 +433,23 @@ Fortran Ignore
Does nothing. Preserved for backward compatibility.
fdump-fortran-original
-Fortran
+Fortran Var(flag_dump_fortran_original)
Display the code tree after parsing
fdump-fortran-optimized
-Fortran
+Fortran Var(flag_dump_fortran_optimized)
Display the code tree after front end optimization
fdump-parse-tree
-Fortran
+Fortran Alias(fdump-fortran-original)
Display the code tree after parsing; deprecated option
fexternal-blas
-Fortran
+Fortran Var(flag_external_blas)
Specify that an external BLAS library should be used for matmul calls on large-size arrays
ff2c
-Fortran
+Fortran Var(flag_f2c)
Use f2c calling convention
ffixed-form
@@ -454,7 +457,7 @@ Fortran RejectNegative
Assume that the source file is fixed form
finteger-4-integer-8
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_integer4_kind,8)
Interpret any INTEGER(4) as an INTEGER(8)
fintrinsic-modules-path
@@ -466,11 +469,11 @@ Fortran RejectNegative Joined
Specify where to find the compiled intrinsic modules
ffixed-line-length-none
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_fixed_line_length,0)
Allow arbitrary character line width in fixed mode
ffixed-line-length-
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_fixed_line_length) Init(72)
-ffixed-line-length-<n> Use n as character line width in fixed mode
ffpe-trap=
@@ -486,19 +489,19 @@ Fortran RejectNegative
Assume that the source file is free form
ffree-line-length-none
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_free_line_length,0)
Allow arbitrary character line width in free mode
ffree-line-length-
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_free_line_length) Init(132)
-ffree-line-length-<n> Use n as character line width in free mode
ffrontend-optimize
-Fortran
+Fortran Var(flag_frontend_optimize) Init(-1)
Enable front end optimization
fimplicit-none
-Fortran
+Fortran Var(flag_implicit_none)
Specify that no implicit typing is allowed, unless overridden by explicit IMPLICIT statements
finit-character=
@@ -518,11 +521,29 @@ Fortran RejectNegative Joined
-finit-logical=<true|false> Initialize local logical variables
finit-real=
-Fortran RejectNegative Joined
--finit-real=<zero|nan|inf|-inf> Initialize local real variables
+Fortran RejectNegative ToLower Joined Enum(gfc_init_local_real) Var(flag_init_real) Init(GFC_INIT_REAL_OFF)
+-finit-real=<zero|snan|nan|inf|-inf> Initialize local real variables
+
+Enum
+Name(gfc_init_local_real) Type(enum gfc_init_local_real) UnknownError(Unrecognized option to floating-point init value: %qs)
+
+EnumValue
+Enum(gfc_init_local_real) String(zero) Value(GFC_INIT_REAL_ZERO)
+
+EnumValue
+Enum(gfc_init_local_real) String(snan) Value(GFC_INIT_REAL_SNAN)
+
+EnumValue
+Enum(gfc_init_local_real) String(nan) Value(GFC_INIT_REAL_NAN)
+
+EnumValue
+Enum(gfc_init_local_real) String(inf) Value(GFC_INIT_REAL_INF)
+
+EnumValue
+Enum(gfc_init_local_real) String(-inf) Value(GFC_INIT_REAL_NEG_INF)
fmax-array-constructor=
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_max_array_constructor) Init(65535)
-fmax-array-constructor=<n> Maximum number of objects in an array constructor
fmax-identifier-length=
@@ -530,19 +551,19 @@ Fortran RejectNegative Joined UInteger
-fmax-identifier-length=<n> Maximum identifier length
fmax-subrecord-length=
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_max_subrecord_length)
-fmax-subrecord-length=<n> Maximum length for subrecords
fmax-stack-var-size=
-Fortran RejectNegative Joined UInteger
+Fortran RejectNegative Joined UInteger Var(flag_max_stack_var_size) Init(-2)
-fmax-stack-var-size=<n> Size in bytes of the largest array that will be put on the stack
fstack-arrays
-Fortran
+Fortran Var(flag_stack_arrays) Init(-1)
Put all local arrays on stack.
fmodule-private
-Fortran
+Fortran Var(flag_module_private)
Set default accessibility of module entities to PRIVATE.
fopenmp
@@ -554,7 +575,7 @@ Fortran
; Documented in C
fpack-derived
-Fortran
+Fortran Var(flag_pack_derived)
Try to lay out derived types as compactly as possible
fpreprocessed
@@ -562,67 +583,79 @@ Fortran
; Documented in C
fprotect-parens
-Fortran
+Fortran Var(flag_protect_parens) Init(-1)
Protect parentheses in expressions
frange-check
-Fortran
+Fortran Var(flag_range_check) Init(1)
Enable range checking during compilation
freal-4-real-8
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_real4_kind,8)
Interpret any REAL(4) as a REAL(8)
freal-4-real-10
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_real4_kind,10)
Interpret any REAL(4) as a REAL(10)
freal-4-real-16
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_real4_kind,16)
Interpret any REAL(4) as a REAL(16)
freal-8-real-4
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_real8_kind,4)
Interpret any REAL(8) as a REAL(4)
freal-8-real-10
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_real8_kind,10)
Interpret any REAL(8) as a REAL(10)
freal-8-real-16
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_real8_kind,16)
Interpret any REAL(8) as a REAL(16)
frealloc-lhs
-Fortran
+Fortran Var(flag_realloc_lhs) Init(-1)
Reallocate the LHS in assignments
frecord-marker=4
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_record_marker,4)
Use a 4-byte record marker for unformatted files
frecord-marker=8
-Fortran RejectNegative
+Fortran RejectNegative Var(flag_record_marker,8)
Use an 8-byte record marker for unformatted files
frecursive
-Fortran
+Fortran Var(flag_recursive)
Allocate local variables on the stack to allow indirect recursion
frepack-arrays
-Fortran
+Fortran Var(flag_repack_arrays)
Copy array sections into a contiguous block on procedure entry
fcoarray=
-Fortran RejectNegative JoinedOrMissing
--fcoarray=[...] Specify which coarray parallelization should be used
+Fortran RejectNegative Joined Enum(gfc_fcoarray) Var(flag_coarray) Init(GFC_FCOARRAY_NONE)
+-fcoarray=<none|single|lib> Specify which coarray parallelization should be used
+
+Enum
+Name(gfc_fcoarray) Type(enum gfc_fcoarray) UnknownError(Unrecognized option: %qs)
+
+EnumValue
+Enum(gfc_fcoarray) String(none) Value(GFC_FCOARRAY_NONE)
+
+EnumValue
+Enum(gfc_fcoarray) String(single) Value(GFC_FCOARRAY_SINGLE)
+
+EnumValue
+Enum(gfc_fcoarray) String(lib) Value(GFC_FCOARRAY_LIB)
fcheck=
Fortran RejectNegative JoinedOrMissing
-fcheck=[...] Specify which runtime checks are to be performed
fsecond-underscore
-Fortran
+Fortran Var(flag_second_underscore) Init(-1)
Append a second underscore if the name already contains an underscore
fshort-enums
@@ -630,11 +663,11 @@ Fortran Var(flag_short_enums)
; Documented in C
fsign-zero
-Fortran
+Fortran Var(flag_sign_zero) Init(1)
Apply negative sign to zero values
funderscoring
-Fortran
+Fortran Var(flag_underscoring) Init(1)
Append underscores to externally visible names
fwhole-file
diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h
index dda755b..e8ac926 100644
--- a/gcc/fortran/libgfortran.h
+++ b/gcc/fortran/libgfortran.h
@@ -70,6 +70,7 @@ along with GCC; see the file COPYING3. If not see
/* Possible values for the CONVERT I/O specifier. */
+/* Keep in sync with GFC_FLAG_CONVERT_* in gcc/flags.h. */
typedef enum
{
GFC_CONVERT_NONE = -1,
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 9e08513..fb68eec 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -530,7 +530,7 @@ gfc_match_name (char *buffer)
gfc_gobble_whitespace ();
c = gfc_next_ascii_char ();
- if (!(ISALPHA (c) || (c == '_' && gfc_option.flag_allow_leading_underscore)))
+ if (!(ISALPHA (c) || (c == '_' && flag_allow_leading_underscore)))
{
if (!gfc_error_flag_test () && c != '(')
gfc_error ("Invalid character in name at %C");
@@ -553,9 +553,9 @@ gfc_match_name (char *buffer)
old_loc = gfc_current_locus;
c = gfc_next_ascii_char ();
}
- while (ISALNUM (c) || c == '_' || (gfc_option.flag_dollar_ok && c == '$'));
+ while (ISALNUM (c) || c == '_' || (flag_dollar_ok && c == '$'));
- if (c == '$' && !gfc_option.flag_dollar_ok)
+ if (c == '$' && !flag_dollar_ok)
{
gfc_fatal_error ("Invalid character %<$%> at %L. Use %<-fdollar-ok%> to "
"allow it as an extension", &old_loc);
@@ -1663,7 +1663,7 @@ gfc_match_critical (void)
if (!gfc_notify_std (GFC_STD_F2008, "CRITICAL statement at %C"))
return MATCH_ERROR;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to "
"enable");
@@ -2725,7 +2725,7 @@ lock_unlock_statement (gfc_statement st)
gfc_unset_implicit_pure (NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return MATCH_ERROR;
@@ -2921,7 +2921,7 @@ sync_statement (gfc_statement st)
if (!gfc_notify_std (GFC_STD_F2008, "SYNC statement at %C"))
return MATCH_ERROR;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to "
"enable");
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 84c1163..f6e5eec 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -5249,7 +5249,7 @@ check_access (gfc_access specific_access, gfc_access default_access)
if (specific_access == ACCESS_PRIVATE)
return FALSE;
- if (gfc_option.flag_module_private)
+ if (flag_module_private)
return default_access == ACCESS_PUBLIC;
else
return default_access != ACCESS_PRIVATE;
@@ -6597,13 +6597,13 @@ use_iso_fortran_env_module (void)
"standard", symbol[i].name, &u->where))
continue;
- if ((gfc_option.flag_default_integer || gfc_option.flag_default_real)
+ if ((flag_default_integer || flag_default_real)
&& symbol[i].id == ISOFORTRANENV_NUMERIC_STORAGE_SIZE)
gfc_warning_now ("Use of the NUMERIC_STORAGE_SIZE named "
"constant from intrinsic module "
"ISO_FORTRAN_ENV at %L is incompatible with "
"option %qs", &u->where,
- gfc_option.flag_default_integer
+ flag_default_integer
? "-fdefault-integer-8"
: "-fdefault-real-8");
switch (symbol[i].id)
@@ -6664,12 +6664,12 @@ use_iso_fortran_env_module (void)
if ((gfc_option.allow_std & symbol[i].standard) == 0)
continue;
- if ((gfc_option.flag_default_integer || gfc_option.flag_default_real)
+ if ((flag_default_integer || flag_default_real)
&& symbol[i].id == ISOFORTRANENV_NUMERIC_STORAGE_SIZE)
gfc_warning_now ("Use of the NUMERIC_STORAGE_SIZE named constant "
"from intrinsic module ISO_FORTRAN_ENV at %C is "
"incompatible with option %s",
- gfc_option.flag_default_integer
+ flag_default_integer
? "-fdefault-integer-8" : "-fdefault-real-8");
switch (symbol[i].id)
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index af71ded..307688a 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -81,64 +81,18 @@ gfc_init_options (unsigned int decoded_options_count,
gfc_source_file = NULL;
gfc_option.module_dir = NULL;
gfc_option.source_form = FORM_UNKNOWN;
- gfc_option.fixed_line_length = 72;
- gfc_option.free_line_length = 132;
gfc_option.max_continue_fixed = 255;
gfc_option.max_continue_free = 255;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
- gfc_option.max_subrecord_length = 0;
- gfc_option.flag_max_array_constructor = 65535;
- gfc_option.convert = GFC_CONVERT_NATIVE;
- gfc_option.record_marker = 0;
- gfc_option.dump_fortran_original = 0;
- gfc_option.dump_fortran_optimized = 0;
-
gfc_option.max_errors = 25;
- gfc_option.flag_all_intrinsics = 0;
- gfc_option.flag_default_double = 0;
- gfc_option.flag_default_integer = 0;
- gfc_option.flag_default_real = 0;
- gfc_option.flag_integer4_kind = 0;
- gfc_option.flag_real4_kind = 0;
- gfc_option.flag_real8_kind = 0;
- gfc_option.flag_dollar_ok = 0;
- gfc_option.flag_underscoring = 1;
- gfc_option.flag_f2c = 0;
- gfc_option.flag_second_underscore = -1;
- gfc_option.flag_implicit_none = 0;
-
- /* Default value of flag_max_stack_var_size is set in gfc_post_options. */
- gfc_option.flag_max_stack_var_size = -2;
- gfc_option.flag_stack_arrays = -1;
-
- gfc_option.flag_range_check = 1;
- gfc_option.flag_pack_derived = 0;
- gfc_option.flag_repack_arrays = 0;
gfc_option.flag_preprocessed = 0;
- gfc_option.flag_automatic = 1;
- gfc_option.flag_backslash = 0;
- gfc_option.flag_module_private = 0;
- gfc_option.flag_backtrace = 1;
- gfc_option.flag_allow_leading_underscore = 0;
- gfc_option.flag_external_blas = 0;
- gfc_option.blas_matmul_limit = 30;
- gfc_option.flag_cray_pointer = 0;
gfc_option.flag_d_lines = -1;
- gfc_option.gfc_flag_openmp = 0;
- gfc_option.flag_sign_zero = 1;
- gfc_option.flag_recursive = 0;
gfc_option.flag_init_integer = GFC_INIT_INTEGER_OFF;
gfc_option.flag_init_integer_value = 0;
- gfc_option.flag_init_real = GFC_INIT_REAL_OFF;
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_OFF;
gfc_option.flag_init_character = GFC_INIT_CHARACTER_OFF;
gfc_option.flag_init_character_value = (char)0;
- gfc_option.flag_align_commons = 1;
- gfc_option.flag_protect_parens = -1;
- gfc_option.flag_realloc_lhs = -1;
- gfc_option.flag_aggressive_function_elimination = 0;
- gfc_option.flag_frontend_optimize = -1;
gfc_option.fpe = 0;
/* All except GFC_FPE_INEXACT. */
@@ -146,7 +100,6 @@ gfc_init_options (unsigned int decoded_options_count,
| GFC_FPE_ZERO | GFC_FPE_OVERFLOW
| GFC_FPE_UNDERFLOW;
gfc_option.rtcheck = 0;
- gfc_option.coarray = GFC_FCOARRAY_NONE;
/* ??? Wmissing-include-dirs is disabled by default in C/C++ but
enabled by default in Fortran. Ideally, we should express this
@@ -259,20 +212,20 @@ gfc_post_options (const char **pfilename)
if (flag_associative_math == -1)
flag_associative_math = (!flag_trapping_math && !flag_signed_zeros);
- if (gfc_option.flag_protect_parens == -1)
- gfc_option.flag_protect_parens = !optimize_fast;
+ if (flag_protect_parens == -1)
+ flag_protect_parens = !optimize_fast;
- if (gfc_option.flag_stack_arrays == -1)
- gfc_option.flag_stack_arrays = optimize_fast;
+ if (flag_stack_arrays == -1)
+ flag_stack_arrays = optimize_fast;
/* By default, disable (re)allocation during assignment for -std=f95,
and enable it for F2003/F2008/GNU/Legacy. */
- if (gfc_option.flag_realloc_lhs == -1)
+ if (flag_realloc_lhs == -1)
{
if (gfc_option.allow_std & GFC_STD_F2003)
- gfc_option.flag_realloc_lhs = 1;
+ flag_realloc_lhs = 1;
else
- gfc_option.flag_realloc_lhs = 0;
+ flag_realloc_lhs = 0;
}
/* -fbounds-check is equivalent to -fcheck=bounds */
@@ -280,7 +233,7 @@ gfc_post_options (const char **pfilename)
gfc_option.rtcheck |= GFC_RTCHECK_BOUNDS;
if (flag_compare_debug)
- gfc_option.dump_fortran_original = 0;
+ flag_dump_fortran_original = 0;
/* Make -fmax-errors visible to gfortran's diagnostic machinery. */
if (global_options_set.x_flag_max_errors)
@@ -364,53 +317,62 @@ gfc_post_options (const char **pfilename)
/* If the user didn't explicitly specify -f(no)-second-underscore we
use it if we're trying to be compatible with f2c, and not
otherwise. */
- if (gfc_option.flag_second_underscore == -1)
- gfc_option.flag_second_underscore = gfc_option.flag_f2c;
+ if (flag_second_underscore == -1)
+ flag_second_underscore = flag_f2c;
- if (!gfc_option.flag_automatic && gfc_option.flag_max_stack_var_size != -2
- && gfc_option.flag_max_stack_var_size != 0)
+ if (!flag_automatic && flag_max_stack_var_size != -2
+ && flag_max_stack_var_size != 0)
gfc_warning_now ("Flag %<-fno-automatic%> overwrites %<-fmax-stack-var-size=%d%>",
- gfc_option.flag_max_stack_var_size);
- else if (!gfc_option.flag_automatic && gfc_option.flag_recursive)
+ flag_max_stack_var_size);
+ else if (!flag_automatic && flag_recursive)
gfc_warning_now ("Flag %<-fno-automatic%> overwrites %<-frecursive%>");
- else if (!gfc_option.flag_automatic && gfc_option.gfc_flag_openmp)
+ else if (!flag_automatic && flag_openmp)
gfc_warning_now ("Flag %<-fno-automatic%> overwrites %<-frecursive%> implied by "
- "%<-fopenmp%>");
- else if (gfc_option.flag_max_stack_var_size != -2
- && gfc_option.flag_recursive)
+ "%<-fopenmp%>");
+ else if (flag_max_stack_var_size != -2 && flag_recursive)
gfc_warning_now ("Flag %<-frecursive%> overwrites %<-fmax-stack-var-size=%d%>",
- gfc_option.flag_max_stack_var_size);
- else if (gfc_option.flag_max_stack_var_size != -2
- && gfc_option.gfc_flag_openmp)
+ flag_max_stack_var_size);
+ else if (flag_max_stack_var_size != -2 && flag_openmp)
gfc_warning_now ("Flag %<-fmax-stack-var-size=%d%> overwrites %<-frecursive%> "
- "implied by %<-fopenmp%>",
- gfc_option.flag_max_stack_var_size);
+ "implied by %<-fopenmp%>", flag_max_stack_var_size);
/* Implement -frecursive as -fmax-stack-var-size=-1. */
- if (gfc_option.flag_recursive)
- gfc_option.flag_max_stack_var_size = -1;
+ if (flag_recursive)
+ flag_max_stack_var_size = -1;
/* Implied -frecursive; implemented as -fmax-stack-var-size=-1. */
- if (gfc_option.flag_max_stack_var_size == -2 && gfc_option.gfc_flag_openmp
- && gfc_option.flag_automatic)
+ if (flag_max_stack_var_size == -2 && flag_openmp && flag_automatic)
{
- gfc_option.flag_recursive = 1;
- gfc_option.flag_max_stack_var_size = -1;
+ flag_recursive = 1;
+ flag_max_stack_var_size = -1;
}
/* Set default. */
- if (gfc_option.flag_max_stack_var_size == -2)
- gfc_option.flag_max_stack_var_size = 32768;
+ if (flag_max_stack_var_size == -2)
+ flag_max_stack_var_size = 32768;
/* Implement -fno-automatic as -fmax-stack-var-size=0. */
- if (!gfc_option.flag_automatic)
- gfc_option.flag_max_stack_var_size = 0;
+ if (!flag_automatic)
+ flag_max_stack_var_size = 0;
/* Optimization implies front end optimization, unless the user
specified it directly. */
- if (gfc_option.flag_frontend_optimize == -1)
- gfc_option.flag_frontend_optimize = optimize;
+ if (flag_frontend_optimize == -1)
+ flag_frontend_optimize = optimize;
+
+ if (flag_max_array_constructor < 65535)
+ flag_max_array_constructor = 65535;
+
+ if (flag_fixed_line_length != 0 && flag_fixed_line_length < 7)
+ gfc_fatal_error ("Fixed line length must be at least seven");
+
+ if (flag_free_line_length != 0 && flag_free_line_length < 4)
+ gfc_fatal_error ("Free line length must be at least three");
+
+ if (flag_max_subrecord_length > MAX_SUBRECORD_LENGTH)
+ gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
+ MAX_SUBRECORD_LENGTH);
gfc_cpp_post_options ();
@@ -504,20 +466,6 @@ gfc_handle_fpe_option (const char *arg, bool trap)
static void
-gfc_handle_coarray_option (const char *arg)
-{
- if (strcmp (arg, "none") == 0)
- gfc_option.coarray = GFC_FCOARRAY_NONE;
- else if (strcmp (arg, "single") == 0)
- gfc_option.coarray = GFC_FCOARRAY_SINGLE;
- else if (strcmp (arg, "lib") == 0)
- gfc_option.coarray = GFC_FCOARRAY_LIB;
- else
- gfc_fatal_error ("Argument to %<-fcoarray%> is not valid: %s", arg);
-}
-
-
-static void
gfc_handle_runtime_check_option (const char *arg)
{
int result, pos = 0, n;
@@ -578,50 +526,10 @@ gfc_handle_option (size_t scode, const char *arg, int value,
result = false;
break;
- case OPT_fall_intrinsics:
- gfc_option.flag_all_intrinsics = 1;
- break;
-
- case OPT_fautomatic:
- gfc_option.flag_automatic = value;
- break;
-
- case OPT_fallow_leading_underscore:
- gfc_option.flag_allow_leading_underscore = value;
- break;
-
- case OPT_fbackslash:
- gfc_option.flag_backslash = value;
- break;
-
- case OPT_fbacktrace:
- gfc_option.flag_backtrace = value;
- break;
-
case OPT_fcheck_array_temporaries:
gfc_option.rtcheck |= GFC_RTCHECK_ARRAY_TEMPS;
break;
- case OPT_fcray_pointer:
- gfc_option.flag_cray_pointer = value;
- break;
-
- case OPT_ff2c:
- gfc_option.flag_f2c = value;
- break;
-
- case OPT_fdollar_ok:
- gfc_option.flag_dollar_ok = value;
- break;
-
- case OPT_fexternal_blas:
- gfc_option.flag_external_blas = value;
- break;
-
- case OPT_fblas_matmul_limit_:
- gfc_option.blas_matmul_limit = value;
- break;
-
case OPT_fd_lines_as_code:
gfc_option.flag_d_lines = 1;
break;
@@ -630,59 +538,14 @@ gfc_handle_option (size_t scode, const char *arg, int value,
gfc_option.flag_d_lines = 0;
break;
- case OPT_fdump_fortran_original:
- case OPT_fdump_parse_tree:
- gfc_option.dump_fortran_original = value;
- break;
-
- case OPT_fdump_fortran_optimized:
- gfc_option.dump_fortran_optimized = value;
- break;
-
case OPT_ffixed_form:
gfc_option.source_form = FORM_FIXED;
break;
- case OPT_ffixed_line_length_none:
- gfc_option.fixed_line_length = 0;
- break;
-
- case OPT_ffixed_line_length_:
- if (value != 0 && value < 7)
- gfc_fatal_error ("Fixed line length must be at least seven");
- gfc_option.fixed_line_length = value;
- break;
-
case OPT_ffree_form:
gfc_option.source_form = FORM_FREE;
break;
- case OPT_fopenmp:
- gfc_option.gfc_flag_openmp = value;
- break;
-
- case OPT_fopenmp_simd:
- gfc_option.gfc_flag_openmp_simd = value;
- break;
-
- case OPT_ffree_line_length_none:
- gfc_option.free_line_length = 0;
- break;
-
- case OPT_ffree_line_length_:
- if (value != 0 && value < 4)
- gfc_fatal_error ("Free line length must be at least three");
- gfc_option.free_line_length = value;
- break;
-
- case OPT_funderscoring:
- gfc_option.flag_underscoring = value;
- break;
-
- case OPT_fsecond_underscore:
- gfc_option.flag_second_underscore = value;
- break;
-
case OPT_static_libgfortran:
#ifndef HAVE_LD_STATIC_DYNAMIC
gfc_fatal_error ("%<-static-libgfortran%> is not supported in this "
@@ -690,10 +553,6 @@ gfc_handle_option (size_t scode, const char *arg, int value,
#endif
break;
- case OPT_fimplicit_none:
- gfc_option.flag_implicit_none = value;
- break;
-
case OPT_fintrinsic_modules_path:
case OPT_fintrinsic_modules_path_:
@@ -706,34 +565,6 @@ gfc_handle_option (size_t scode, const char *arg, int value,
gfc_add_intrinsic_modules_path (arg);
break;
- case OPT_fmax_array_constructor_:
- gfc_option.flag_max_array_constructor = value > 65535 ? value : 65535;
- break;
-
- case OPT_fmax_stack_var_size_:
- gfc_option.flag_max_stack_var_size = value;
- break;
-
- case OPT_fstack_arrays:
- gfc_option.flag_stack_arrays = value;
- break;
-
- case OPT_fmodule_private:
- gfc_option.flag_module_private = value;
- break;
-
- case OPT_frange_check:
- gfc_option.flag_range_check = value;
- break;
-
- case OPT_fpack_derived:
- gfc_option.flag_pack_derived = value;
- break;
-
- case OPT_frepack_arrays:
- gfc_option.flag_repack_arrays = value;
- break;
-
case OPT_fpreprocessed:
gfc_option.flag_preprocessed = value;
break;
@@ -745,50 +576,10 @@ gfc_handle_option (size_t scode, const char *arg, int value,
gfc_option.max_identifier_length = value;
break;
- case OPT_fdefault_integer_8:
- gfc_option.flag_default_integer = value;
- break;
-
- case OPT_fdefault_real_8:
- gfc_option.flag_default_real = value;
- break;
-
- case OPT_fdefault_double_8:
- gfc_option.flag_default_double = value;
- break;
-
- case OPT_finteger_4_integer_8:
- gfc_option.flag_integer4_kind = 8;
- break;
-
- case OPT_freal_4_real_8:
- gfc_option.flag_real4_kind = 8;
- break;
-
- case OPT_freal_4_real_10:
- gfc_option.flag_real4_kind = 10;
- break;
-
- case OPT_freal_4_real_16:
- gfc_option.flag_real4_kind = 16;
- break;
-
- case OPT_freal_8_real_4:
- gfc_option.flag_real8_kind = 4;
- break;
-
- case OPT_freal_8_real_10:
- gfc_option.flag_real8_kind = 10;
- break;
-
- case OPT_freal_8_real_16:
- gfc_option.flag_real8_kind = 16;
- break;
-
case OPT_finit_local_zero:
gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
gfc_option.flag_init_integer_value = 0;
- gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
+ flag_init_real = GFC_INIT_REAL_ZERO;
gfc_option.flag_init_logical = GFC_INIT_LOGICAL_FALSE;
gfc_option.flag_init_character = GFC_INIT_CHARACTER_ON;
gfc_option.flag_init_character_value = (char)0;
@@ -804,22 +595,6 @@ gfc_handle_option (size_t scode, const char *arg, int value,
arg);
break;
- case OPT_finit_real_:
- if (!strcasecmp (arg, "zero"))
- gfc_option.flag_init_real = GFC_INIT_REAL_ZERO;
- else if (!strcasecmp (arg, "nan"))
- gfc_option.flag_init_real = GFC_INIT_REAL_NAN;
- else if (!strcasecmp (arg, "snan"))
- gfc_option.flag_init_real = GFC_INIT_REAL_SNAN;
- else if (!strcasecmp (arg, "inf"))
- gfc_option.flag_init_real = GFC_INIT_REAL_INF;
- else if (!strcasecmp (arg, "-inf"))
- gfc_option.flag_init_real = GFC_INIT_REAL_NEG_INF;
- else
- gfc_fatal_error ("Unrecognized option to %<-finit-real%>: %s",
- arg);
- break;
-
case OPT_finit_integer_:
gfc_option.flag_init_integer = GFC_INIT_INTEGER_ON;
gfc_option.flag_init_integer_value = atoi (arg);
@@ -844,10 +619,6 @@ gfc_handle_option (size_t scode, const char *arg, int value,
gfc_handle_module_path_options (arg);
break;
- case OPT_fsign_zero:
- gfc_option.flag_sign_zero = value;
- break;
-
case OPT_ffpe_trap_:
gfc_handle_fpe_option (arg, true);
break;
@@ -908,69 +679,9 @@ gfc_handle_option (size_t scode, const char *arg, int value,
/* Handled in language-independent code. */
break;
- case OPT_fconvert_little_endian:
- gfc_option.convert = GFC_CONVERT_LITTLE;
- break;
-
- case OPT_fconvert_big_endian:
- gfc_option.convert = GFC_CONVERT_BIG;
- break;
-
- case OPT_fconvert_native:
- gfc_option.convert = GFC_CONVERT_NATIVE;
- break;
-
- case OPT_fconvert_swap:
- gfc_option.convert = GFC_CONVERT_SWAP;
- break;
-
- case OPT_frecord_marker_4:
- gfc_option.record_marker = 4;
- break;
-
- case OPT_frecord_marker_8:
- gfc_option.record_marker = 8;
- break;
-
- case OPT_fmax_subrecord_length_:
- if (value > MAX_SUBRECORD_LENGTH)
- gfc_fatal_error ("Maximum subrecord length cannot exceed %d",
- MAX_SUBRECORD_LENGTH);
-
- gfc_option.max_subrecord_length = value;
- break;
-
- case OPT_frecursive:
- gfc_option.flag_recursive = value;
- break;
-
- case OPT_falign_commons:
- gfc_option.flag_align_commons = value;
- break;
-
- case OPT_faggressive_function_elimination:
- gfc_option.flag_aggressive_function_elimination = value;
- break;
-
- case OPT_ffrontend_optimize:
- gfc_option.flag_frontend_optimize = value;
- break;
-
- case OPT_fprotect_parens:
- gfc_option.flag_protect_parens = value;
- break;
-
- case OPT_frealloc_lhs:
- gfc_option.flag_realloc_lhs = value;
- break;
-
case OPT_fcheck_:
gfc_handle_runtime_check_option (arg);
break;
-
- case OPT_fcoarray_:
- gfc_handle_coarray_option (arg);
- break;
}
Fortran_handle_option_auto (&global_options, &global_options_set,
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 54c0cdc..b4fa61e 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -22,6 +22,7 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include <setjmp.h>
#include "coretypes.h"
+#include "flags.h"
#include "gfortran.h"
#include "match.h"
#include "parse.h"
@@ -574,7 +575,7 @@ decode_statement (void)
/* Like match, but don't match anything if not -fopenmp. */
#define matcho(keyword, subr, st) \
do { \
- if (!gfc_option.gfc_flag_openmp) \
+ if (!flag_openmp) \
; \
else if (match_word (keyword, subr, &old_locus) \
== MATCH_YES) \
@@ -769,7 +770,7 @@ decode_omp_directive (void)
not -fopenmp and simd_matched is false, i.e. if a directive other
than one marked with match has been seen. */
- if (gfc_option.gfc_flag_openmp || simd_matched)
+ if (flag_openmp || simd_matched)
{
if (!gfc_error_check ())
gfc_error_now ("Unclassifiable OpenMP directive at %C");
@@ -896,9 +897,7 @@ next_free (void)
return decode_gcc_attribute ();
}
- else if (c == '$'
- && (gfc_option.gfc_flag_openmp
- || gfc_option.gfc_flag_openmp_simd))
+ else if (c == '$' && (flag_openmp || flag_openmp_simd))
{
int i;
@@ -988,8 +987,7 @@ next_fixed (void)
return decode_gcc_attribute ();
}
else if (c == '$'
- && (gfc_option.gfc_flag_openmp
- || gfc_option.gfc_flag_openmp_simd))
+ && (flag_openmp || flag_openmp_simd))
{
for (i = 0; i < 4; i++, c = gfc_next_char_literal (NONSTRING))
gcc_assert ((char) gfc_wide_tolower (c) == "$omp"[i]);
@@ -5085,7 +5083,7 @@ loop:
gfc_resolve (gfc_current_ns);
/* Dump the parse tree if requested. */
- if (gfc_option.dump_fortran_original)
+ if (flag_dump_fortran_original)
gfc_dump_parse_tree (gfc_current_ns, stdout);
gfc_get_errors (NULL, &errors);
@@ -5132,7 +5130,7 @@ prog_units:
/* Do the parse tree dump. */
gfc_current_ns
- = gfc_option.dump_fortran_original ? gfc_global_ns_list : NULL;
+ = flag_dump_fortran_original ? gfc_global_ns_list : NULL;
for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling)
if (!gfc_current_ns->proc_name
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index 18791ce..77522e5 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -224,7 +224,7 @@ match_integer_constant (gfc_expr **result, int signflag)
if (kind == -1)
return MATCH_ERROR;
- if (kind == 4 && gfc_option.flag_integer4_kind == 8)
+ if (kind == 4 && flag_integer4_kind == 8)
kind = 8;
if (gfc_validate_kind (BT_INTEGER, kind, true) < 0)
@@ -639,21 +639,21 @@ done:
if (kind == 4)
{
- if (gfc_option.flag_real4_kind == 8)
+ if (flag_real4_kind == 8)
kind = 8;
- if (gfc_option.flag_real4_kind == 10)
+ if (flag_real4_kind == 10)
kind = 10;
- if (gfc_option.flag_real4_kind == 16)
+ if (flag_real4_kind == 16)
kind = 16;
}
if (kind == 8)
{
- if (gfc_option.flag_real8_kind == 4)
+ if (flag_real8_kind == 4)
kind = 4;
- if (gfc_option.flag_real8_kind == 10)
+ if (flag_real8_kind == 10)
kind = 10;
- if (gfc_option.flag_real8_kind == 16)
+ if (flag_real8_kind == 16)
kind = 16;
}
break;
@@ -688,21 +688,21 @@ done:
if (kind == 4)
{
- if (gfc_option.flag_real4_kind == 8)
+ if (flag_real4_kind == 8)
kind = 8;
- if (gfc_option.flag_real4_kind == 10)
+ if (flag_real4_kind == 10)
kind = 10;
- if (gfc_option.flag_real4_kind == 16)
+ if (flag_real4_kind == 16)
kind = 16;
}
if (kind == 8)
{
- if (gfc_option.flag_real8_kind == 4)
+ if (flag_real8_kind == 4)
kind = 4;
- if (gfc_option.flag_real8_kind == 10)
+ if (flag_real8_kind == 10)
kind = 10;
- if (gfc_option.flag_real8_kind == 16)
+ if (flag_real8_kind == 16)
kind = 16;
}
@@ -857,7 +857,7 @@ next_string_char (gfc_char_t delimiter, int *ret)
return 0;
}
- if (gfc_option.flag_backslash && c == '\\')
+ if (flag_backslash && c == '\\')
{
old_locus = gfc_current_locus;
@@ -929,7 +929,7 @@ match_charkind_name (char *name)
if (!ISALNUM (c)
&& c != '_'
- && (c != '$' || !gfc_option.flag_dollar_ok))
+ && (c != '$' || !flag_dollar_ok))
break;
*name++ = c;
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index ab13dc9..3b8b869 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -1558,7 +1558,7 @@ is_illegal_recursion (gfc_symbol* sym, gfc_namespace* context)
proc_sym = sym;
/* If sym is RECURSIVE, all is well of course. */
- if (proc_sym->attr.recursive || gfc_option.flag_recursive)
+ if (proc_sym->attr.recursive || flag_recursive)
return false;
/* Find the context procedure's "real" symbol if it has entries.
@@ -5091,7 +5091,7 @@ resolve_procedure:
if (t)
expression_rank (e);
- if (t && gfc_option.coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
+ if (t && flag_coarray == GFC_FCOARRAY_LIB && gfc_is_coindexed (e))
add_caf_get_intrinsic (e);
return t;
@@ -5676,7 +5676,7 @@ success:
/* Resolve a call to a type-bound subroutine. */
static bool
-resolve_typebound_call (gfc_code* c, const char **name)
+resolve_typebound_call (gfc_code* c, const char **name, bool *overridable)
{
gfc_actual_arglist* newactual;
gfc_symtree* target;
@@ -5700,6 +5700,10 @@ resolve_typebound_call (gfc_code* c, const char **name)
if (!resolve_typebound_generic_call (c->expr1, name))
return false;
+ /* Pass along the NON_OVERRIDABLE attribute of the specific TBP. */
+ if (overridable)
+ *overridable = !c->expr1->value.compcall.tbp->non_overridable;
+
/* Transform into an ordinary EXEC_CALL for now. */
if (!resolve_typebound_static (c->expr1, &target, &newactual))
@@ -5959,7 +5963,7 @@ resolve_typebound_subroutine (gfc_code *code)
if (c->ts.u.derived == NULL)
c->ts.u.derived = gfc_find_derived_vtab (declared);
- if (!resolve_typebound_call (code, &name))
+ if (!resolve_typebound_call (code, &name, NULL))
return false;
/* Use the generic name if it is there. */
@@ -5991,7 +5995,7 @@ resolve_typebound_subroutine (gfc_code *code)
}
if (st == NULL)
- return resolve_typebound_call (code, NULL);
+ return resolve_typebound_call (code, NULL, NULL);
if (!resolve_ref (code->expr1))
return false;
@@ -6004,10 +6008,10 @@ resolve_typebound_subroutine (gfc_code *code)
|| (!class_ref && st->n.sym->ts.type != BT_CLASS))
{
gfc_free_ref_list (new_ref);
- return resolve_typebound_call (code, NULL);
+ return resolve_typebound_call (code, NULL, NULL);
}
- if (!resolve_typebound_call (code, &name))
+ if (!resolve_typebound_call (code, &name, &overridable))
{
gfc_free_ref_list (new_ref);
return false;
@@ -8522,7 +8526,7 @@ resolve_critical (gfc_code *code)
char name[GFC_MAX_SYMBOL_LEN];
static int serial = 0;
- if (gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (flag_coarray != GFC_FCOARRAY_LIB)
return;
symtree = gfc_find_symtree (gfc_current_ns->sym_root,
@@ -9352,7 +9356,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
if (!gfc_notify_std (GFC_STD_F2008, "Assignment to an allocatable "
"polymorphic variable at %L", &lhs->where))
return false;
- if (!gfc_option.flag_realloc_lhs)
+ if (!flag_realloc_lhs)
{
gfc_error ("Assignment to an allocatable polymorphic variable at %L "
"requires %<-frealloc-lhs%>", &lhs->where);
@@ -9394,7 +9398,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace *ns)
the LHS is (re)allocatable or has a vector subscript. If the LHS is a
noncoindexed array and the RHS is a coindexed scalar, use the normal code
path. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& (lhs_coindexed
|| (code->expr2->expr_type == EXPR_FUNCTION
&& code->expr2->value.function.isym
@@ -10685,7 +10689,7 @@ build_default_init_expr (gfc_symbol *sym)
break;
case BT_REAL:
- switch (gfc_option.flag_init_real)
+ switch (flag_init_real)
{
case GFC_INIT_REAL_SNAN:
init_expr->is_snan = 1;
@@ -10714,7 +10718,7 @@ build_default_init_expr (gfc_symbol *sym)
break;
case BT_COMPLEX:
- switch (gfc_option.flag_init_real)
+ switch (flag_init_real)
{
case GFC_INIT_REAL_SNAN:
init_expr->is_snan = 1;
@@ -10777,7 +10781,7 @@ build_default_init_expr (gfc_symbol *sym)
init_expr = NULL;
}
if (!init_expr && gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON
- && sym->ts.u.cl->length && gfc_option.flag_max_stack_var_size != 0)
+ && sym->ts.u.cl->length && flag_max_stack_var_size != 0)
{
gfc_actual_arglist *arg;
init_expr = gfc_get_expr ();
@@ -10827,7 +10831,7 @@ apply_default_init_local (gfc_symbol *sym)
are stack allocated even with -fno-automatic; we have also to exclude
result variable, which are also nonstatic. */
if (sym->attr.save || sym->ns->save_all
- || (gfc_option.flag_max_stack_var_size == 0 && !sym->attr.result
+ || (flag_max_stack_var_size == 0 && !sym->attr.result
&& !sym->ns->proc_name->attr.recursive
&& (!sym->attr.dimension || !is_non_constant_shape_array (sym))))
{
diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index 6a37036..d6b9bbf 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -749,8 +749,7 @@ skip_free_comments (void)
2) handle OpenMP conditional compilation, where
!$ should be treated as 2 spaces (for initial lines
only if followed by space). */
- if ((gfc_option.gfc_flag_openmp
- || gfc_option.gfc_flag_openmp_simd) && at_bol)
+ if ((flag_openmp || flag_openmp_simd) && at_bol)
{
locus old_loc = gfc_current_locus;
if (next_char () == '$')
@@ -876,7 +875,7 @@ skip_fixed_comments (void)
&& continue_line < gfc_linebuf_linenum (gfc_current_locus.lb))
continue_line = gfc_linebuf_linenum (gfc_current_locus.lb);
- if (gfc_option.gfc_flag_openmp || gfc_option.gfc_flag_openmp_simd)
+ if (flag_openmp || flag_openmp_simd)
{
if (next_char () == '$')
{
@@ -1051,7 +1050,7 @@ restart:
if (warn_line_truncation && gfc_current_locus.lb != NULL
&& gfc_current_locus.lb->truncated)
{
- int maxlen = gfc_option.free_line_length;
+ int maxlen = flag_free_line_length;
gfc_char_t *current_nextc = gfc_current_locus.nextc;
gfc_current_locus.lb->truncated = 0;
@@ -1434,9 +1433,9 @@ load_line (FILE *input, gfc_char_t **pbuf, int *pbuflen, const int *first_char)
/* Determine the maximum allowed line length. */
if (gfc_current_form == FORM_FREE)
- maxlen = gfc_option.free_line_length;
+ maxlen = flag_free_line_length;
else if (gfc_current_form == FORM_FIXED)
- maxlen = gfc_option.fixed_line_length;
+ maxlen = flag_fixed_line_length;
else
maxlen = 72;
@@ -1610,7 +1609,7 @@ next_char:
/* Pad lines to the selected line length in fixed form. */
if (gfc_current_form == FORM_FIXED
- && gfc_option.fixed_line_length != 0
+ && flag_fixed_line_length != 0
&& !preprocessor_flag
&& c != EOF)
{
@@ -1822,7 +1821,7 @@ include_line (gfc_char_t *line)
c = line;
- if (gfc_option.gfc_flag_openmp || gfc_option.gfc_flag_openmp_simd)
+ if (flag_openmp || flag_openmp_simd)
{
if (gfc_current_form == FORM_FREE)
{
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 32d44ca..d46c5db 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -153,7 +153,7 @@ convert_mpz_to_unsigned (mpz_t x, int bitsize)
{
/* Confirm that no bits above the signed range are unset if we
are doing range checking. */
- if (gfc_option.flag_range_check != 0)
+ if (flag_range_check != 0)
gcc_assert (mpz_scan0 (x, bitsize-1) == ULONG_MAX);
mpz_init_set_ui (mask, 1);
@@ -184,7 +184,7 @@ gfc_convert_mpz_to_signed (mpz_t x, int bitsize)
/* Confirm that no bits above the unsigned range are set if we are
doing range checking. */
- if (gfc_option.flag_range_check != 0)
+ if (flag_range_check != 0)
gcc_assert (mpz_scan1 (x, bitsize) == ULONG_MAX);
if (mpz_tstbit (x, bitsize - 1) == 1)
@@ -1261,7 +1261,7 @@ gfc_simplify_bessel_n2 (gfc_expr *order1, gfc_expr *order2, gfc_expr *x,
if (mpfr_cmp_ui (x->value.real, 0.0) == 0)
{
- if (!jn && gfc_option.flag_range_check)
+ if (!jn && flag_range_check)
{
gfc_error ("Result of BESSEL_YN is -INF at %L", &result->where);
gfc_free_expr (result);
@@ -1367,7 +1367,7 @@ gfc_simplify_bessel_n2 (gfc_expr *order1, gfc_expr *order2, gfc_expr *x,
/* Special case: For YN, if the previous N gave -INF, set
also N+1 to -INF. */
- if (!jn && !gfc_option.flag_range_check && mpfr_inf_p (last2))
+ if (!jn && !flag_range_check && mpfr_inf_p (last2))
{
mpfr_set_inf (e->value.real, -1);
gfc_constructor_append_expr (&result->value.constructor, e,
@@ -3324,7 +3324,7 @@ simplify_bound_dim (gfc_expr *array, gfc_expr *kind, int d, int upper,
/* The last dimension of an assumed-size array is special. */
if ((!coarray && d == as->rank && as->type == AS_ASSUMED_SIZE && !upper)
|| (coarray && d == as->rank + as->corank
- && (!upper || gfc_option.coarray == GFC_FCOARRAY_SINGLE)))
+ && (!upper || flag_coarray == GFC_FCOARRAY_SINGLE)))
{
if (as->lower[d-1]->expr_type == EXPR_CONSTANT)
{
@@ -4475,7 +4475,7 @@ gfc_simplify_nearest (gfc_expr *x, gfc_expr *s)
/* Only NaN can occur. Do not use range check as it gives an
error for denormal numbers. */
- if (mpfr_nan_p (result->value.real) && gfc_option.flag_range_check)
+ if (mpfr_nan_p (result->value.real) && flag_range_check)
{
gfc_error ("Result of NEAREST is NaN at %L", &result->where);
gfc_free_expr (result);
@@ -4633,13 +4633,13 @@ gfc_simplify_num_images (gfc_expr *distance ATTRIBUTE_UNUSED, gfc_expr *failed)
{
gfc_expr *result;
- if (gfc_option.coarray == GFC_FCOARRAY_NONE)
+ if (flag_coarray == GFC_FCOARRAY_NONE)
{
gfc_fatal_error ("Coarrays disabled at %C, use %<-fcoarray=%> to enable");
return &gfc_bad_expr;
}
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE)
return NULL;
if (failed && failed->expr_type != EXPR_CONSTANT)
@@ -5920,7 +5920,7 @@ gfc_simplify_sign (gfc_expr *x, gfc_expr *y)
break;
case BT_REAL:
- if (gfc_option.flag_sign_zero)
+ if (flag_sign_zero)
mpfr_copysign (result->value.real, x->value.real, y->value.real,
GFC_RND_MODE);
else
@@ -6090,7 +6090,7 @@ gfc_simplify_spread (gfc_expr *source, gfc_expr *dim_expr, gfc_expr *ncopies_exp
else
mpz_init_set_ui (size, 1);
- if (mpz_get_si (size)*ncopies > gfc_option.flag_max_array_constructor)
+ if (mpz_get_si (size)*ncopies > flag_max_array_constructor)
return NULL;
if (source->expr_type == EXPR_CONSTANT)
@@ -6525,7 +6525,7 @@ gfc_simplify_image_index (gfc_expr *coarray, gfc_expr *sub)
gcc_assert (sub_cons == NULL);
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE && !first_image)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE && !first_image)
return NULL;
result = gfc_get_constant_expr (BT_INTEGER, gfc_default_integer_kind,
@@ -6543,7 +6543,7 @@ gfc_expr *
gfc_simplify_this_image (gfc_expr *coarray, gfc_expr *dim,
gfc_expr *distance ATTRIBUTE_UNUSED)
{
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE)
return NULL;
/* If no coarray argument has been passed or when the first argument
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index a39d4140..088fbbd 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -220,7 +220,7 @@ gfc_get_default_type (const char *name, gfc_namespace *ns)
letter = name[0];
- if (gfc_option.flag_allow_leading_underscore && letter == '_')
+ if (flag_allow_leading_underscore && letter == '_')
gfc_fatal_error ("Option %<-fallow-leading-underscore%> is for use only by "
"gfortran developers, and should not be used for "
"implicitly typed variables");
@@ -2372,7 +2372,7 @@ gfc_get_namespace (gfc_namespace *parent, int parent_types)
continue;
}
- if (gfc_option.flag_implicit_none != 0)
+ if (flag_implicit_none != 0)
{
gfc_clear_ts (ts);
continue;
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index f02ff32..67beab2 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -298,7 +298,7 @@ gfc_conv_descriptor_token (tree desc)
type = TREE_TYPE (desc);
gcc_assert (GFC_DESCRIPTOR_TYPE_P (type));
- gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+ gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
field = gfc_advance_chain (TYPE_FIELDS (type), CAF_TOKEN_FIELD);
/* Should be a restricted pointer - except in the finalization wrapper. */
@@ -830,7 +830,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
{
/* Allocate the temporary. */
onstack = !dynamic && initial == NULL_TREE
- && (gfc_option.flag_stack_arrays
+ && (flag_stack_arrays
|| gfc_can_put_var_on_stack (size));
if (onstack)
@@ -3950,7 +3950,7 @@ done:
continue;
/* Catch allocatable lhs in f2003. */
- if (gfc_option.flag_realloc_lhs && ss->is_alloc_lhs)
+ if (flag_realloc_lhs && ss->is_alloc_lhs)
continue;
expr = ss_info->expr;
@@ -4349,7 +4349,7 @@ gfc_conv_resolve_dependencies (gfc_loopinfo * loop, gfc_ss * dest,
if (ss->info->type != GFC_SS_SECTION)
{
- if (gfc_option.flag_realloc_lhs
+ if (flag_realloc_lhs
&& dest_expr != ss_expr
&& gfc_is_reallocatable_lhs (dest_expr)
&& ss_expr->rank)
@@ -5277,7 +5277,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
pointer = gfc_conv_descriptor_data_get (se->expr);
STRIP_NOPS (pointer);
- if (coarray && gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (coarray && flag_coarray == GFC_FCOARRAY_LIB)
token = gfc_build_addr_expr (NULL_TREE,
gfc_conv_descriptor_token (se->expr));
@@ -5360,7 +5360,7 @@ gfc_array_deallocate (tree descriptor, tree pstat, tree errmsg, tree errlen,
the allocation status may not be changed. */
tmp = fold_build2_loc (input_location, MODIFY_EXPR, void_type_node,
var, build_int_cst (TREE_TYPE (var), 0));
- if (pstat != NULL_TREE && coarray && gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (pstat != NULL_TREE && coarray && flag_coarray == GFC_FCOARRAY_LIB)
{
tree cond;
tree stat = build_fold_indirect_ref_loc (input_location, pstat);
@@ -5430,8 +5430,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr)
"constructor at %L requires an increase of "
"the allowed %d upper limit. See "
"%<-fmax-array-constructor%> option",
- &expr->where,
- gfc_option.flag_max_array_constructor);
+ &expr->where, flag_max_array_constructor);
return NULL_TREE;
}
if (mpz_cmp_si (c->offset, 0) != 0)
@@ -5701,7 +5700,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym,
return;
}
- if (gfc_option.flag_stack_arrays)
+ if (flag_stack_arrays)
{
gcc_assert (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE);
space = build_decl (sym->declared_at.lb->location,
@@ -7265,7 +7264,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
gfc_add_modify (&se->pre, new_field, old_field);
}
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (old_desc))
&& GFC_TYPE_ARRAY_AKIND (TREE_TYPE (old_desc))
== GFC_ARRAY_ALLOCATABLE)
@@ -7775,7 +7774,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
break;
case NULLIFY_ALLOC_COMP:
- if (c->attr.pointer)
+ if (c->attr.pointer || c->attr.proc_pointer)
continue;
else if (c->attr.allocatable
&& (c->attr.dimension|| c->attr.codimension))
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index 1c54ef4..a7ae714 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -254,10 +254,10 @@ gfc_sym_mangled_common_id (gfc_common_head *com)
if (strcmp (name, BLANK_COMMON_NAME) == 0)
return get_identifier (name);
- if (gfc_option.flag_underscoring)
+ if (flag_underscoring)
{
has_underscore = strchr (name, '_') != 0;
- if (gfc_option.flag_second_underscore && has_underscore)
+ if (flag_second_underscore && has_underscore)
snprintf (mangled_name, sizeof mangled_name, "%s__", name);
else
snprintf (mangled_name, sizeof mangled_name, "%s_", name);
@@ -1125,7 +1125,7 @@ translate_common (gfc_common_head *common, gfc_symbol *var_list)
"extension to COMMON %qs at %L", sym->name,
common->name, &common->where);
- if (gfc_option.flag_align_commons)
+ if (flag_align_commons)
offset = align_segment (&align);
if (offset)
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 780d350..494d8aa 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -393,10 +393,10 @@ gfc_sym_mangled_function_id (gfc_symbol * sym)
if (sym->attr.proc == PROC_INTRINSIC)
return get_identifier (sym->name);
- if (gfc_option.flag_underscoring)
+ if (flag_underscoring)
{
has_underscore = strchr (sym->name, '_') != 0;
- if (gfc_option.flag_second_underscore && has_underscore)
+ if (flag_second_underscore && has_underscore)
snprintf (name, sizeof name, "%s__", sym->name);
else
snprintf (name, sizeof name, "%s_", sym->name);
@@ -431,14 +431,14 @@ gfc_can_put_var_on_stack (tree size)
if (!INTEGER_CST_P (size))
return 0;
- if (gfc_option.flag_max_stack_var_size < 0)
+ if (flag_max_stack_var_size < 0)
return 1;
if (!tree_fits_uhwi_p (size))
return 0;
low = TREE_INT_CST_LOW (size);
- if (low > (unsigned HOST_WIDE_INT) gfc_option.flag_max_stack_var_size)
+ if (low > (unsigned HOST_WIDE_INT) flag_max_stack_var_size)
return 0;
/* TODO: Set a per-function stack size limit. */
@@ -626,7 +626,7 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
if (!sym->attr.use_assoc
&& (sym->attr.save != SAVE_NONE || sym->attr.data
|| (sym->value && sym->ns->proc_name->attr.is_main_program)
- || (gfc_option.coarray == GFC_FCOARRAY_LIB
+ || (flag_coarray == GFC_FCOARRAY_LIB
&& sym->attr.codimension && !sym->attr.allocatable)))
TREE_STATIC (decl) = 1;
@@ -814,7 +814,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
nest = (procns->proc_name->backend_decl != current_function_decl)
&& !sym->attr.contained;
- if (sym->attr.codimension && gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (sym->attr.codimension && flag_coarray == GFC_FCOARRAY_LIB
&& sym->as->type != AS_ASSUMED_SHAPE
&& GFC_TYPE_ARRAY_CAF_TOKEN (type) == NULL_TREE)
{
@@ -1013,7 +1013,7 @@ gfc_build_dummy_array_decl (gfc_symbol * sym, tree dummy)
/* Even when -frepack-arrays is used, symbols with TARGET attribute
are not repacked. */
- if (!gfc_option.flag_repack_arrays || sym->attr.target)
+ if (!flag_repack_arrays || sym->attr.target)
{
if (as->type == AS_ASSUMED_SIZE)
packed = PACKED_FULL;
@@ -1148,7 +1148,7 @@ gfc_create_string_length (gfc_symbol * sym)
it is an automatic variable. */
bool static_length = sym->attr.save
|| sym->ns->proc_name->attr.flavor == FL_MODULE
- || (gfc_option.flag_max_stack_var_size == 0
+ || (flag_max_stack_var_size == 0
&& sym->ts.deferred && !sym->attr.dummy
&& !sym->attr.result && !sym->attr.function);
@@ -1546,9 +1546,9 @@ gfc_get_symbol_decl (gfc_symbol * sym)
if (TREE_STATIC (decl)
&& !(sym->attr.use_assoc && !intrinsic_array_parameter)
&& (sym->attr.save || sym->ns->proc_name->attr.is_main_program
- || gfc_option.flag_max_stack_var_size == 0
+ || flag_max_stack_var_size == 0
|| sym->attr.data || sym->ns->proc_name->attr.flavor == FL_MODULE)
- && (gfc_option.coarray != GFC_FCOARRAY_LIB
+ && (flag_coarray != GFC_FCOARRAY_LIB
|| !sym->attr.codimension || sym->attr.allocatable))
{
/* Add static initializer. For procedures, it is only needed if
@@ -1838,7 +1838,7 @@ module_sym:
}
}
- if (gfc_option.flag_f2c
+ if (flag_f2c
&& ((e.ts.type == BT_REAL && e.ts.kind == gfc_default_real_kind)
|| e.ts.type == BT_COMPLEX))
{
@@ -1958,7 +1958,7 @@ build_function_decl (gfc_symbol * sym, bool global)
if (sym->attr.access == ACCESS_UNKNOWN && sym->module
&& (sym->ns->default_access == ACCESS_PRIVATE
|| (sym->ns->default_access == ACCESS_UNKNOWN
- && gfc_option.flag_module_private)))
+ && flag_module_private)))
sym->attr.access = ACCESS_PRIVATE;
if (!current_function_decl
@@ -2301,7 +2301,7 @@ create_function_arglist (gfc_symbol * sym)
/* Coarrays which are descriptorless or assumed-shape pass with
-fcoarray=lib the token and the offset as hidden arguments. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& ((f->sym->ts.type != BT_CLASS && f->sym->attr.codimension
&& !f->sym->attr.allocatable)
|| (f->sym->ts.type == BT_CLASS
@@ -3158,32 +3158,28 @@ gfc_build_intrinsic_function_decls (void)
gfor_fndecl_sgemm = gfc_build_library_function_decl
(get_identifier
- (gfc_option.flag_underscoring ? "sgemm_"
- : "sgemm"),
+ (flag_underscoring ? "sgemm_" : "sgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, ps, ps, pint,
ps, pint, ps, ps, pint, integer_type_node,
integer_type_node);
gfor_fndecl_dgemm = gfc_build_library_function_decl
(get_identifier
- (gfc_option.flag_underscoring ? "dgemm_"
- : "dgemm"),
+ (flag_underscoring ? "dgemm_" : "dgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, pd, pd, pint,
pd, pint, pd, pd, pint, integer_type_node,
integer_type_node);
gfor_fndecl_cgemm = gfc_build_library_function_decl
(get_identifier
- (gfc_option.flag_underscoring ? "cgemm_"
- : "cgemm"),
+ (flag_underscoring ? "cgemm_" : "cgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, pc, pc, pint,
pc, pint, pc, pc, pint, integer_type_node,
integer_type_node);
gfor_fndecl_zgemm = gfc_build_library_function_decl
(get_identifier
- (gfc_option.flag_underscoring ? "zgemm_"
- : "zgemm"),
+ (flag_underscoring ? "zgemm_" : "zgemm"),
void_type_node, 15, pchar_type_node,
pchar_type_node, pint, pint, pint, pz, pz, pint,
pz, pint, pz, pz, pint, integer_type_node,
@@ -3331,7 +3327,7 @@ gfc_build_builtin_function_decls (void)
TREE_NOTHROW (gfor_fndecl_associated) = 1;
/* Coarray library calls. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree pint_type, pppchar_type;
@@ -3845,8 +3841,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
gfc_trans_dummy_character (proc_sym, proc_sym->ts.u.cl, block);
}
else
- gcc_assert (gfc_option.flag_f2c
- && proc_sym->ts.type == BT_COMPLEX);
+ gcc_assert (flag_f2c && proc_sym->ts.type == BT_COMPLEX);
}
/* Initialize the INTENT(OUT) derived type dummy arguments. This
@@ -3878,7 +3873,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
}
if (sym->ts.type == BT_CLASS
- && (sym->attr.save || gfc_option.flag_max_stack_var_size == 0)
+ && (sym->attr.save || flag_max_stack_var_size == 0)
&& CLASS_DATA (sym)->attr.allocatable)
{
tree vptr;
@@ -3895,7 +3890,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
if (CLASS_DATA (sym)->attr.dimension
|| (CLASS_DATA (sym)->attr.codimension
- && gfc_option.coarray != GFC_FCOARRAY_LIB))
+ && flag_coarray != GFC_FCOARRAY_LIB))
{
tmp = gfc_class_data_get (sym->backend_decl);
tmp = gfc_build_null_descriptor (TREE_TYPE (tmp));
@@ -4007,7 +4002,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
|| (sym->ts.type == BT_CLASS
&& CLASS_DATA (sym)->attr.allocatable)))
{
- if (!sym->attr.save && gfc_option.flag_max_stack_var_size != 0)
+ if (!sym->attr.save && flag_max_stack_var_size != 0)
{
tree descriptor = NULL_TREE;
@@ -4426,7 +4421,7 @@ gfc_create_module_variable (gfc_symbol * sym)
&& (sym->attr.access == ACCESS_UNKNOWN
&& (sym->ns->default_access == ACCESS_PRIVATE
|| (sym->ns->default_access == ACCESS_UNKNOWN
- && gfc_option.flag_module_private))))
+ && flag_module_private))))
sym->attr.access = ACCESS_PRIVATE;
if (warn_unused_variable && !sym->attr.referenced
@@ -4688,7 +4683,7 @@ gfc_emit_parameter_debug_info (gfc_symbol *sym)
sym->attr.dimension, false))
return;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && sym->attr.codimension)
+ if (flag_coarray == GFC_FCOARRAY_LIB && sym->attr.codimension)
return;
/* Create the decl for the variable or constant. */
@@ -4878,7 +4873,7 @@ gfc_generate_module_vars (gfc_namespace * ns)
gfc_traverse_ns (ns, gfc_create_module_variable);
gfc_traverse_ns (ns, create_module_nml_decl);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
+ if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
cur_module = NULL;
@@ -5377,7 +5372,7 @@ create_main_function (tree fndecl)
/* Call some libgfortran initialization routines, call then MAIN__(). */
/* Call _gfortran_caf_init (*argc, ***argv). */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree pint_type, pppchar_type;
pint_type = build_pointer_type (integer_type_node);
@@ -5425,11 +5420,9 @@ create_main_function (tree fndecl)
build_int_cst (integer_type_node,
0));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
- build_int_cst (integer_type_node,
- gfc_option.flag_backtrace));
+ build_int_cst (integer_type_node, flag_backtrace));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
- build_int_cst (integer_type_node,
- gfc_option.flag_sign_zero));
+ build_int_cst (integer_type_node, flag_sign_zero));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (integer_type_node,
(gfc_option.rtcheck
@@ -5483,33 +5476,32 @@ create_main_function (tree fndecl)
/* If this is the main program and an -fconvert option was provided,
add a call to set_convert. */
- if (gfc_option.convert != GFC_CONVERT_NATIVE)
+ if (flag_convert != GFC_FLAG_CONVERT_NATIVE)
{
tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_convert, 1,
- build_int_cst (integer_type_node,
- gfc_option.convert));
+ build_int_cst (integer_type_node, flag_convert));
gfc_add_expr_to_block (&body, tmp);
}
/* If this is the main program and an -frecord-marker option was provided,
add a call to set_record_marker. */
- if (gfc_option.record_marker != 0)
+ if (flag_record_marker != 0)
{
tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_record_marker, 1,
build_int_cst (integer_type_node,
- gfc_option.record_marker));
+ flag_record_marker));
gfc_add_expr_to_block (&body, tmp);
}
- if (gfc_option.max_subrecord_length != 0)
+ if (flag_max_subrecord_length != 0)
{
tmp = build_call_expr_loc (input_location,
gfor_fndecl_set_max_subrecord_length, 1,
build_int_cst (integer_type_node,
- gfc_option.max_subrecord_length));
+ flag_max_subrecord_length));
gfc_add_expr_to_block (&body, tmp);
}
@@ -5522,7 +5514,7 @@ create_main_function (tree fndecl)
TREE_USED (fndecl) = 1;
/* Coarray: Call _gfortran_caf_finalize(void). */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
/* Per F2008, 8.5.1 END of the main program implies a
SYNC MEMORY. */
@@ -5712,7 +5704,7 @@ gfc_generate_function_code (gfc_namespace * ns)
has_coarray_vars = false;
generate_local_vars (ns);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
+ if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
/* Keep the parent fake result declaration in module functions
@@ -5727,8 +5719,7 @@ gfc_generate_function_code (gfc_namespace * ns)
|| (sym->attr.entry_master
&& sym->ns->entries->sym->attr.recursive);
if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION)
- && !is_recursive
- && !gfc_option.flag_recursive)
+ && !is_recursive && !flag_recursive)
{
char * msg;
@@ -5826,9 +5817,7 @@ gfc_generate_function_code (gfc_namespace * ns)
/* Reset recursion-check variable. */
if ((gfc_option.rtcheck & GFC_RTCHECK_RECURSION)
- && !is_recursive
- && !gfc_option.gfc_flag_openmp
- && recurcheckvar != NULL_TREE)
+ && !is_recursive && !flag_openmp && recurcheckvar != NULL_TREE)
{
gfc_add_modify (&cleanup, recurcheckvar, boolean_false_node);
recurcheckvar = NULL;
@@ -5905,7 +5894,7 @@ gfc_generate_function_code (gfc_namespace * ns)
If there are static coarrays in this function, the nested _caf_init
function has already called cgraph_create_node, which also created
the cgraph node for this function. */
- if (!has_coarray_vars || gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (!has_coarray_vars || flag_coarray != GFC_FCOARRAY_LIB)
(void) cgraph_node::create (fndecl);
}
else
@@ -6036,7 +6025,7 @@ gfc_process_block_locals (gfc_namespace* ns)
generate_local_vars (ns);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
+ if (flag_coarray == GFC_FCOARRAY_LIB && has_coarray_vars)
generate_coarray_init (ns);
decl = saved_local_decls;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index a82203c..7772dca 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -2056,7 +2056,7 @@ gfc_conv_variable (gfc_se * se, gfc_expr * expr)
se->expr);
/* Dereference scalar hidden result. */
- if (gfc_option.flag_f2c && sym->ts.type == BT_COMPLEX
+ if (flag_f2c && sym->ts.type == BT_COMPLEX
&& (sym->attr.function || sym->attr.result)
&& !sym->attr.dimension && !sym->attr.pointer
&& !sym->attr.always_explicit)
@@ -2653,9 +2653,8 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr)
switch (expr->value.op.op)
{
case INTRINSIC_PARENTHESES:
- if ((expr->ts.type == BT_REAL
- || expr->ts.type == BT_COMPLEX)
- && gfc_option.flag_protect_parens)
+ if ((expr->ts.type == BT_REAL || expr->ts.type == BT_COMPLEX)
+ && flag_protect_parens)
{
gfc_conv_unary_op (PAREN_EXPR, se, expr);
gcc_assert (FLOAT_TYPE_P (TREE_TYPE (se->expr)));
@@ -5000,7 +4999,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
/* For descriptorless coarrays and assumed-shape coarray dummies, we
pass the token and the offset as additional arguments. */
- if (fsym && e == NULL && gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (fsym && e == NULL && flag_coarray == GFC_FCOARRAY_LIB
&& ((fsym->ts.type != BT_CLASS && fsym->attr.codimension
&& !fsym->attr.allocatable)
|| (fsym->ts.type == BT_CLASS
@@ -5012,7 +5011,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
vec_safe_push (stringargs, build_int_cst (gfc_array_index_type, 0));
gcc_assert (fsym->attr.optional);
}
- else if (fsym && gfc_option.coarray == GFC_FCOARRAY_LIB
+ else if (fsym && flag_coarray == GFC_FCOARRAY_LIB
&& ((fsym->ts.type != BT_CLASS && fsym->attr.codimension
&& !fsym->attr.allocatable)
|| (fsym->ts.type == BT_CLASS
@@ -5176,7 +5175,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
/* If the lhs of an assignment x = f(..) is allocatable and
f2003 is allowed, we must do the automatic reallocation.
TODO - deal with intrinsics, without using a temporary. */
- if (gfc_option.flag_realloc_lhs
+ if (flag_realloc_lhs
&& se->ss && se->ss->loop_chain
&& se->ss->loop_chain->is_alloc_lhs
&& !expr->value.function.isym
@@ -5214,8 +5213,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
f2003 is allowed, we must not generate the function call
here but should just send back the results of the mapping.
This is signalled by the function ss being flagged. */
- if (gfc_option.flag_realloc_lhs
- && se->ss && se->ss->is_alloc_lhs)
+ if (flag_realloc_lhs && se->ss && se->ss->is_alloc_lhs)
{
gfc_free_interface_mapping (&mapping);
return has_alternate_specifier;
@@ -5250,8 +5248,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
f2003 is allowed, we must not generate the function call
here but should just send back the results of the mapping.
This is signalled by the function ss being flagged. */
- if (gfc_option.flag_realloc_lhs
- && se->ss && se->ss->is_alloc_lhs)
+ if (flag_realloc_lhs && se->ss && se->ss->is_alloc_lhs)
{
gfc_free_interface_mapping (&mapping);
return has_alternate_specifier;
@@ -5304,7 +5301,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
}
else
{
- gcc_assert (gfc_option.flag_f2c && ts.type == BT_COMPLEX);
+ gcc_assert (flag_f2c && ts.type == BT_COMPLEX);
type = gfc_get_complex_type (ts.kind);
var = gfc_build_addr_expr (NULL_TREE, gfc_create_var (type, "cmplx"));
@@ -5385,7 +5382,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
return a double precision result. Convert this back to default
real. We only care about the cases that can happen in Fortran 77.
*/
- if (gfc_option.flag_f2c && sym->ts.type == BT_REAL
+ if (flag_f2c && sym->ts.type == BT_REAL
&& sym->ts.kind == gfc_default_real_kind
&& !sym->attr.always_explicit)
se->expr = fold_convert (gfc_get_real_type (sym->ts.kind), se->expr);
@@ -5436,7 +5433,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
}
else
{
- gcc_assert (ts.type == BT_COMPLEX && gfc_option.flag_f2c);
+ gcc_assert (ts.type == BT_COMPLEX && flag_f2c);
se->expr = build_fold_indirect_ref_loc (input_location, var);
}
}
@@ -7409,9 +7406,7 @@ arrayfunc_assign_needs_temporary (gfc_expr * expr1, gfc_expr * expr2)
need a temporary except in the particular case that reallocation
on assignment is active and the lhs is allocatable and a target. */
if (expr2->value.function.isym)
- return (gfc_option.flag_realloc_lhs
- && sym->attr.allocatable
- && sym->attr.target);
+ return (flag_realloc_lhs && sym->attr.allocatable && sym->attr.target);
/* If the LHS is a dummy, we need a temporary if it is not
INTENT(OUT). */
@@ -7652,7 +7647,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_expr * expr2)
calls, the array data is freed and the library takes care of allocation.
TODO: Add logic of trans-array.c: gfc_alloc_allocatable_for_assignment
to the library. */
- if (gfc_option.flag_realloc_lhs
+ if (flag_realloc_lhs
&& gfc_is_reallocatable_lhs (expr1)
&& !gfc_expr_attr (expr1).codimension
&& !gfc_is_coindexed (expr1)
@@ -8312,8 +8307,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
otherwise the character length of the result is not known.
NOTE: This relies on having the exact dependence of the length type
parameter available to the caller; gfortran saves it in the .mod files. */
- if (gfc_option.flag_realloc_lhs && expr2->ts.type == BT_CHARACTER
- && expr1->ts.deferred)
+ if (flag_realloc_lhs && expr2->ts.type == BT_CHARACTER && expr1->ts.deferred)
gfc_add_block_to_block (&block, &rse.pre);
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
@@ -8325,8 +8319,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
if (lss == gfc_ss_terminator)
{
/* F2003: Add the code for reallocation on assignment. */
- if (gfc_option.flag_realloc_lhs
- && is_scalar_reallocatable_lhs (expr1))
+ if (flag_realloc_lhs && is_scalar_reallocatable_lhs (expr1))
alloc_scalar_allocatable_for_assignment (&block, rse.string_length,
expr1, expr2);
@@ -8366,7 +8359,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
}
/* F2003: Allocate or reallocate lhs of allocatable array. */
- if (gfc_option.flag_realloc_lhs
+ if (flag_realloc_lhs
&& gfc_is_reallocatable_lhs (expr1)
&& !gfc_expr_attr (expr1).codimension
&& !gfc_is_coindexed (expr1)
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index bd3962e..0cce3cb 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -1106,7 +1106,7 @@ gfc_conv_intrinsic_caf_get (gfc_se *se, gfc_expr *expr, tree lhs, tree lhs_kind,
tree caf_decl, token, offset, image_index, tmp;
tree res_var, dst_var, type, kind, vec;
- gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+ gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
if (se->ss && se->ss->info->useflags)
{
@@ -1236,7 +1236,7 @@ conv_caf_send (gfc_code *code) {
tree lhs_type = NULL_TREE;
tree vec = null_pointer_node, rhs_vec = null_pointer_node;
- gcc_assert (gfc_option.coarray == GFC_FCOARRAY_LIB);
+ gcc_assert (flag_coarray == GFC_FCOARRAY_LIB);
lhs_expr = code->ext.actual->expr;
rhs_expr = code->ext.actual->next->expr;
@@ -1404,7 +1404,7 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
distance = expr->value.function.actual->expr;
/* The case -fcoarray=single is handled elsewhere. */
- gcc_assert (gfc_option.coarray != GFC_FCOARRAY_SINGLE);
+ gcc_assert (flag_coarray != GFC_FCOARRAY_SINGLE);
/* Argument-free version: THIS_IMAGE(). */
if (distance || expr->value.function.actual->expr == NULL)
@@ -1716,7 +1716,7 @@ trans_image_index (gfc_se * se, gfc_expr *expr)
/* Return 0 if "coindex" exceeds num_images(). */
- if (gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ if (flag_coarray == GFC_FCOARRAY_SINGLE)
num_images = build_int_cst (type, 1);
else
{
@@ -2098,7 +2098,7 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr)
where size is the product of the extent of all but the last
codimension. */
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE && corank > 1)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE && corank > 1)
{
tree cosize;
@@ -2116,7 +2116,7 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr)
resbound = fold_build2_loc (input_location, PLUS_EXPR,
gfc_array_index_type, resbound, tmp);
}
- else if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ else if (flag_coarray != GFC_FCOARRAY_SINGLE)
{
/* ubound = lbound + num_images() - 1. */
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_num_images,
@@ -2470,7 +2470,7 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr)
/* We explicitly have to ignore the minus sign. We do so by using
result = (arg1 == 0) ? abs(arg0) : copysign(arg0, arg1). */
- if (!gfc_option.flag_sign_zero
+ if (!flag_sign_zero
&& MODE_HAS_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (args[1]))))
{
tree cond, zero;
@@ -2978,7 +2978,7 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
{
tree cint = gfc_get_int_type (gfc_c_int_kind);
- if (gfc_option.flag_external_blas
+ if (flag_external_blas
&& (sym->ts.type == BT_REAL || sym->ts.type == BT_COMPLEX)
&& (sym->ts.kind == 4 || sym->ts.kind == 8))
{
@@ -3002,7 +3002,7 @@ gfc_conv_intrinsic_funcall (gfc_se * se, gfc_expr * expr)
vec_alloc (append_args, 3);
append_args->quick_push (build_int_cst (cint, 1));
append_args->quick_push (build_int_cst (cint,
- gfc_option.blas_matmul_limit));
+ flag_blas_matmul_limit));
append_args->quick_push (gfc_build_addr_expr (NULL_TREE,
gemm_fndecl));
}
@@ -8137,7 +8137,7 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
case GFC_ISYM_THIS_IMAGE:
/* For num_images() == 1, handle as LCOBOUND. */
if (expr->value.function.actual->expr
- && gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ && flag_coarray == GFC_FCOARRAY_SINGLE)
conv_intrinsic_cobound (se, expr);
else
trans_this_image (se, expr);
@@ -8592,16 +8592,16 @@ conv_co_collective (gfc_code *code)
gfc_add_block_to_block (&block, &argse.pre);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
- if (gfc_option.coarray != GFC_FCOARRAY_SINGLE)
+ if (flag_coarray != GFC_FCOARRAY_SINGLE)
stat = gfc_build_addr_expr (NULL_TREE, stat);
}
- else if (gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ else if (flag_coarray == GFC_FCOARRAY_SINGLE)
stat = NULL_TREE;
else
stat = null_pointer_node;
/* Early exit for GFC_FCOARRAY_SINGLE. */
- if (gfc_option.coarray == GFC_FCOARRAY_SINGLE)
+ if (flag_coarray == GFC_FCOARRAY_SINGLE)
{
if (stat != NULL_TREE)
gfc_add_modify (&block, stat,
@@ -8761,7 +8761,7 @@ conv_intrinsic_atomic_op (gfc_code *code)
atom = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& code->ext.actual->next->expr->ts.kind == atom_expr->ts.kind)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->expr);
@@ -8777,12 +8777,12 @@ conv_intrinsic_atomic_op (gfc_code *code)
case GFC_ISYM_ATOMIC_OR:
case GFC_ISYM_ATOMIC_XOR:
stat_expr = code->ext.actual->next->next->expr;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
old = null_pointer_node;
break;
default:
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
@@ -8796,17 +8796,17 @@ conv_intrinsic_atomic_op (gfc_code *code)
{
gcc_assert (stat_expr->expr_type == EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr_val (&argse, stat_expr);
gfc_add_block_to_block (&block, &argse.pre);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ else if (flag_coarray == GFC_FCOARRAY_LIB)
stat = null_pointer_node;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree image_index, caf_decl, offset, token;
int op;
@@ -8960,7 +8960,7 @@ conv_intrinsic_atomic_ref (gfc_code *code)
atom = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& code->ext.actual->expr->ts.kind == atom_expr->ts.kind)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->expr);
@@ -8974,17 +8974,17 @@ conv_intrinsic_atomic_ref (gfc_code *code)
gcc_assert (code->ext.actual->next->next->expr->expr_type
== EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr_val (&argse, code->ext.actual->next->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ else if (flag_coarray == GFC_FCOARRAY_LIB)
stat = null_pointer_node;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree image_index, caf_decl, offset, token;
tree orig_value = NULL_TREE, vardecl = NULL_TREE;
@@ -9061,7 +9061,7 @@ conv_intrinsic_atomic_cas (gfc_code *code)
atom = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
@@ -9069,7 +9069,7 @@ conv_intrinsic_atomic_cas (gfc_code *code)
old = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr (&argse, code->ext.actual->next->next->expr);
gfc_add_block_to_block (&block, &argse.pre);
@@ -9077,7 +9077,7 @@ conv_intrinsic_atomic_cas (gfc_code *code)
comp = argse.expr;
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& code->ext.actual->next->next->next->expr->ts.kind
== atom_expr->ts.kind)
argse.want_pointer = 1;
@@ -9092,7 +9092,7 @@ conv_intrinsic_atomic_cas (gfc_code *code)
gcc_assert (code->ext.actual->next->next->next->next->expr->expr_type
== EXPR_VARIABLE);
gfc_init_se (&argse, NULL);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
argse.want_pointer = 1;
gfc_conv_expr_val (&argse,
code->ext.actual->next->next->next->next->expr);
@@ -9100,10 +9100,10 @@ conv_intrinsic_atomic_cas (gfc_code *code)
gfc_add_block_to_block (&post_block, &argse.post);
stat = argse.expr;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ else if (flag_coarray == GFC_FCOARRAY_LIB)
stat = null_pointer_node;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tree image_index, caf_decl, offset, token;
@@ -9357,7 +9357,7 @@ conv_intrinsic_move_alloc (gfc_code *code)
/* For coarrays, call SYNC ALL if TO is already deallocated as MOVE_ALLOC
is an image control "statement", cf. IR F08/0040 in 12-006A. */
- if (coarray && gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (coarray && flag_coarray == GFC_FCOARRAY_LIB)
{
tree cond;
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index c7edcad..707a089 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -3435,7 +3435,7 @@ gfc_trans_omp_do_simd (gfc_code *code, stmtblock_t *pblock,
clausesa = clausesa_buf;
gfc_split_omp_clauses (code, clausesa);
}
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
omp_do_clauses
= gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_DO], code->loc);
body = gfc_trans_omp_do (code, EXEC_OMP_SIMD, pblock ? pblock : &block,
@@ -3449,7 +3449,7 @@ gfc_trans_omp_do_simd (gfc_code *code, stmtblock_t *pblock,
}
else if (TREE_CODE (body) != BIND_EXPR)
body = build3_v (BIND_EXPR, NULL, body, NULL_TREE);
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
{
stmt = make_node (OMP_FOR);
TREE_TYPE (stmt) = void_type_node;
@@ -3527,7 +3527,7 @@ gfc_trans_omp_parallel_do_simd (gfc_code *code, stmtblock_t *pblock,
clausesa = clausesa_buf;
gfc_split_omp_clauses (code, clausesa);
}
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
omp_clauses
= gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_PARALLEL],
code->loc);
@@ -3543,7 +3543,7 @@ gfc_trans_omp_parallel_do_simd (gfc_code *code, stmtblock_t *pblock,
}
else if (TREE_CODE (stmt) != BIND_EXPR)
stmt = build3_v (BIND_EXPR, NULL, stmt, NULL_TREE);
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
{
stmt = build2_loc (input_location, OMP_PARALLEL, void_type_node, stmt,
omp_clauses);
@@ -3698,7 +3698,7 @@ gfc_trans_omp_distribute (gfc_code *code, gfc_omp_clauses *clausesa)
clausesa = clausesa_buf;
gfc_split_omp_clauses (code, clausesa);
}
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
omp_clauses
= gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_DISTRIBUTE],
code->loc);
@@ -3741,7 +3741,7 @@ gfc_trans_omp_distribute (gfc_code *code, gfc_omp_clauses *clausesa)
default:
gcc_unreachable ();
}
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
{
tree distribute = make_node (OMP_DISTRIBUTE);
TREE_TYPE (distribute) = void_type_node;
@@ -3766,7 +3766,7 @@ gfc_trans_omp_teams (gfc_code *code, gfc_omp_clauses *clausesa)
clausesa = clausesa_buf;
gfc_split_omp_clauses (code, clausesa);
}
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
omp_clauses
= gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_TEAMS],
code->loc);
@@ -3801,7 +3801,7 @@ gfc_trans_omp_target (gfc_code *code)
gfc_start_block (&block);
gfc_split_omp_clauses (code, clausesa);
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
omp_clauses
= gfc_trans_omp_clauses (&block, &clausesa[GFC_OMP_SPLIT_TARGET],
code->loc);
@@ -3811,7 +3811,7 @@ gfc_trans_omp_target (gfc_code *code)
stmt = gfc_trans_omp_teams (code, clausesa);
if (TREE_CODE (stmt) != BIND_EXPR)
stmt = build3_v (BIND_EXPR, NULL, stmt, NULL_TREE);
- if (gfc_option.gfc_flag_openmp)
+ if (flag_openmp)
stmt = build2_loc (input_location, OMP_TARGET, void_type_node, stmt,
omp_clauses);
gfc_add_expr_to_block (&block, stmt);
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 1ba382a..47edd32 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -627,7 +627,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop)
gfc_init_se (&se, NULL);
gfc_start_block (&se.pre);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && !error_stop)
+ if (flag_coarray == GFC_FCOARRAY_LIB && !error_stop)
{
/* Per F2008, 8.5.1 STOP implies a SYNC MEMORY. */
tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
@@ -643,7 +643,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop)
tmp = build_int_cst (gfc_int4_type_node, 0);
tmp = build_call_expr_loc (input_location,
error_stop
- ? (gfc_option.coarray == GFC_FCOARRAY_LIB
+ ? (flag_coarray == GFC_FCOARRAY_LIB
? gfor_fndecl_caf_error_stop_str
: gfor_fndecl_error_stop_string)
: gfor_fndecl_stop_string,
@@ -654,7 +654,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop)
gfc_conv_expr (&se, code->expr1);
tmp = build_call_expr_loc (input_location,
error_stop
- ? (gfc_option.coarray == GFC_FCOARRAY_LIB
+ ? (flag_coarray == GFC_FCOARRAY_LIB
? gfor_fndecl_caf_error_stop
: gfor_fndecl_error_stop_numeric)
: gfor_fndecl_stop_numeric_f08, 1,
@@ -665,7 +665,7 @@ gfc_trans_stop (gfc_code *code, bool error_stop)
gfc_conv_expr_reference (&se, code->expr1);
tmp = build_call_expr_loc (input_location,
error_stop
- ? (gfc_option.coarray == GFC_FCOARRAY_LIB
+ ? (flag_coarray == GFC_FCOARRAY_LIB
? gfor_fndecl_caf_error_stop_str
: gfor_fndecl_error_stop_string)
: gfor_fndecl_stop_string,
@@ -688,7 +688,7 @@ gfc_trans_lock_unlock (gfc_code *code, gfc_exec_op type ATTRIBUTE_UNUSED)
/* Short cut: For single images without STAT= or LOCK_ACQUIRED
return early. (ERRMSG= is always untouched for -fcoarray=single.) */
- if (!code->expr2 && !code->expr4 && gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (!code->expr2 && !code->expr4 && flag_coarray != GFC_FCOARRAY_LIB)
return NULL_TREE;
gfc_init_se (&se, NULL);
@@ -733,7 +733,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
/* Short cut: For single images without bound checking or without STAT=,
return early. (ERRMSG= is always untouched for -fcoarray=single.) */
if (!code->expr2 && !(gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
- && gfc_option.coarray != GFC_FCOARRAY_LIB)
+ && flag_coarray != GFC_FCOARRAY_LIB)
return NULL_TREE;
gfc_init_se (&se, NULL);
@@ -756,7 +756,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
else
stat = null_pointer_node;
- if (code->expr3 && gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (code->expr3 && flag_coarray == GFC_FCOARRAY_LIB
&& type != EXEC_SYNC_MEMORY)
{
gcc_assert (code->expr3->expr_type == EXPR_VARIABLE);
@@ -766,7 +766,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
errmsg = gfc_build_addr_expr (NULL, argse.expr);
errmsglen = argse.string_length;
}
- else if (gfc_option.coarray == GFC_FCOARRAY_LIB && type != EXEC_SYNC_MEMORY)
+ else if (flag_coarray == GFC_FCOARRAY_LIB && type != EXEC_SYNC_MEMORY)
{
errmsg = null_pointer_node;
errmsglen = build_int_cst (integer_type_node, 0);
@@ -778,7 +778,7 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
&& code->expr1->rank == 0)
{
tree cond;
- if (gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (flag_coarray != GFC_FCOARRAY_LIB)
cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
images, build_int_cst (TREE_TYPE (images), 1));
else
@@ -803,14 +803,14 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
/* Per F2008, 8.5.1, a SYNC MEMORY is implied by calling the
image control statements SYNC IMAGES and SYNC ALL. */
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tmp = builtin_decl_explicit (BUILT_IN_SYNC_SYNCHRONIZE);
tmp = build_call_expr_loc (input_location, tmp, 0);
gfc_add_expr_to_block (&se.pre, tmp);
}
- if (gfc_option.coarray != GFC_FCOARRAY_LIB || type == EXEC_SYNC_MEMORY)
+ if (flag_coarray != GFC_FCOARRAY_LIB || type == EXEC_SYNC_MEMORY)
{
/* Set STAT to zero. */
if (code->expr2)
@@ -1115,7 +1115,7 @@ gfc_trans_critical (gfc_code *code)
gfc_start_block (&block);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
token = gfc_get_symbol_decl (code->resolved_sym);
token = GFC_TYPE_ARRAY_CAF_TOKEN (TREE_TYPE (token));
@@ -1129,7 +1129,7 @@ gfc_trans_critical (gfc_code *code)
tmp = gfc_trans_code (code->block->next);
gfc_add_expr_to_block (&block, tmp);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (flag_coarray == GFC_FCOARRAY_LIB)
{
tmp = build_call_expr_loc (input_location, gfor_fndecl_caf_unlock, 6,
token, integer_zero_node, integer_one_node,
@@ -5328,11 +5328,11 @@ gfc_trans_allocate (gfc_code * code)
{
/* Switch off automatic reallocation since we have just done
the ALLOCATE. */
- int realloc_lhs = gfc_option.flag_realloc_lhs;
- gfc_option.flag_realloc_lhs = 0;
+ int realloc_lhs = flag_realloc_lhs;
+ flag_realloc_lhs = 0;
tmp = gfc_trans_assignment (gfc_expr_to_initialize (expr),
rhs, false, false);
- gfc_option.flag_realloc_lhs = realloc_lhs;
+ flag_realloc_lhs = realloc_lhs;
}
gfc_free_expr (rhs);
gfc_add_expr_to_block (&block, tmp);
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 12536e9..cdc5897 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -493,7 +493,7 @@ gfc_init_kinds (void)
gfc_numeric_storage_size = 4 * 8;
- if (gfc_option.flag_default_integer)
+ if (flag_default_integer)
{
if (!saw_i8)
gfc_fatal_error ("INTEGER(KIND=8) is not available for "
@@ -502,7 +502,7 @@ gfc_init_kinds (void)
gfc_default_integer_kind = 8;
}
- else if (gfc_option.flag_integer4_kind == 8)
+ else if (flag_integer4_kind == 8)
{
if (!saw_i8)
gfc_fatal_error ("INTEGER(KIND=8) is not available for "
@@ -521,7 +521,7 @@ gfc_init_kinds (void)
}
/* Choose the default real kind. Again, we choose 4 when possible. */
- if (gfc_option.flag_default_real)
+ if (flag_default_real)
{
if (!saw_r8)
gfc_fatal_error ("REAL(KIND=8) is not available for "
@@ -529,7 +529,7 @@ gfc_init_kinds (void)
gfc_default_real_kind = 8;
}
- else if (gfc_option.flag_real4_kind == 8)
+ else if (flag_real4_kind == 8)
{
if (!saw_r8)
gfc_fatal_error ("REAL(KIND=8) is not available for %<-freal-4-real-8%> "
@@ -537,7 +537,7 @@ gfc_init_kinds (void)
gfc_default_real_kind = 8;
}
- else if (gfc_option.flag_real4_kind == 10)
+ else if (flag_real4_kind == 10)
{
if (!saw_r10)
gfc_fatal_error ("REAL(KIND=10) is not available for "
@@ -545,7 +545,7 @@ gfc_init_kinds (void)
gfc_default_real_kind = 10;
}
- else if (gfc_option.flag_real4_kind == 16)
+ else if (flag_real4_kind == 16)
{
if (!saw_r16)
gfc_fatal_error ("REAL(KIND=16) is not available for "
@@ -562,15 +562,15 @@ gfc_init_kinds (void)
are specified, we use kind=8, if it's available. If -fdefault-real is
specified without -fdefault-double, we use kind=16, if it's available.
Otherwise we do not change anything. */
- if (gfc_option.flag_default_double && !gfc_option.flag_default_real)
+ if (flag_default_double && !flag_default_real)
gfc_fatal_error ("Use of %<-fdefault-double-8%> requires "
"%<-fdefault-real-8%>");
- if (gfc_option.flag_default_real && gfc_option.flag_default_double && saw_r8)
+ if (flag_default_real && flag_default_double && saw_r8)
gfc_default_double_kind = 8;
- else if (gfc_option.flag_default_real && saw_r16)
+ else if (flag_default_real && saw_r16)
gfc_default_double_kind = 16;
- else if (gfc_option.flag_real8_kind == 4)
+ else if (flag_real8_kind == 4)
{
if (!saw_r4)
gfc_fatal_error ("REAL(KIND=4) is not available for "
@@ -578,7 +578,7 @@ gfc_init_kinds (void)
gfc_default_double_kind = 4;
}
- else if (gfc_option.flag_real8_kind == 10 )
+ else if (flag_real8_kind == 10 )
{
if (!saw_r10)
gfc_fatal_error ("REAL(KIND=10) is not available for "
@@ -586,7 +586,7 @@ gfc_init_kinds (void)
gfc_default_double_kind = 10;
}
- else if (gfc_option.flag_real8_kind == 16 )
+ else if (flag_real8_kind == 16 )
{
if (!saw_r16)
gfc_fatal_error ("REAL(KIND=10) is not available for "
@@ -1648,7 +1648,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
if (as->rank == 0)
{
- if (packed != PACKED_STATIC || gfc_option.coarray == GFC_FCOARRAY_LIB)
+ if (packed != PACKED_STATIC || flag_coarray == GFC_FCOARRAY_LIB)
{
type = build_pointer_type (type);
@@ -1702,7 +1702,7 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed,
}
if (packed != PACKED_STATIC || !known_stride
- || (as->corank && gfc_option.coarray == GFC_FCOARRAY_LIB))
+ || (as->corank && flag_coarray == GFC_FCOARRAY_LIB))
{
/* For dummy arrays and automatic (heap allocated) arrays we
want a pointer to the array. */
@@ -1734,7 +1734,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted,
gcc_assert (codimen + dimen >= 0 && codimen + dimen <= GFC_MAX_DIMENSIONS);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && codimen)
+ if (flag_coarray == GFC_FCOARRAY_LIB && codimen)
{
if (gfc_array_descriptor_base_caf[idx])
return gfc_array_descriptor_base_caf[idx];
@@ -1782,7 +1782,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted,
TREE_NO_WARNING (decl) = 1;
}
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && codimen
+ if (flag_coarray == GFC_FCOARRAY_LIB && codimen
&& akind == GFC_ARRAY_ALLOCATABLE)
{
decl = gfc_add_field_to_struct_1 (fat_type,
@@ -1795,7 +1795,7 @@ gfc_get_array_descriptor_base (int dimen, int codimen, bool restricted,
gfc_finish_type (fat_type);
TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (fat_type)) = 1;
- if (gfc_option.coarray == GFC_FCOARRAY_LIB && codimen
+ if (flag_coarray == GFC_FCOARRAY_LIB && codimen
&& akind == GFC_ARRAY_ALLOCATABLE)
gfc_array_descriptor_base_caf[idx] = fat_type;
else
@@ -2447,7 +2447,7 @@ gfc_get_derived_type (gfc_symbol * derived)
/* We see this derived type first time, so build the type node. */
typenode = make_node (RECORD_TYPE);
TYPE_NAME (typenode) = get_identifier (derived->name);
- TYPE_PACKED (typenode) = gfc_option.flag_pack_derived;
+ TYPE_PACKED (typenode) = flag_pack_derived;
derived->backend_decl = typenode;
}
@@ -2630,8 +2630,7 @@ gfc_return_by_reference (gfc_symbol * sym)
-fno-f2c calling convention), nor for calls to functions which always
require an explicit interface, as no compatibility problems can
arise there. */
- if (gfc_option.flag_f2c
- && sym->ts.type == BT_COMPLEX
+ if (flag_f2c && sym->ts.type == BT_COMPLEX
&& !sym->attr.intrinsic && !sym->attr.always_explicit)
return 1;
@@ -2865,8 +2864,7 @@ arg_type_list_done:
type = void_type_node;
else if (sym->attr.mixed_entry_master)
type = gfc_get_mixed_entry_union (sym->ns);
- else if (gfc_option.flag_f2c
- && sym->ts.type == BT_REAL
+ else if (flag_f2c && sym->ts.type == BT_REAL
&& sym->ts.kind == gfc_default_real_kind
&& !sym->attr.always_explicit)
{
@@ -3046,6 +3044,7 @@ gfc_get_array_descr_info (const_tree type, struct array_descr_info *info)
memset (info, '\0', sizeof (*info));
info->ndimensions = rank;
+ info->ordering = array_descr_ordering_column_major;
info->element_type = etype;
ptype = build_pointer_type (gfc_array_index_type);
base_decl = GFC_TYPE_ARRAY_BASE_DECL (type, indirect);
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 76fe7fd..7c54b8e 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -772,7 +772,7 @@ gfc_allocate_allocatable (stmtblock_t * block, tree mem, tree size, tree token,
gfc_allocate_using_lib. */
gfc_start_block (&alloc_block);
- if (gfc_option.coarray == GFC_FCOARRAY_LIB
+ if (flag_coarray == GFC_FCOARRAY_LIB
&& gfc_expr_attr (expr).codimension)
{
tree cond;
@@ -1263,7 +1263,7 @@ 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 || gfc_option.coarray != GFC_FCOARRAY_LIB)
+ if (!coarray || flag_coarray != GFC_FCOARRAY_LIB)
{
tmp = build_call_expr_loc (input_location,
builtin_decl_explicit (BUILT_IN_FREE), 1,
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 756d54f..70a5f60 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -3171,7 +3171,8 @@ parser::parse_simplify (source_location match_location,
expr *result)
{
/* Reset the capture map. */
- capture_ids = new cid_map_t;
+ if (!capture_ids)
+ capture_ids = new cid_map_t;
/* Reset oper_lists and set. */
hash_set <user_id *> olist;
oper_lists_set = &olist;
@@ -3489,7 +3490,10 @@ parser::parse_pattern ()
const cpp_token *token = peek ();
const char *id = get_ident ();
if (strcmp (id, "simplify") == 0)
- parse_simplify (token->src_loc, simplifiers, NULL, NULL);
+ {
+ parse_simplify (token->src_loc, simplifiers, NULL, NULL);
+ capture_ids = NULL;
+ }
else if (strcmp (id, "match") == 0)
{
bool with_args = false;
@@ -3514,6 +3518,7 @@ parser::parse_pattern ()
expr *e = NULL;
if (with_args)
{
+ capture_ids = new cid_map_t;
e = new expr (p);
while (peek ()->type == CPP_ATSIGN)
e->append_op (parse_capture (NULL));
@@ -3525,6 +3530,7 @@ parser::parse_pattern ()
fatal_at (token, "non-matching number of match operands");
p->nargs = e ? e->ops.length () : 0;
parse_simplify (token->src_loc, p->matchers, p, e);
+ capture_ids = NULL;
}
else if (strcmp (id, "for") == 0)
parse_for (token->src_loc);
@@ -3562,6 +3568,7 @@ parser::parser (cpp_reader *r_)
simplifiers = vNULL;
oper_lists_set = NULL;
oper_lists = vNULL;
+ capture_ids = NULL;
user_predicates = vNULL;
parsing_match_operand = false;
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index f6d4381..6f5acc1 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -302,6 +302,9 @@ Expression::convert_interface_to_interface(Type *lhs_type, Expression* rhs,
bool for_type_guard,
Location location)
{
+ if (Type::are_identical(lhs_type, rhs->type(), false, NULL))
+ return rhs;
+
Interface_type* lhs_interface_type = lhs_type->interface_type();
bool lhs_is_empty = lhs_interface_type->is_empty();
@@ -313,6 +316,9 @@ Expression::convert_interface_to_interface(Type *lhs_type, Expression* rhs,
// to do a runtime check, although we still need to build a new
// method table.
+ // We are going to evaluate RHS multiple times.
+ go_assert(rhs->is_variable());
+
// Get the type descriptor for the right hand side. This will be
// NULL for a nil interface.
Expression* rhs_type_expr = Expression::get_interface_type_descriptor(rhs);
@@ -355,6 +361,9 @@ Expression*
Expression::convert_interface_to_type(Type *lhs_type, Expression* rhs,
Location location)
{
+ // We are going to evaluate RHS multiple times.
+ go_assert(rhs->is_variable());
+
// Call a function to check that the type is valid. The function
// will panic with an appropriate runtime type error if the type is
// not valid.
@@ -3155,8 +3164,7 @@ Type_conversion_expression::do_flatten(Gogo*, Named_object*,
{
if (((this->type()->is_string_type()
&& this->expr_->type()->is_slice_type())
- || (this->type()->interface_type() != NULL
- && this->expr_->type()->interface_type() != NULL))
+ || this->expr_->type()->interface_type() != NULL)
&& !this->expr_->is_variable())
{
Temporary_statement* temp =
@@ -3551,7 +3559,8 @@ Unsafe_type_conversion_expression::do_get_backend(Translate_context* context)
|| et->function_type() != NULL
|| et->points_to() != NULL
|| et->map_type() != NULL
- || et->channel_type() != NULL);
+ || et->channel_type() != NULL
+ || et->is_nil_type());
else
go_unreachable();
@@ -6878,7 +6887,11 @@ Builtin_call_expression::do_flatten(Gogo*, Named_object*,
++pa)
{
if ((*pa)->is_nil_expression())
- *pa = Expression::make_slice_composite_literal(at, NULL, loc);
+ {
+ Expression* nil = Expression::make_nil(loc);
+ Expression* zero = Expression::make_integer_ul(0, NULL, loc);
+ *pa = Expression::make_slice_value(at, nil, zero, zero, loc);
+ }
if (!(*pa)->is_variable())
{
Temporary_statement* temp =
@@ -8778,12 +8791,17 @@ Call_expression::do_flatten(Gogo* gogo, Named_object*,
else
{
Location loc = (*pa)->location();
- Expression* arg =
- Expression::convert_for_assignment(gogo, pp->type(), *pa, loc);
- Temporary_statement* temp =
- Statement::make_temporary(pp->type(), arg, loc);
- inserter->insert(temp);
- args->push_back(Expression::make_temporary_reference(temp, loc));
+ Expression* arg = *pa;
+ if (!arg->is_variable())
+ {
+ Temporary_statement *temp =
+ Statement::make_temporary(NULL, arg, loc);
+ inserter->insert(temp);
+ arg = Expression::make_temporary_reference(temp, loc);
+ }
+ arg = Expression::convert_for_assignment(gogo, pp->type(), arg,
+ loc);
+ args->push_back(arg);
}
}
delete this->args_;
@@ -11588,13 +11606,19 @@ class Struct_construction_expression : public Expression
do_copy()
{
Struct_construction_expression* ret =
- new Struct_construction_expression(this->type_, this->vals_->copy(),
+ new Struct_construction_expression(this->type_,
+ (this->vals_ == NULL
+ ? NULL
+ : this->vals_->copy()),
this->location());
if (this->traverse_order_ != NULL)
ret->set_traverse_order(this->traverse_order_);
return ret;
}
+ Expression*
+ do_flatten(Gogo*, Named_object*, Statement_inserter*);
+
Bexpression*
do_get_backend(Translate_context*);
@@ -11769,6 +11793,39 @@ Struct_construction_expression::do_check_types(Gogo*)
go_assert(pv == this->vals_->end());
}
+// Flatten a struct construction expression. Store the values into
+// temporaries in case they need interface conversion.
+
+Expression*
+Struct_construction_expression::do_flatten(Gogo*, Named_object*,
+ Statement_inserter* inserter)
+{
+ if (this->vals_ == NULL)
+ return this;
+
+ // If this is a constant struct, we don't need temporaries.
+ if (this->is_constant_struct())
+ return this;
+
+ Location loc = this->location();
+ for (Expression_list::iterator pv = this->vals_->begin();
+ pv != this->vals_->end();
+ ++pv)
+ {
+ if (*pv != NULL)
+ {
+ if (!(*pv)->is_variable())
+ {
+ Temporary_statement* temp =
+ Statement::make_temporary(NULL, *pv, loc);
+ inserter->insert(temp);
+ *pv = Expression::make_temporary_reference(temp, loc);
+ }
+ }
+ }
+ return this;
+}
+
// Return the backend representation for constructing a struct.
Bexpression*
@@ -11902,6 +11959,9 @@ protected:
vals()
{ return this->vals_; }
+ Expression*
+ do_flatten(Gogo*, Named_object*, Statement_inserter*);
+
// Get the backend constructor for the array values.
Bexpression*
get_constructor(Translate_context* context, Btype* btype);
@@ -12017,6 +12077,39 @@ Array_construction_expression::do_check_types(Gogo*)
}
}
+// Flatten an array construction expression. Store the values into
+// temporaries in case they need interface conversion.
+
+Expression*
+Array_construction_expression::do_flatten(Gogo*, Named_object*,
+ Statement_inserter* inserter)
+{
+ if (this->vals_ == NULL)
+ return this;
+
+ // If this is a constant array, we don't need temporaries.
+ if (this->is_constant_array())
+ return this;
+
+ Location loc = this->location();
+ for (Expression_list::iterator pv = this->vals_->begin();
+ pv != this->vals_->end();
+ ++pv)
+ {
+ if (*pv != NULL)
+ {
+ if (!(*pv)->is_variable())
+ {
+ Temporary_statement* temp =
+ Statement::make_temporary(NULL, *pv, loc);
+ inserter->insert(temp);
+ *pv = Expression::make_temporary_reference(temp, loc);
+ }
+ }
+ }
+ return this;
+}
+
// Get a constructor expression for the array values.
Bexpression*
@@ -12353,7 +12446,10 @@ class Map_construction_expression : public Expression
Expression*
do_copy()
{
- return new Map_construction_expression(this->type_, this->vals_->copy(),
+ return new Map_construction_expression(this->type_,
+ (this->vals_ == NULL
+ ? NULL
+ : this->vals_->copy()),
this->location());
}
@@ -14081,7 +14177,8 @@ class Slice_value_expression : public Expression
int
Slice_value_expression::do_traverse(Traverse* traverse)
{
- if (Expression::traverse(&this->valptr_, traverse) == TRAVERSE_EXIT
+ if (Type::traverse(this->type_, traverse) == TRAVERSE_EXIT
+ || Expression::traverse(&this->valptr_, traverse) == TRAVERSE_EXIT
|| Expression::traverse(&this->len_, traverse) == TRAVERSE_EXIT
|| Expression::traverse(&this->cap_, traverse) == TRAVERSE_EXIT)
return TRAVERSE_EXIT;
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index d7f4437..49be6af 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -5830,6 +5830,21 @@ Variable::flatten_init_expression(Gogo* gogo, Named_object* function,
gogo->flatten_expression(function, inserter, &this->init_);
+ // If an interface conversion is needed, we need a temporary
+ // variable.
+ if (this->type_ != NULL
+ && !Type::are_identical(this->type_, this->init_->type(), false,
+ NULL)
+ && this->init_->type()->interface_type() != NULL
+ && !this->init_->is_variable())
+ {
+ Temporary_statement* temp =
+ Statement::make_temporary(NULL, this->init_, this->location_);
+ inserter->insert(temp);
+ this->init_ = Expression::make_temporary_reference(temp,
+ this->location_);
+ }
+
this->seen_ = false;
this->init_is_flattened_ = true;
}
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 3b5ede5..a98dd47 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -3819,7 +3819,7 @@ Parse::simple_stat(bool may_be_composite_lit, bool* return_exp,
token = this->peek_token();
if (token->is_op(OPERATOR_CHANOP))
{
- this->send_stmt(this->verify_not_sink(exp));
+ this->send_stmt(this->verify_not_sink(exp), may_be_composite_lit);
if (return_exp != NULL)
*return_exp = true;
}
@@ -3913,13 +3913,13 @@ Parse::expression_stat(Expression* exp)
// Channel = Expression .
void
-Parse::send_stmt(Expression* channel)
+Parse::send_stmt(Expression* channel, bool may_be_composite_lit)
{
go_assert(this->peek_token()->is_op(OPERATOR_CHANOP));
Location loc = this->location();
this->advance_token();
- Expression* val = this->expression(PRECEDENCE_NORMAL, false, true, NULL,
- NULL);
+ Expression* val = this->expression(PRECEDENCE_NORMAL, false,
+ may_be_composite_lit, NULL, NULL);
Statement* s = Statement::make_send_statement(channel, val, loc);
this->gogo_->add_statement(s);
}
diff --git a/gcc/go/gofrontend/parse.h b/gcc/go/gofrontend/parse.h
index 3749645..d55798b 100644
--- a/gcc/go/gofrontend/parse.h
+++ b/gcc/go/gofrontend/parse.h
@@ -245,7 +245,7 @@ class Parse
void statement_list();
bool statement_list_may_start_here();
void expression_stat(Expression*);
- void send_stmt(Expression*);
+ void send_stmt(Expression*, bool may_be_composite_lit);
void inc_dec_stat(Expression*);
void assignment(Expression*, bool may_be_composite_lit, Range_clause*);
void tuple_assignment(Expression_list*, bool may_be_composite_lit,
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 6094e5c..c84df3b 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -521,6 +521,9 @@ class Assignment_statement : public Statement
void
do_check_types(Gogo*);
+ Statement*
+ do_flatten(Gogo*, Named_object*, Block*, Statement_inserter*);
+
Bstatement*
do_get_backend(Translate_context*);
@@ -606,6 +609,28 @@ Assignment_statement::do_check_types(Gogo*)
this->set_is_error();
}
+// Flatten an assignment statement. We may need a temporary for
+// interface conversion.
+
+Statement*
+Assignment_statement::do_flatten(Gogo*, Named_object*, Block*,
+ Statement_inserter* inserter)
+{
+ if (!this->lhs_->is_sink_expression()
+ && !Type::are_identical(this->lhs_->type(), this->rhs_->type(),
+ false, NULL)
+ && this->rhs_->type()->interface_type() != NULL
+ && !this->rhs_->is_variable())
+ {
+ Temporary_statement* temp =
+ Statement::make_temporary(NULL, this->rhs_, this->location());
+ inserter->insert(temp);
+ this->rhs_ = Expression::make_temporary_reference(temp,
+ this->location());
+ }
+ return this;
+}
+
// Convert an assignment statement to the backend representation.
Bstatement*
@@ -1884,6 +1909,8 @@ Statement::make_dec_statement(Expression* expr)
// Class Thunk_statement. This is the base class for go and defer
// statements.
+Unordered_set(const Struct_type*) Thunk_statement::thunk_types;
+
// Constructor.
Thunk_statement::Thunk_statement(Statement_classification classification,
@@ -2265,7 +2292,20 @@ Thunk_statement::build_struct(Function_type* fntype)
}
}
- return Type::make_struct_type(fields, location);
+ Struct_type *st = Type::make_struct_type(fields, location);
+
+ Thunk_statement::thunk_types.insert(st);
+
+ return st;
+}
+
+// Return whether ST is a type created to hold thunk parameters.
+
+bool
+Thunk_statement::is_thunk_struct(const Struct_type* st)
+{
+ return (Thunk_statement::thunk_types.find(st)
+ != Thunk_statement::thunk_types.end());
}
// Build the thunk we are going to call. This is a brand new, albeit
@@ -2465,12 +2505,13 @@ Thunk_statement::build_thunk(Gogo* gogo, const std::string& thunk_name)
gogo->add_block(b, location);
gogo->lower_block(function, b);
- gogo->flatten_block(function, b);
// We already ran the determine_types pass, so we need to run it
// just for the call statement now. The other types are known.
call_statement->determine_types();
+ gogo->flatten_block(function, b);
+
if (may_call_recover || recover_arg != NULL)
{
// Dig up the call expression, which may have been changed
@@ -3857,7 +3898,11 @@ Switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
Expression* val = this->val_;
if (val == NULL)
val = Expression::make_boolean(true, loc);
- Temporary_statement* val_temp = Statement::make_temporary(NULL, val, loc);
+
+ Type* type = val->type();
+ if (type->is_abstract())
+ type = type->make_non_abstract_type();
+ Temporary_statement* val_temp = Statement::make_temporary(type, val, loc);
b->add_statement(val_temp);
this->clauses_->lower(b, val_temp, this->break_label());
@@ -4393,6 +4438,27 @@ Send_statement::do_check_types(Gogo*)
}
}
+// Flatten a send statement. We may need a temporary for interface
+// conversion.
+
+Statement*
+Send_statement::do_flatten(Gogo*, Named_object*, Block*,
+ Statement_inserter* inserter)
+{
+ Type* element_type = this->channel_->type()->channel_type()->element_type();
+ if (!Type::are_identical(element_type, this->val_->type(), false, NULL)
+ && this->val_->type()->interface_type() != NULL
+ && !this->val_->is_variable())
+ {
+ Temporary_statement* temp =
+ Statement::make_temporary(NULL, this->val_, this->location());
+ inserter->insert(temp);
+ this->val_ = Expression::make_temporary_reference(temp,
+ this->location());
+ }
+ return this;
+}
+
// Convert a send statement to the backend representation.
Bstatement*
@@ -4402,7 +4468,9 @@ Send_statement::do_get_backend(Translate_context* context)
Channel_type* channel_type = this->channel_->type()->channel_type();
Type* element_type = channel_type->element_type();
- Expression* val = Expression::make_cast(element_type, this->val_, loc);
+ Expression* val = Expression::convert_for_assignment(context->gogo(),
+ element_type,
+ this->val_, loc);
bool is_small;
bool can_take_address;
diff --git a/gcc/go/gofrontend/statements.h b/gcc/go/gofrontend/statements.h
index 9bb0fb5..aaad66e 100644
--- a/gcc/go/gofrontend/statements.h
+++ b/gcc/go/gofrontend/statements.h
@@ -704,6 +704,9 @@ class Send_statement : public Statement
void
do_check_types(Gogo*);
+ Statement*
+ do_flatten(Gogo*, Named_object*, Block*, Statement_inserter*);
+
Bstatement*
do_get_backend(Translate_context*);
@@ -985,6 +988,10 @@ class Thunk_statement : public Statement
bool
simplify_statement(Gogo*, Named_object*, Block*);
+ // Return whether ST is a type created to hold thunk parameters.
+ static bool
+ is_thunk_struct(const Struct_type *st);
+
protected:
int
do_traverse(Traverse* traverse);
@@ -1023,6 +1030,9 @@ class Thunk_statement : public Statement
void
thunk_field_param(int n, char* buf, size_t buflen);
+ // A list of all the struct types created for thunk statements.
+ static Unordered_set(const Struct_type*) thunk_types;
+
// The function call to be executed in a separate thread (go) or
// later (defer).
Expression* call_;
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index 6533cd4..fbcce7f 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -1593,7 +1593,9 @@ Type::type_functions(Gogo* gogo, Named_type* name, Function_type* hash_fntype,
hash_fnname = "__go_type_hash_identity";
equal_fnname = "__go_type_equal_identity";
}
- else if (!this->is_comparable())
+ else if (!this->is_comparable() ||
+ (this->struct_type() != NULL
+ && Thunk_statement::is_thunk_struct(this->struct_type())))
{
hash_fnname = "__go_type_hash_error";
equal_fnname = "__go_type_equal_error";
diff --git a/gcc/hwint.c b/gcc/hwint.c
index 9d0569b..405118e 100644
--- a/gcc/hwint.c
+++ b/gcc/hwint.c
@@ -124,22 +124,6 @@ popcount_hwi (unsigned HOST_WIDE_INT x)
#endif /* GCC_VERSION < 3004 */
-/* Compute the absolute value of X. */
-
-HOST_WIDE_INT
-abs_hwi (HOST_WIDE_INT x)
-{
- gcc_checking_assert (x != HOST_WIDE_INT_MIN);
- return x >= 0 ? x : -x;
-}
-
-/* Compute the absolute value of X as an unsigned type. */
-
-unsigned HOST_WIDE_INT
-absu_hwi (HOST_WIDE_INT x)
-{
- return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
-}
/* Compute the greatest common divisor of two numbers A and B using
Euclid's algorithm. */
diff --git a/gcc/hwint.h b/gcc/hwint.h
index fd961fd..8e1c8f5 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -264,4 +264,21 @@ zext_hwi (unsigned HOST_WIDE_INT src, unsigned int prec)
}
}
+/* Compute the absolute value of X. */
+
+inline HOST_WIDE_INT
+abs_hwi (HOST_WIDE_INT x)
+{
+ gcc_checking_assert (x != HOST_WIDE_INT_MIN);
+ return x >= 0 ? x : -x;
+}
+
+/* Compute the absolute value of X as an unsigned type. */
+
+inline unsigned HOST_WIDE_INT
+absu_hwi (HOST_WIDE_INT x)
+{
+ return x >= 0 ? (unsigned HOST_WIDE_INT)x : -(unsigned HOST_WIDE_INT)x;
+}
+
#endif /* ! GCC_HWINT_H */
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index b193200..244edaa 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -101,6 +101,7 @@ along with GCC; see the file COPYING3. If not see
#include <list>
#include "ipa-icf-gimple.h"
#include "ipa-icf.h"
+#include "varasm.h"
using namespace ipa_icf_gimple;
@@ -624,6 +625,13 @@ sem_function::merge (sem_item *alias_item)
return false;
}
+ if (!decl_binds_to_current_def_p (alias->decl))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Declaration does not bind to currect definition.\n\n");
+ return false;
+ }
+
if (redirect_callers)
{
/* If alias is non-overwritable then
@@ -1131,10 +1139,14 @@ sem_variable::parse (varpool_node *node, bitmap_obstack *stack)
tree decl = node->decl;
bool readonly = TYPE_P (decl) ? TYPE_READONLY (decl) : TREE_READONLY (decl);
- bool can_handle = readonly && (DECL_VIRTUAL_P (decl)
- || !TREE_ADDRESSABLE (decl));
+ if (!readonly)
+ return NULL;
+
+ bool can_handle = DECL_VIRTUAL_P (decl)
+ || flag_merge_constants >= 2
+ || (!TREE_ADDRESSABLE (decl) && !node->externally_visible);
- if (!can_handle)
+ if (!can_handle || DECL_EXTERNAL (decl))
return NULL;
tree ctor = ctor_for_folding (decl);
diff --git a/gcc/ipa-inline-analysis.c b/gcc/ipa-inline-analysis.c
index fb4e81e..3b622f2 100644
--- a/gcc/ipa-inline-analysis.c
+++ b/gcc/ipa-inline-analysis.c
@@ -2036,12 +2036,12 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
struct agg_position_info aggpos;
/* What statments might be optimized away
- when their arguments are constant
- TODO: also trivial builtins.
- builtin_constant_p is already handled later. */
+ when their arguments are constant. */
if (gimple_code (stmt) != GIMPLE_ASSIGN
&& gimple_code (stmt) != GIMPLE_COND
- && gimple_code (stmt) != GIMPLE_SWITCH)
+ && gimple_code (stmt) != GIMPLE_SWITCH
+ && (gimple_code (stmt) != GIMPLE_CALL
+ || !(gimple_call_flags (stmt) & ECF_CONST)))
return p;
/* Stores will stay anyway. */
@@ -2101,9 +2101,10 @@ will_be_nonconstant_predicate (struct ipa_node_params *info,
p = nonconstant_names[SSA_NAME_VERSION (use)];
op_non_const = or_predicates (summary->conds, &p, &op_non_const);
}
- if (gimple_code (stmt) == GIMPLE_ASSIGN
- && TREE_CODE (gimple_assign_lhs (stmt)) == SSA_NAME)
- nonconstant_names[SSA_NAME_VERSION (gimple_assign_lhs (stmt))]
+ if ((gimple_code (stmt) == GIMPLE_ASSIGN || gimple_code (stmt) == GIMPLE_CALL)
+ && gimple_op (stmt, 0)
+ && TREE_CODE (gimple_op (stmt, 0)) == SSA_NAME)
+ nonconstant_names[SSA_NAME_VERSION (gimple_op (stmt, 0))]
= op_non_const;
return op_non_const;
}
@@ -2683,7 +2684,9 @@ estimate_function_body_sizes (struct cgraph_node *node, bool early)
else
p = true_predicate ();
- if (!false_predicate_p (&p))
+ if (!false_predicate_p (&p)
+ || (is_gimple_call (stmt)
+ && !false_predicate_p (&bb_predicate)))
{
time += this_time;
size += this_size;
diff --git a/gcc/ira-int.h b/gcc/ira-int.h
index 0799b1e..79b7b99 100644
--- a/gcc/ira-int.h
+++ b/gcc/ira-int.h
@@ -620,9 +620,9 @@ extern struct ira_spilled_reg_stack_slot *ira_spilled_reg_stack_slots;
allocnos assigned to hard-registers, cost of the allocnos assigned
to memory, cost of loads, stores and register move insns generated
for pseudo-register live range splitting (see ira-emit.c). */
-extern int ira_overall_cost;
-extern int ira_reg_cost, ira_mem_cost;
-extern int ira_load_cost, ira_store_cost, ira_shuffle_cost;
+extern int64_t ira_overall_cost;
+extern int64_t ira_reg_cost, ira_mem_cost;
+extern int64_t ira_load_cost, ira_store_cost, ira_shuffle_cost;
extern int ira_move_loops_num, ira_additional_jumps_num;
diff --git a/gcc/ira.c b/gcc/ira.c
index f08aa23..87ea86d 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -431,9 +431,9 @@ struct ira_spilled_reg_stack_slot *ira_spilled_reg_stack_slots;
the allocnos assigned to memory, cost of loads, stores and register
move insns generated for pseudo-register live range splitting (see
ira-emit.c). */
-int ira_overall_cost, overall_cost_before;
-int ira_reg_cost, ira_mem_cost;
-int ira_load_cost, ira_store_cost, ira_shuffle_cost;
+int64_t ira_overall_cost, overall_cost_before;
+int64_t ira_reg_cost, ira_mem_cost;
+int64_t ira_load_cost, ira_store_cost, ira_shuffle_cost;
int ira_move_loops_num, ira_additional_jumps_num;
/* All registers that can be eliminated. */
@@ -2489,10 +2489,15 @@ calculate_allocation_cost (void)
if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
{
fprintf (ira_dump_file,
- "+++Costs: overall %d, reg %d, mem %d, ld %d, st %d, move %d\n",
+ "+++Costs: overall %"PRId64
+ ", reg %"PRId64
+ ", mem %"PRId64
+ ", ld %"PRId64
+ ", st %"PRId64
+ ", move %"PRId64,
ira_overall_cost, ira_reg_cost, ira_mem_cost,
ira_load_cost, ira_store_cost, ira_shuffle_cost);
- fprintf (ira_dump_file, "+++ move loops %d, new jumps %d\n",
+ fprintf (ira_dump_file, "\n+++ move loops %d, new jumps %d\n",
ira_move_loops_num, ira_additional_jumps_num);
}
@@ -5422,7 +5427,8 @@ do_reload (void)
if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL
&& overall_cost_before != ira_overall_cost)
- fprintf (ira_dump_file, "+++Overall after reload %d\n", ira_overall_cost);
+ fprintf (ira_dump_file, "+++Overall after reload %"PRId64 "\n",
+ ira_overall_cost);
flag_ira_share_spill_slots = saved_flag_ira_share_spill_slots;
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index a108b84..23fd44d 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2280,22 +2280,28 @@ process_alt_operands (int only_alternative)
not hold the mode value. */
&& ! HARD_REGNO_MODE_OK (ira_class_hard_regs
[this_alternative][0],
- GET_MODE (*curr_id->operand_loc[nop]))
+ GET_MODE (*curr_id->operand_loc[nop])))
+ {
+ HARD_REG_SET temp;
+
+ COPY_HARD_REG_SET (temp, this_alternative_set);
+ AND_COMPL_HARD_REG_SET (temp, lra_no_alloc_regs);
/* The above condition is not enough as the first
reg in ira_class_hard_regs can be not aligned for
multi-words mode values. */
- && hard_reg_set_subset_p (this_alternative_set,
- ira_prohibited_class_mode_regs
- [this_alternative]
- [GET_MODE (*curr_id->operand_loc[nop])]))
- {
- if (lra_dump_file != NULL)
- fprintf
- (lra_dump_file,
- " alt=%d: reload pseudo for op %d "
- " can not hold the mode value -- refuse\n",
- nalt, nop);
- goto fail;
+ if (hard_reg_set_subset_p (temp,
+ ira_prohibited_class_mode_regs
+ [this_alternative]
+ [GET_MODE (*curr_id->operand_loc[nop])]))
+ {
+ if (lra_dump_file != NULL)
+ fprintf
+ (lra_dump_file,
+ " alt=%d: reload pseudo for op %d "
+ " can not hold the mode value -- refuse\n",
+ nalt, nop);
+ goto fail;
+ }
}
/* Check strong discouragement of reload of non-constant
@@ -3191,7 +3197,7 @@ simple_move_p (void)
&& (sclass = get_op_class (src)) != NO_REGS
/* The backend guarantees that register moves of cost 2
never need reloads. */
- && targetm.register_move_cost (GET_MODE (src), dclass, sclass) == 2);
+ && targetm.register_move_cost (GET_MODE (src), sclass, dclass) == 2);
}
/* Swap operands NOP and NOP + 1. */
diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c
index 3b8a806..95ed015 100644
--- a/gcc/lra-remat.c
+++ b/gcc/lra-remat.c
@@ -350,12 +350,12 @@ finish_cand_table (void)
-/* Return true if X contains memory or UNSPEC. We can not just check
- insn operands as memory or unspec might be not an operand itself
- but contain an operand. Insn with memory access is not profitable
- for rematerialization. Rematerialization of UNSPEC might result in
- wrong code generation as the UNPEC effect is unknown
- (e.g. generating a label). */
+/* Return true if X contains memory or some UNSPEC. We can not just
+ check insn operands as memory or unspec might be not an operand
+ itself but contain an operand. Insn with memory access is not
+ profitable for rematerialization. Rematerialization of UNSPEC
+ might result in wrong code generation as the UNPEC effect is
+ unknown (e.g. generating a label). */
static bool
bad_for_rematerialization_p (rtx x)
{
@@ -363,7 +363,7 @@ bad_for_rematerialization_p (rtx x)
const char *fmt;
enum rtx_code code;
- if (MEM_P (x) || GET_CODE (x) == UNSPEC)
+ if (MEM_P (x) || GET_CODE (x) == UNSPEC || GET_CODE (x) == UNSPEC_VOLATILE)
return true;
code = GET_CODE (x);
fmt = GET_RTX_FORMAT (code);
@@ -406,7 +406,7 @@ operand_to_remat (rtx_insn *insn)
if (reg->regno == STACK_POINTER_REGNUM && frame_pointer_needed)
return -1;
else if (reg->type == OP_OUT && ! reg->subreg_p
- && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
+ && find_regno_note (insn, REG_UNUSED, reg->regno) == NULL)
{
/* We permits only one spilled reg. */
if (found_reg != NULL)
@@ -508,11 +508,14 @@ create_cands (void)
if ((set = single_set (insn)) != NULL
&& REG_P (SET_SRC (set)) && REG_P (SET_DEST (set))
- && (src_regno = REGNO (SET_SRC (set))) >= FIRST_PSEUDO_REGISTER
+ && ((src_regno = REGNO (SET_SRC (set)))
+ >= lra_constraint_new_regno_start)
&& (dst_regno = REGNO (SET_DEST (set))) >= FIRST_PSEUDO_REGISTER
&& reg_renumber[dst_regno] < 0
&& (insn2 = regno_potential_cand[src_regno].insn) != NULL
&& BLOCK_FOR_INSN (insn2) == BLOCK_FOR_INSN (insn))
+ /* It is an output reload insn after insn can be
+ rematerialized (potential candidate). */
create_cand (insn2, regno_potential_cand[src_regno].nop, dst_regno);
if (nop < 0)
goto fail;
diff --git a/gcc/match.pd b/gcc/match.pd
index 083d65f..4d4bc9f 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -382,6 +382,13 @@ along with GCC; see the file COPYING3. If not see
(bit_not (bit_not @0))
@0)
+/* (x & ~m) | (y & m) -> ((x ^ y) & m) ^ x */
+(simplify
+ (bit_ior:c (bit_and:c@3 @0 (bit_not @2)) (bit_and:c@4 @1 @2))
+ (if ((TREE_CODE (@3) != SSA_NAME || has_single_use (@3))
+ && (TREE_CODE (@4) != SSA_NAME || has_single_use (@4)))
+ (bit_xor (bit_and (bit_xor @0 @1) @2) @0)))
+
/* Associate (p +p off1) +p off2 as (p +p (off1 + off2)). */
(simplify
@@ -599,6 +606,13 @@ along with GCC; see the file COPYING3. If not see
build_int_cst (TREE_TYPE (@1),
element_precision (type)), @1); }))
+/* ((1 << A) & 1) != 0 -> A == 0
+ ((1 << A) & 1) == 0 -> A != 0 */
+(for cmp (ne eq)
+ icmp (eq ne)
+ (simplify
+ (cmp (bit_and (lshift integer_onep @0) integer_onep) integer_zerop)
+ (icmp @0 { build_zero_cst (TREE_TYPE (@0)); })))
/* Simplifications of conversions. */
diff --git a/gcc/sreal.c b/gcc/sreal.c
index bc3af23..cf6b738 100644
--- a/gcc/sreal.c
+++ b/gcc/sreal.c
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
+#include <math.h>
#include "coretypes.h"
#include "sreal.h"
@@ -95,64 +96,6 @@ sreal::shift_right (int s)
m_sig >>= s;
}
-/* Normalize *this. */
-
-void
-sreal::normalize ()
-{
- int64_t s = m_sig < 0 ? -1 : 1;
- unsigned HOST_WIDE_INT sig = absu_hwi (m_sig);
-
- if (sig == 0)
- {
- m_exp = -SREAL_MAX_EXP;
- }
- else if (sig < SREAL_MIN_SIG)
- {
- do
- {
- sig <<= 1;
- m_exp--;
- }
- while (sig < SREAL_MIN_SIG);
-
- /* Check underflow. */
- if (m_exp < -SREAL_MAX_EXP)
- {
- m_exp = -SREAL_MAX_EXP;
- sig = 0;
- }
- }
- else if (sig > SREAL_MAX_SIG)
- {
- int last_bit;
- do
- {
- last_bit = sig & 1;
- sig >>= 1;
- m_exp++;
- }
- while (sig > SREAL_MAX_SIG);
-
- /* Round the number. */
- sig += last_bit;
- if (sig > SREAL_MAX_SIG)
- {
- sig >>= 1;
- m_exp++;
- }
-
- /* Check overflow. */
- if (m_exp > SREAL_MAX_EXP)
- {
- m_exp = SREAL_MAX_EXP;
- sig = SREAL_MAX_SIG;
- }
- }
-
- m_sig = s * sig;
-}
-
/* Return integer value of *this. */
int64_t
@@ -171,6 +114,18 @@ sreal::to_int () const
return m_sig;
}
+/* Return value of *this as double.
+ This should be used for debug output only. */
+
+double
+sreal::to_double () const
+{
+ double val = m_sig;
+ if (m_exp)
+ val *= exp2 (m_exp);
+ return val;
+}
+
/* Return *this + other. */
sreal
@@ -251,7 +206,7 @@ sreal
sreal::operator* (const sreal &other) const
{
sreal r;
- if (std::abs (m_sig) < SREAL_MIN_SIG || std::abs (other.m_sig) < SREAL_MIN_SIG)
+ if (absu_hwi (m_sig) < SREAL_MIN_SIG || absu_hwi (other.m_sig) < SREAL_MIN_SIG)
{
r.m_sig = 0;
r.m_exp = -SREAL_MAX_EXP;
diff --git a/gcc/sreal.h b/gcc/sreal.h
index 730f49c..2bee542 100644
--- a/gcc/sreal.h
+++ b/gcc/sreal.h
@@ -46,6 +46,7 @@ public:
void dump (FILE *) const;
int64_t to_int () const;
+ double to_double () const;
sreal operator+ (const sreal &other) const;
sreal operator- (const sreal &other) const;
sreal operator* (const sreal &other) const;
@@ -83,12 +84,14 @@ public:
sreal shift (int s) const
{
+ /* Zero needs no shifting. */
+ if (!m_sig)
+ return *this;
gcc_checking_assert (s <= SREAL_BITS);
gcc_checking_assert (s >= -SREAL_BITS);
- /* Exponent should never be so large because shift_right is used only by
- sreal_add and sreal_sub ant thus the number cannot be shifted out from
- exponent range. */
+ /* Overflows/drop to 0 could be handled gracefully, but hopefully we do not
+ need to do so. */
gcc_checking_assert (m_exp + s <= SREAL_MAX_EXP);
gcc_checking_assert (m_exp + s >= -SREAL_MAX_EXP);
@@ -113,7 +116,9 @@ public:
}
private:
- void normalize ();
+ inline void normalize ();
+ inline void normalize_up ();
+ inline void normalize_down ();
void shift_right (int amount);
static sreal signedless_plus (const sreal &a, const sreal &b, bool negative);
static sreal signedless_minus (const sreal &a, const sreal &b, bool negative);
@@ -175,4 +180,85 @@ inline sreal operator>> (const sreal &a, int exp)
return a.shift (-exp);
}
+/* Make significant to be >= SREAL_MIN_SIG.
+
+ Make this separate method so inliner can handle hot path better. */
+
+inline void
+sreal::normalize_up ()
+{
+ int64_t s = m_sig < 0 ? -1 : 1;
+ unsigned HOST_WIDE_INT sig = absu_hwi (m_sig);
+ int shift = SREAL_PART_BITS - 2 - floor_log2 (sig);
+
+ gcc_checking_assert (shift > 0);
+ sig <<= shift;
+ m_exp -= shift;
+ gcc_checking_assert (sig <= SREAL_MAX_SIG && sig >= SREAL_MIN_SIG);
+
+ /* Check underflow. */
+ if (m_exp < -SREAL_MAX_EXP)
+ {
+ m_exp = -SREAL_MAX_EXP;
+ sig = 0;
+ }
+ if (s == -1)
+ m_sig = -sig;
+ else
+ m_sig = sig;
+}
+
+/* Make significant to be <= SREAL_MAX_SIG.
+
+ Make this separate method so inliner can handle hot path better. */
+
+inline void
+sreal::normalize_down ()
+{
+ int64_t s = m_sig < 0 ? -1 : 1;
+ int last_bit;
+ unsigned HOST_WIDE_INT sig = absu_hwi (m_sig);
+ int shift = floor_log2 (sig) - SREAL_PART_BITS + 2;
+
+ gcc_checking_assert (shift > 0);
+ last_bit = (sig >> (shift-1)) & 1;
+ sig >>= shift;
+ m_exp += shift;
+ gcc_checking_assert (sig <= SREAL_MAX_SIG && sig >= SREAL_MIN_SIG);
+
+ /* Round the number. */
+ sig += last_bit;
+ if (sig > SREAL_MAX_SIG)
+ {
+ sig >>= 1;
+ m_exp++;
+ }
+
+ /* Check overflow. */
+ if (m_exp > SREAL_MAX_EXP)
+ {
+ m_exp = SREAL_MAX_EXP;
+ sig = SREAL_MAX_SIG;
+ }
+ if (s == -1)
+ m_sig = -sig;
+ else
+ m_sig = sig;
+}
+
+/* Normalize *this; the hot path. */
+
+inline void
+sreal::normalize ()
+{
+ unsigned HOST_WIDE_INT sig = absu_hwi (m_sig);
+
+ if (sig == 0)
+ m_exp = -SREAL_MAX_EXP;
+ else if (sig > SREAL_MAX_SIG)
+ normalize_down ();
+ else if (sig < SREAL_MIN_SIG)
+ normalize_up ();
+}
+
#endif
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2299c78..87453b5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,118 @@
+2014-12-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/63723
+ * g++.dg/cpp0x/sfinae54.C: New.
+
+2014-12-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/59204
+ * g++.dg/cpp0x/sfinae53.C: New.
+
+2014-12-18 Vladimir Makarov <vmakarov@redhat.com>
+
+ PR rtl-optimization/64291
+ * testsuite/gcc.target/i386/pr64291-[12].c: New tests.
+
+2014-12-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/60955
+ * g++.dg/warn/register-parm-1.C: New.
+
+2014-12-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/amd64-abi-7.c: New tests.
+ * gcc.target/i386/amd64-abi-8.c: Likwise.
+ * gcc.target/i386/amd64-abi-9.c: Likwise.
+
+2014-12-18 Alan Lawrence <alan.lawrence@arm.com>
+
+ * gcc.target/aarch64/ushr64_1.c: Remove scan-assembler "ushr...64".
+
+2014-12-18 Martin Liska <mliska@suse.cz>
+
+ * g++.dg/ipa/pr64146.C: New test.
+
+2014-12-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * lib/mpx-dg.exp (check_effective_target_mpx): Change into link test.
+ Add main.
+
+2014-12-18 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/62178
+ * gcc.target/aarch64/pr62178.c: New test.
+
+2014-12-17 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/64173
+ * gfortran.dg/proc_ptr_comp_40.f90: New.
+
+2014-12-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/61296
+ * gcc.target/i386/pr61296-2.c: New.
+ * gcc.target/i386/pr61296-2.c: Likewise.
+ * gcc.target/i386/pr61296-3.c: Likewise.
+ * gcc.target/i386/pr61296-4.c: Likewise.
+ * gcc.target/i386/pr61296-5.c: Likewise.
+ * gcc.target/i386/pr61296-6.c: Likewise.
+ * gcc.target/i386/pr61296-7.c: Likewise.
+
+2014-12-17 Tejas Belagod <tejas.belagod@arm.com>
+
+ PR testsuite/64328
+ * gcc.dg/addr_equal-1.c: Not supported for -fPIC.
+
+2014-12-17 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/63568
+ * gcc.dg/pr63568.c: New test.
+
+2014-12-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64322
+ * gcc.dg/tree-ssa/vrp95.c: New test.
+
+ PR sanitizer/64289
+ * c-c++-common/ubsan/pr64289.c: New test.
+
+2014-12-16 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58650
+ * g++.dg/parse/friend12.C: New.
+
+2014-12-16 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/54089
+ * gcc.target/sh/pr54089-1.c: Change optimization level from -O1 to -O2.
+
+2014-12-16 Oleg Endo <olegendo@gcc.gnu.org>
+
+ PR target/53513
+ * gcc.target/sh/fpchg.c: Rename to ...
+ * gcc.target/sh/pr53513-1.c: ... this. Adjust test case to work for
+ -m4a and -m4a-single.
+
+2014-12-16 Marek Polacek <polacek@redhat.com>
+
+ PR middle-end/64309
+ * gcc.dg/pr64309.c: New test.
+
+2014-12-16 Felix Yang <felix.yang@huawei.com>
+
+ PR rtl-optimization/64240
+ * gcc.dg/sms-12.c: New test.
+
+2014-12-16 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/64244
+ * gfortran.dg/typebound_call_26.f90: New.
+
+2014-12-15 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/64043
+ * gcc.dg/lto/20110201-1_0.c: New testcase.
+
2014-12-15 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/64316
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr64289.c b/gcc/testsuite/c-c++-common/ubsan/pr64289.c
new file mode 100644
index 0000000..1e38e6d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr64289.c
@@ -0,0 +1,9 @@
+/* PR sanitizer/64289 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=float-cast-overflow" } */
+
+int
+foo (int a)
+{
+ return (int) (0 ? 0 : a ? a : 0.5);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/deleted9.C b/gcc/testsuite/g++.dg/cpp0x/deleted9.C
new file mode 100644
index 0000000..af97be7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/deleted9.C
@@ -0,0 +1,31 @@
+// PR c++/64352
+// { dg-do compile { target c++11 } }
+
+template<bool B> struct bool_type
+{ static constexpr bool value = B; };
+
+using true_type = bool_type<true>;
+using false_type = bool_type<false>;
+
+template<typename T> T&& declval();
+
+template<typename...> struct void_ { using type = void; };
+template<typename... I> using void_t = typename void_<I...>::type;
+
+template<typename _Tp, typename = void>
+struct _Has_addressof_free: false_type { };
+
+template<typename _Tp>
+struct _Has_addressof_free
+<_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
+: true_type { };
+
+struct foo {};
+void operator&(foo) = delete;
+
+int main()
+{
+ static_assert( !_Has_addressof_free<int>::value, "" );
+ // error: use of deleted function 'void operator&(foo)'
+ static_assert( !_Has_addressof_free<foo>::value, "" );
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae53.C b/gcc/testsuite/g++.dg/cpp0x/sfinae53.C
new file mode 100644
index 0000000..19b00cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae53.C
@@ -0,0 +1,23 @@
+// PR c++/59204
+// { dg-do compile { target c++11 } }
+
+template< class T >
+ using void_t = void;
+
+template< class T, class = void >
+ struct has_type
+{ constexpr static bool value = false; };
+
+template< class T >
+ struct has_type<T, void_t<typename T::type>>
+{ constexpr static bool value = true; };
+
+struct yes { using type = int; };
+struct no { };
+
+int
+main( )
+{
+ static_assert( has_type<yes>::value, "false negative!" );
+ static_assert( not has_type<no >::value, "false positive!" );
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae54.C b/gcc/testsuite/g++.dg/cpp0x/sfinae54.C
new file mode 100644
index 0000000..f681fa7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/sfinae54.C
@@ -0,0 +1,41 @@
+// PR c++/63723
+// { dg-do compile { target c++11 } }
+
+template<typename Tp> Tp declval();
+
+template<typename Tp, Tp v>
+struct integral_constant
+{
+ static constexpr Tp value = v;
+ typedef Tp value_type;
+ typedef integral_constant<Tp, v> type;
+ constexpr operator value_type() const { return value; }
+};
+
+typedef integral_constant<bool, true> true_type;
+typedef integral_constant<bool, false> false_type;
+
+template <typename From, typename To>
+class is_list_convertible_helper
+{
+ template <typename To2>
+ static void requires_conversion(To2 t);
+
+ template <typename From2, typename To2,
+ typename = decltype(requires_conversion<To2>({declval<From2>()}))>
+ static true_type helper(int);
+
+ template <typename From2, typename To2>
+ static false_type helper(...);
+
+public:
+ using type = decltype(helper<From, To>(0));
+};
+
+template <typename From, typename To>
+class is_list_convertible
+ : public is_list_convertible_helper<From, To>::type
+{ };
+
+static_assert(!is_list_convertible<double, int>::value,
+ "double -> int is narrowing!");
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-initlist1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-initlist1.C
new file mode 100644
index 0000000..bdef8a1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-initlist1.C
@@ -0,0 +1,22 @@
+// PR c++/64333
+// { dg-do compile { target c++14 } }
+#include <initializer_list>
+
+constexpr int max(std::initializer_list<int> ints)
+{
+ int ret = *(ints.begin());
+ for (int i = 0; i < ints.size(); ++i) {
+ if (*(ints.begin()+i) > ret) {
+ ret = *(ints.begin()+i);
+ }
+ }
+ return ret;
+}
+
+int main()
+{
+ constexpr int z = max({7,6,5,4,3,2,1});
+ constexpr int z2 = max({5,4,3,2,1});
+ static_assert(z == 7, "");
+ static_assert(z2 == 5, "");
+}
diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-loop2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop2.C
new file mode 100644
index 0000000..2e53e48
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-loop2.C
@@ -0,0 +1,12 @@
+// { dg-do compile { target c++14 } }
+
+constexpr int f(int* p) { return *p; }
+constexpr int g(int n)
+{
+ int sum = 0;
+ for (int i = 1; i <= n; ++i)
+ sum += f(&i);
+ return sum;
+}
+
+static_assert(g(3) == 3+2+1,"");
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic2.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic2.C
new file mode 100644
index 0000000..2808aa6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic2.C
@@ -0,0 +1,22 @@
+// PR c++/64105
+// This test was ICEing on pre-C++14 mode.
+
+#include <functional>
+
+using F = std::function<void(void)>;
+
+struct X
+{
+ template <typename T>
+ static void f(T t)
+ {
+ g(t);
+ }
+
+ static void g(F) {}
+};
+
+int main()
+{
+ X::f([](auto... xs){}); // { dg-error "" "" { target { ! cxx14 } } }
+};
diff --git a/gcc/testsuite/g++.dg/ipa/pr64146.C b/gcc/testsuite/g++.dg/ipa/pr64146.C
new file mode 100644
index 0000000..8a2b947
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr64146.C
@@ -0,0 +1,38 @@
+/* { dg-do compile } */
+/* { dg-require-alias "" } */
+/* { dg-options "-fpic -fdump-ipa-icf-details -fipa-icf" } */
+
+extern "C" const char*
+foo()
+{
+ return "original";
+}
+
+const char*
+test_foo()
+{
+ return foo();
+}
+
+extern "C" const char*
+bar()
+{
+ return "original";
+}
+
+const char*
+test_bar()
+{
+ return bar();
+}
+
+int main (int argc, char **argv)
+{
+ test_foo ();
+ test_bar ();
+
+ return 0;
+}
+
+/* { dg-final { scan-ipa-dump-times "Declaration does not bind to currect definition." 2 "icf" } } */
+/* { dg-final { scan-ipa-dump "Equal symbols: 2" "icf" } } */
diff --git a/gcc/testsuite/g++.dg/parse/friend12.C b/gcc/testsuite/g++.dg/parse/friend12.C
new file mode 100644
index 0000000..f0e28a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/friend12.C
@@ -0,0 +1,7 @@
+// PR c++/58650
+
+struct A
+{
+ friend int i = 0; // { dg-error "cannot be declared friend" }
+// { dg-error "non-static data member" "" { target { ! c++11 } } 5 }
+};
diff --git a/gcc/testsuite/g++.dg/template/non-dependent14.C b/gcc/testsuite/g++.dg/template/non-dependent14.C
new file mode 100644
index 0000000..b257d9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/non-dependent14.C
@@ -0,0 +1,7 @@
+// PR c++/64251
+
+class DictionaryValue {};
+template <typename T> void CreateValue(T) {
+ DictionaryValue(0);
+ CreateValue(0);
+}
diff --git a/gcc/testsuite/g++.dg/warn/register-parm-1.C b/gcc/testsuite/g++.dg/warn/register-parm-1.C
new file mode 100644
index 0000000..44232d3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/register-parm-1.C
@@ -0,0 +1,9 @@
+// PR c++/60955
+// { dg-options "-Wextra" }
+
+unsigned int erroneous_warning(register int a) {
+ if ((a) & 0xff) return 1; else return 0;
+}
+unsigned int no_erroneous_warning(register int a) {
+ if (a & 0xff) return 1; else return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/addr_equal-1.c b/gcc/testsuite/gcc.dg/addr_equal-1.c
index b033f50..94499f0 100644
--- a/gcc/testsuite/gcc.dg/addr_equal-1.c
+++ b/gcc/testsuite/gcc.dg/addr_equal-1.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require-effective-target nonpic } */
/* { dg-require-weak "" } */
/* { dg-require-alias "" } */
/* { dg-options "-O2" } */
diff --git a/gcc/testsuite/gcc.dg/lto/20110201-1_0.c b/gcc/testsuite/gcc.dg/lto/20110201-1_0.c
index a006649..5073a50 100644
--- a/gcc/testsuite/gcc.dg/lto/20110201-1_0.c
+++ b/gcc/testsuite/gcc.dg/lto/20110201-1_0.c
@@ -1,6 +1,5 @@
/* { dg-lto-do run } */
/* { dg-lto-options { { -O0 -flto } } } */
-/* { dg-extra-ld-options "-O2 -ffast-math -fuse-linker-plugin" } */
/* { dg-require-linker-plugin "" } */
/* We require a linker plugin because otherwise we'd need to link
@@ -9,7 +8,7 @@
which does not have folded cabs. */
double cabs(_Complex double);
-double __attribute__((used))
+double __attribute__((used)) __attribute__ ((optimize ("O2,fast-math")))
foo (_Complex double x, int b)
{
if (b)
diff --git a/gcc/testsuite/gcc.dg/pr63568.c b/gcc/testsuite/gcc.dg/pr63568.c
new file mode 100644
index 0000000..fb42bea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr63568.c
@@ -0,0 +1,54 @@
+/* PR middle-end/63568 */
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-original" } */
+
+int
+fn1 (int a, int b, int m)
+{
+ return (a & ~m) | (b & m);
+}
+
+int
+fn2 (int a, int b, int m)
+{
+ return (a & ~m) | (m & b);
+}
+
+int
+fn3 (int a, int b, int m)
+{
+ return (~m & a) | (m & b);
+}
+
+int
+fn4 (int a, int b, int m)
+{
+ return (~m & a) | (b & m);
+}
+
+int
+fn5 (int a, int b, int m)
+{
+ return (b & m) | (a & ~m);
+}
+
+int
+fn6 (int a, int b, int m)
+{
+ return (m & b) | (a & ~m);
+}
+
+int
+fn7 (int a, int b, int m)
+{
+ return (m & b) | (~m & a);
+}
+
+int
+fn8 (int a, int b, int m)
+{
+ return (b & m) | (~m & a);
+}
+
+/* { dg-final { scan-tree-dump-not " \\| " "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
diff --git a/gcc/testsuite/gcc.dg/pr64309.c b/gcc/testsuite/gcc.dg/pr64309.c
new file mode 100644
index 0000000..710a762
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64309.c
@@ -0,0 +1,66 @@
+/* PR middle-end/64309 */
+/* { dg-do run } */
+/* { dg-options "-fdump-tree-original" } */
+
+int
+fn1 (int n)
+{
+ return ((1 << n) & 1) != 0;
+}
+
+int
+fn2 (int n)
+{
+ return (1 & (1 << n)) != 0;
+}
+
+int
+fn3 (int n)
+{
+ return ((1 << n) & 1) == 0;
+}
+
+int
+fn4 (int n)
+{
+ return (1 & (1 << n)) == 0;
+}
+
+int
+main (void)
+{
+ if (fn1 (0) != 1
+ || fn1 (1) != 0
+ || fn1 (2) != 0
+ || fn1 (3) != 0
+ || fn1 (4) != 0
+ || fn1 (5) != 0)
+ __builtin_abort ();
+
+ if (fn2 (0) != 1
+ || fn2 (1) != 0
+ || fn2 (2) != 0
+ || fn2 (3) != 0
+ || fn2 (4) != 0
+ || fn2 (5) != 0)
+ __builtin_abort ();
+
+ if (fn3 (0) != 0
+ || fn3 (1) != 1
+ || fn3 (2) != 1
+ || fn3 (3) != 1
+ || fn3 (4) != 1
+ || fn3 (5) != 1)
+ __builtin_abort ();
+
+ if (fn4 (0) != 0
+ || fn4 (1) != 1
+ || fn4 (2) != 1
+ || fn4 (3) != 1
+ || fn4 (4) != 1
+ || fn4 (5) != 1)
+ __builtin_abort ();
+}
+
+/* { dg-final { scan-tree-dump-not "(<<|>>)" "original" } } */
+/* { dg-final { cleanup-tree-dump "original" } } */
diff --git a/gcc/testsuite/gcc.dg/sms-12.c b/gcc/testsuite/gcc.dg/sms-12.c
new file mode 100644
index 0000000..23cff3b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sms-12.c
@@ -0,0 +1,43 @@
+/* { dg-do run } */
+/* { dg-skip-if "" { ! { aarch64*-*-* } } { "*" } { "" } } */
+/* { dg-options "-O2 -fmodulo-sched -funroll-loops -fdump-rtl-sms --param sms-min-sc=1 -fmodulo-sched-allow-regmoves -fPIC" } */
+
+extern void abort (void);
+
+int X[1000]={0};
+int Y[1000]={0};
+
+extern void abort (void);
+
+__attribute__ ((noinline))
+int
+foo (int len, long a)
+{
+ int i;
+ long res = a;
+
+ len = 1000;
+ for (i = 0; i < len; i++)
+ res += X[i]* Y[i];
+
+ if (res != 601)
+ abort ();
+
+}
+
+int
+main ()
+{
+ X[0] = Y[1] = 2;
+ Y[0] = X[1] = 21;
+ X[2] = Y[3] = 3;
+ Y[2] = X[3] = 31;
+ X[4] = Y[5] = 4;
+ Y[4] = X[5] = 41;
+
+ foo (6, 3);
+ return 0;
+}
+
+/* { dg-final { cleanup-rtl-dump "sms" } } */
+
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp95.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp95.c
new file mode 100644
index 0000000..be208ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp95.c
@@ -0,0 +1,50 @@
+/* PR tree-optimization/64322 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+
+extern void link_error ();
+extern void required_check ();
+
+long long int
+foo (long long int x)
+{
+ x >>= sizeof (long long int) * __CHAR_BIT__ - 1;
+ if (x != 0 && x != -1)
+ link_error ();
+ return x;
+}
+
+unsigned long long int
+bar (unsigned long long int x)
+{
+ x >>= sizeof (long long int) * __CHAR_BIT__ - 1;
+ if (x != 0 && x != 1)
+ link_error ();
+ return x;
+}
+
+long long int
+baz (long long int x)
+{
+ x = (x >> sizeof (long long int) * __CHAR_BIT__ - 1) << 1;
+ x = x / 0x100000000LL;
+ if (x != 0)
+ link_error ();
+ return x;
+}
+
+unsigned long long int
+range (unsigned long long int x, int y)
+{
+ y &= 3;
+ x >>= sizeof (long long int) * __CHAR_BIT__ - 1 - y;
+ if (x > 15)
+ link_error ();
+ if (x == 15)
+ required_check ();
+ return x;
+}
+
+/* { dg-final { scan-tree-dump-not "link_error" "vrp1" } } */
+/* { dg-final { scan-tree-dump "required_check" "vrp1" } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/pr62178.c b/gcc/testsuite/gcc.target/aarch64/pr62178.c
new file mode 100644
index 0000000..b80ce68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr62178.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+int a[30 +1][30 +1], b[30 +1][30 +1], r[30 +1][30 +1];
+
+void foo (void) {
+ int i, j, k;
+
+ for ( i = 1; i <= 30; i++ )
+ for ( j = 1; j <= 30; j++ ) {
+ r[i][j] = 0;
+ for(k = 1; k <= 30; k++ )
+ r[i][j] += a[i][k]*b[k][j];
+ }
+}
+
+/* { dg-final { scan-assembler "ld1r\\t\{v\[0-9\]+\."} } */
diff --git a/gcc/testsuite/gcc.target/aarch64/ushr64_1.c b/gcc/testsuite/gcc.target/aarch64/ushr64_1.c
index b1c741d..ee49489 100644
--- a/gcc/testsuite/gcc.target/aarch64/ushr64_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/ushr64_1.c
@@ -42,7 +42,6 @@ test_vshrd_n_u64_0 (uint64_t passed, uint64_t expected)
return vshrd_n_u64 (passed, 0) != expected;
}
-/* { dg-final { scan-assembler-times "ushr\\td\[0-9\]+, d\[0-9\]+, 64" 2 } } */
/* { dg-final { (scan-assembler-times "ushr\\td\[0-9\]+, d\[0-9\]+, 4" 2) || \
(scan-assembler-times "lsr\\tx\[0-9\]+, x\[0-9\]+, 4" 2) } } */
/* { dg-final { scan-assembler-not "ushr\\td\[0-9\]+, d\[0-9\]+, 0" } } */
diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-7.c b/gcc/testsuite/gcc.target/i386/amd64-abi-7.c
new file mode 100644
index 0000000..fcca680
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-7.c
@@ -0,0 +1,46 @@
+/* { dg-do run { target { ! { ia32 } } } } */
+/* { dg-options "-O2 -mno-sse" } */
+
+#include <stdarg.h>
+#include <assert.h>
+
+int n1 = 30;
+int n2 = 324;
+void *n3 = (void *) &n2;
+int n4 = 407;
+
+int e1;
+int e2;
+void *e3;
+int e4;
+
+static void
+__attribute__((noinline))
+foo (va_list va_arglist)
+{
+ e2 = va_arg (va_arglist, int);
+ e3 = va_arg (va_arglist, void *);
+ e4 = va_arg (va_arglist, int);
+}
+
+static void
+__attribute__((noinline))
+test (int a1, ...)
+{
+ va_list va_arglist;
+ e1 = a1;
+ va_start (va_arglist, a1);
+ foo (va_arglist);
+ va_end (va_arglist);
+}
+
+int
+main ()
+{
+ test (n1, n2, n3, n4);
+ assert (n1 == e1);
+ assert (n2 == e2);
+ assert (n3 == e3);
+ assert (n4 == e4);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-8.c b/gcc/testsuite/gcc.target/i386/amd64-abi-8.c
new file mode 100644
index 0000000..b25ceec
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-8.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-O2 -mno-sse -mskip-rax-setup" } */
+/* { dg-final { scan-assembler-not "xorl\[\\t \]*\\\%eax,\[\\t \]*%eax" } } */
+
+void foo (const char *, ...);
+
+void
+test1 (void)
+{
+ foo ("%d", 20);
+}
+
+int
+test2 (void)
+{
+ foo ("%d", 20);
+ return 3;
+}
diff --git a/gcc/testsuite/gcc.target/i386/amd64-abi-9.c b/gcc/testsuite/gcc.target/i386/amd64-abi-9.c
new file mode 100644
index 0000000..4707eb7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/amd64-abi-9.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-O2 -mno-sse -mno-skip-rax-setup" } */
+/* { dg-final { scan-assembler-times "xorl\[\\t \]*\\\%eax,\[\\t \]*%eax" 2 } } */
+
+void foo (const char *, ...);
+
+void
+test1 (void)
+{
+ foo ("%d", 20);
+}
+
+int
+test2 (void)
+{
+ foo ("%d", 20);
+ return 3;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-1.c b/gcc/testsuite/gcc.target/i386/pr61296-1.c
new file mode 100644
index 0000000..751dee0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-1.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler ".align\[ \t]*32\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-2.c b/gcc/testsuite/gcc.target/i386/pr61296-2.c
new file mode 100644
index 0000000..5999555
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-2.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2 -malign-data=cacheline" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler ".align\[ \t]*64\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-3.c b/gcc/testsuite/gcc.target/i386/pr61296-3.c
new file mode 100644
index 0000000..d0152f7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-3.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2 -malign-data=abi" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler-not ".align\[ \t]*\[0-9\]+\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-4.c b/gcc/testsuite/gcc.target/i386/pr61296-4.c
new file mode 100644
index 0000000..95e1ac6
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-4.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2 -malign-data=cacheline -malign-data=abi" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler-not ".align\[ \t]*\[0-9\]+\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-5.c b/gcc/testsuite/gcc.target/i386/pr61296-5.c
new file mode 100644
index 0000000..5caa77c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-5.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2 -malign-data=abi -malign-data=cacheline" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler ".align\[ \t]*64\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-6.c b/gcc/testsuite/gcc.target/i386/pr61296-6.c
new file mode 100644
index 0000000..8e0d535
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-6.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2 -malign-data=cacheline -malign-data=compat" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler ".align\[ \t]*32\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr61296-7.c b/gcc/testsuite/gcc.target/i386/pr61296-7.c
new file mode 100644
index 0000000..6a67c90
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr61296-7.c
@@ -0,0 +1,27 @@
+/* PR target/61296 */
+/* { dg-do compile { target { *-*-linux* } } } */
+/* { dg-options "-O2 -malign-data=compat -malign-data=abi" } */
+
+struct foo
+{
+ char i1[8];
+ char i2[8];
+ char i3[8];
+ char i4[8];
+ char i5[8];
+ char i6[8];
+ char i7[8];
+ char i8[8];
+ char i9[8];
+ char i10[8];
+ char i11[8];
+ char i12[8];
+ char i13[8];
+ char i14[8];
+ char i15[8];
+ char i16[8];
+};
+
+struct foo x = { 1 };
+
+/* { dg-final { scan-assembler-not ".align\[ \t]*\[0-9\]+\[^:]*\[\n\r]x:" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr64291-1.c b/gcc/testsuite/gcc.target/i386/pr64291-1.c
new file mode 100644
index 0000000..85253c0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64291-1.c
@@ -0,0 +1,51 @@
+/* { dg-options "-O2" } */
+/* { dg-additional-sources pr64291-2.c } */
+/* { dg-do run } */
+void f(void*,...);
+void g(void*,long,long);
+int nnn=0;
+long test=0;
+
+typedef struct
+{
+ int _mp_size;
+ unsigned long *_mp_d;
+} __mpz_struct;
+typedef __mpz_struct mpz_t[1];
+
+int main ()
+{
+ mpz_t n, d;
+ long nn, dn;
+ unsigned long *np, *dup, *dnp, *qp;
+ long alloc, itch;
+
+ f (n);
+ f (d);
+ qp = (unsigned long*)__builtin_alloca(4099*8) + 1;
+ dnp = (unsigned long*)__builtin_alloca (2049*8);
+ alloc = 1;
+ for (test = 0; test < 1; test++)
+ {
+ dn = d->_mp_size;
+ dup = d->_mp_d;
+ f (dnp, dup, dn);
+ dnp[dn - 1] |= 1UL<<63;
+ f (0);
+ nn = nnn;
+ np = n->_mp_d;
+ qp[-1] = -757136820;
+ qp[nn - dn + 1] = 14883681;
+ f (0);
+ if (dn >= 6)
+ f (0);
+ itch = nn + 1;
+ if (itch + 1> alloc)
+ {
+ g(0,alloc*8,(itch+1)*8);
+ alloc = itch + 1;
+ }
+ f (np, nn);
+ }
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr64291-2.c b/gcc/testsuite/gcc.target/i386/pr64291-2.c
new file mode 100644
index 0000000..2f3f929
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr64291-2.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+extern void abort (void);
+void f(void*p,...){}
+void g(void*p,long a,long b){if (a!=8) abort();}
diff --git a/gcc/testsuite/gcc.target/sh/fpchg.c b/gcc/testsuite/gcc.target/sh/fpchg.c
deleted file mode 100644
index ad18c89..0000000
--- a/gcc/testsuite/gcc.target/sh/fpchg.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Check that fpchg is used to switch precision. */
-
-/* { dg-do compile } */
-/* { dg-final { scan-assembler "fpchg" } } */
-/* { dg-final { scan-assembler-not "fpscr" } } */
-/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" } } */
-
-extern float c;
-
-void
-foo(int j)
-{
- while (j--)
- c++;
-
-}
-
diff --git a/gcc/testsuite/gcc.target/sh/pr53513-1.c b/gcc/testsuite/gcc.target/sh/pr53513-1.c
new file mode 100644
index 0000000..9e4b344
--- /dev/null
+++ b/gcc/testsuite/gcc.target/sh/pr53513-1.c
@@ -0,0 +1,11 @@
+/* Check that fpchg is used to switch FPSCR.PR mode on SH4A. */
+/* { dg-additional-options "-O" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m4a" "-m4a-single" } } */
+/* { dg-final { scan-assembler "fpchg" } } */
+/* { dg-final { scan-assembler-not "fpscr" } } */
+
+double
+foo (float a, float b, double c)
+{
+ return (a * b) + c;
+}
diff --git a/gcc/testsuite/gcc.target/sh/pr54089-1.c b/gcc/testsuite/gcc.target/sh/pr54089-1.c
index 3eb700a..4dbd1b8 100644
--- a/gcc/testsuite/gcc.target/sh/pr54089-1.c
+++ b/gcc/testsuite/gcc.target/sh/pr54089-1.c
@@ -1,6 +1,6 @@
/* Check that the rotcr instruction is generated. */
/* { dg-do compile } */
-/* { dg-options "-O1" } */
+/* { dg-options "-O2" } */
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
/* { dg-final { scan-assembler-times "rotcr" 24 } } */
/* { dg-final { scan-assembler-times "shll\t" 1 } } */
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_comp_40.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_comp_40.f90
new file mode 100644
index 0000000..07d0959
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_comp_40.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+!
+! PR 64173: [F03] ICE involving procedure pointer component
+!
+! Contributed by Rich Townsend <townsend@astro.wisc.edu>
+
+ implicit none
+
+ type :: r_magnus_ivp_t
+ integer, allocatable :: jc
+ procedure(abscissa_), nopass, pointer :: abscissa_p
+ end type
+
+ abstract interface
+ function abscissa_ () result (x)
+ real, allocatable :: x(:)
+ end function
+ end interface
+
+contains
+
+ function doinit () result (iv)
+ type(r_magnus_ivp_t) :: iv
+ end function
+
+end
diff --git a/gcc/testsuite/gfortran.dg/typebound_call_26.f90 b/gcc/testsuite/gfortran.dg/typebound_call_26.f90
new file mode 100644
index 0000000..dffbf93
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/typebound_call_26.f90
@@ -0,0 +1,30 @@
+! { dg-do compile }
+!
+! PR 64244: [4.8/4.9/5 Regression] ICE at class.c:236 when using non_overridable
+!
+! Contributed by Ondřej Čertík <ondrej.certik@gmail.com>
+
+module m
+ implicit none
+
+ type :: A
+ contains
+ generic :: f => g
+ procedure, non_overridable :: g
+ end type
+
+contains
+
+ subroutine g(this)
+ class(A), intent(in) :: this
+ end subroutine
+
+end module
+
+
+program test_non_overridable
+ use m, only: A
+ implicit none
+ class(A), allocatable :: h
+ call h%f()
+end
diff --git a/gcc/testsuite/lib/mpx-dg.exp b/gcc/testsuite/lib/mpx-dg.exp
index de7eba8..be82ce1 100644
--- a/gcc/testsuite/lib/mpx-dg.exp
+++ b/gcc/testsuite/lib/mpx-dg.exp
@@ -18,7 +18,8 @@
# error-free for trivial code, 0 otherwise.
proc check_effective_target_mpx {} {
- return [check_no_compiler_messages mpx object {
+ return [check_no_compiler_messages mpx executable {
int *foo (int *arg) { return arg; }
+ int main (void) { return foo ((void *)0) == 0; }
} "-fcheck-pointer-bounds -mmpx"]
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 0a75489..59f2dab 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1617,8 +1617,12 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
/* Clear flags that need revisiting. */
if (gcall *call_stmt = dyn_cast <gcall *> (copy))
- if (gimple_call_tail_p (call_stmt))
- gimple_call_set_tail (call_stmt, false);
+ {
+ if (gimple_call_tail_p (call_stmt))
+ gimple_call_set_tail (call_stmt, false);
+ if (gimple_call_from_thunk_p (call_stmt))
+ gimple_call_set_from_thunk (call_stmt, false);
+ }
/* Remap the region numbers for __builtin_eh_{pointer,filter},
RESX and EH_DISPATCH. */
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index fca18b6..fe5d77a 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -5862,6 +5862,108 @@ iv_ca_prune (struct ivopts_data *data, struct iv_ca *ivs,
return best_cost;
}
+/* Check if CAND_IDX is a candidate other than OLD_CAND and has
+ cheaper local cost for USE than BEST_CP. Return pointer to
+ the corresponding cost_pair, otherwise just return BEST_CP. */
+
+static struct cost_pair*
+cheaper_cost_with_cand (struct ivopts_data *data, struct iv_use *use,
+ unsigned int cand_idx, struct iv_cand *old_cand,
+ struct cost_pair *best_cp)
+{
+ struct iv_cand *cand;
+ struct cost_pair *cp;
+
+ gcc_assert (old_cand != NULL && best_cp != NULL);
+ if (cand_idx == old_cand->id)
+ return best_cp;
+
+ cand = iv_cand (data, cand_idx);
+ cp = get_use_iv_cost (data, use, cand);
+ if (cp != NULL && cheaper_cost_pair (cp, best_cp))
+ return cp;
+
+ return best_cp;
+}
+
+/* Try breaking local optimal fixed-point for IVS by replacing candidates
+ which are used by more than one iv uses. For each of those candidates,
+ this function tries to represent iv uses under that candidate using
+ other ones with lower local cost, then tries to prune the new set.
+ If the new set has lower cost, It returns the new cost after recording
+ candidate replacement in list DELTA. */
+
+static comp_cost
+iv_ca_replace (struct ivopts_data *data, struct iv_ca *ivs,
+ struct iv_ca_delta **delta)
+{
+ bitmap_iterator bi, bj;
+ unsigned int i, j, k;
+ struct iv_use *use;
+ struct iv_cand *cand;
+ comp_cost orig_cost, acost;
+ struct iv_ca_delta *act_delta, *tmp_delta;
+ struct cost_pair *old_cp, *best_cp = NULL;
+
+ *delta = NULL;
+ orig_cost = iv_ca_cost (ivs);
+
+ EXECUTE_IF_SET_IN_BITMAP (ivs->cands, 0, i, bi)
+ {
+ if (ivs->n_cand_uses[i] == 1
+ || ivs->n_cand_uses[i] > ALWAYS_PRUNE_CAND_SET_BOUND)
+ continue;
+
+ cand = iv_cand (data, i);
+
+ act_delta = NULL;
+ /* Represent uses under current candidate using other ones with
+ lower local cost. */
+ for (j = 0; j < ivs->upto; j++)
+ {
+ use = iv_use (data, j);
+ old_cp = iv_ca_cand_for_use (ivs, use);
+
+ if (old_cp->cand != cand)
+ continue;
+
+ best_cp = old_cp;
+ if (data->consider_all_candidates)
+ for (k = 0; k < n_iv_cands (data); k++)
+ best_cp = cheaper_cost_with_cand (data, use, k,
+ old_cp->cand, best_cp);
+ else
+ EXECUTE_IF_SET_IN_BITMAP (use->related_cands, 0, k, bj)
+ best_cp = cheaper_cost_with_cand (data, use, k,
+ old_cp->cand, best_cp);
+
+ if (best_cp == old_cp)
+ continue;
+
+ act_delta = iv_ca_delta_add (use, old_cp, best_cp, act_delta);
+ }
+ /* No need for further prune. */
+ if (!act_delta)
+ continue;
+
+ /* Prune the new candidate set. */
+ iv_ca_delta_commit (data, ivs, act_delta, true);
+ acost = iv_ca_prune (data, ivs, NULL, &tmp_delta);
+ iv_ca_delta_commit (data, ivs, act_delta, false);
+ act_delta = iv_ca_delta_join (act_delta, tmp_delta);
+
+ if (compare_costs (acost, orig_cost) < 0)
+ {
+ *delta = act_delta;
+ return acost;
+ }
+ else
+ iv_ca_delta_free (&act_delta);
+ }
+
+ return orig_cost;
+}
+
/* Tries to extend the sets IVS in the best possible way in order
to express the USE. If ORIGINALP is true, prefer candidates from
the original set of IVs, otherwise favor important candidates not
@@ -5995,10 +6097,13 @@ get_initial_solution (struct ivopts_data *data, bool originalp)
return ivs;
}
-/* Tries to improve set of induction variables IVS. */
+/* Tries to improve set of induction variables IVS. TRY_REPLACE_P
+ points to a bool variable, this function tries to break local
+ optimal fixed-point by replacing candidates in IVS if it's true. */
static bool
-try_improve_iv_set (struct ivopts_data *data, struct iv_ca *ivs)
+try_improve_iv_set (struct ivopts_data *data,
+ struct iv_ca *ivs, bool *try_replace_p)
{
unsigned i, n_ivs;
comp_cost acost, best_cost = iv_ca_cost (ivs);
@@ -6042,7 +6147,20 @@ try_improve_iv_set (struct ivopts_data *data, struct iv_ca *ivs)
/* Try removing the candidates from the set instead. */
best_cost = iv_ca_prune (data, ivs, NULL, &best_delta);
- /* Nothing more we can do. */
+ if (!best_delta && *try_replace_p)
+ {
+ *try_replace_p = false;
+ /* So far candidate selecting algorithm tends to choose fewer IVs
+ so that it can handle cases in which loops have many variables
+ but the best choice is often to use only one general biv. One
+ weakness is it can't handle opposite cases, in which different
+ candidates should be chosen with respect to each use. To solve
+ the problem, we replace candidates in a manner described by the
+ comments of iv_ca_replace, thus give general algorithm a chance
+ to break local optimal fixed-point in these cases. */
+ best_cost = iv_ca_replace (data, ivs, &best_delta);
+ }
+
if (!best_delta)
return false;
}
@@ -6061,6 +6179,7 @@ static struct iv_ca *
find_optimal_iv_set_1 (struct ivopts_data *data, bool originalp)
{
struct iv_ca *set;
+ bool try_replace_p = true;
/* Get the initial solution. */
set = get_initial_solution (data, originalp);
@@ -6077,7 +6196,7 @@ find_optimal_iv_set_1 (struct ivopts_data *data, bool originalp)
iv_ca_dump (data, dump_file, set);
}
- while (try_improve_iv_set (data, set))
+ while (try_improve_iv_set (data, set, &try_replace_p))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
diff --git a/gcc/tree-streamer.c b/gcc/tree-streamer.c
index 102cb22..a4502bd 100644
--- a/gcc/tree-streamer.c
+++ b/gcc/tree-streamer.c
@@ -324,7 +324,18 @@ preload_common_nodes (struct streamer_tree_cache_d *cache)
/* Skip boolean type and constants, they are frontend dependent. */
if (i != TI_BOOLEAN_TYPE
&& i != TI_BOOLEAN_FALSE
- && i != TI_BOOLEAN_TRUE)
+ && i != TI_BOOLEAN_TRUE
+ /* MAIN_IDENTIFIER is not always initialized by Fortran FE. */
+ && i != TI_MAIN_IDENTIFIER
+ /* PID_TYPE is initialized only by C family front-ends. */
+ && i != TI_PID_TYPE
+ /* Skip optimization and target option nodes; they depend on flags. */
+ && i != TI_OPTIMIZATION_DEFAULT
+ && i != TI_OPTIMIZATION_CURRENT
+ && i != TI_TARGET_OPTION_DEFAULT
+ && i != TI_TARGET_OPTION_CURRENT
+ && i != TI_CURRENT_TARGET_PRAGMA
+ && i != TI_CURRENT_OPTIMIZE_PRAGMA)
record_common_node (cache, global_trees[i]);
}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index bd238d5..c49c942 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -2434,6 +2434,7 @@ extract_range_from_binary_expr_1 (value_range_t *vr,
&& code != MAX_EXPR
&& code != PLUS_EXPR
&& code != MINUS_EXPR
+ && code != RSHIFT_EXPR
&& (vr0.type == VR_VARYING
|| vr1.type == VR_VARYING
|| vr0.type != vr1.type
@@ -2948,6 +2949,15 @@ extract_range_from_binary_expr_1 (value_range_t *vr,
{
if (code == RSHIFT_EXPR)
{
+ /* Even if vr0 is VARYING or otherwise not usable, we can derive
+ useful ranges just from the shift count. E.g.
+ x >> 63 for signed 64-bit x is always [-1, 0]. */
+ if (vr0.type != VR_RANGE || symbolic_range_p (&vr0))
+ {
+ vr0.type = type = VR_RANGE;
+ vr0.min = vrp_val_min (expr_type);
+ vr0.max = vrp_val_max (expr_type);
+ }
extract_range_from_multiplicative_op_1 (vr, code, &vr0, &vr1);
return;
}
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 0ce1a7a..ea0057f 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-17 Oleg Endo <olegendo@gcc.gnu.org>
+
+ * config/sh/crt.h: New.
+ * config/sh/crti.S: Use GLOBAL macro from crt.h for _init and _fini
+ symbols.
+ * config/sh/crt1.S: Likewise.
+
2014-12-15 Uros Bizjak <ubizjak@gmail.com>
PR libgcc/63832
diff --git a/libgcc/config/sh/crt.h b/libgcc/config/sh/crt.h
new file mode 100644
index 0000000..1df4911
--- /dev/null
+++ b/libgcc/config/sh/crt.h
@@ -0,0 +1,29 @@
+/* Copyright (C) 2014 Free Software Foundation, Inc.
+
+This file 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 file is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef __USER_LABEL_PREFIX__
+#error __USER_LABEL_PREFIX__ not defined
+#endif
+
+#define CONCAT(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+#define GLOBAL(X) CONCAT(__USER_LABEL_PREFIX__,X)
diff --git a/libgcc/config/sh/crt1.S b/libgcc/config/sh/crt1.S
index d8b9295..b48a1a1 100644
--- a/libgcc/config/sh/crt1.S
+++ b/libgcc/config/sh/crt1.S
@@ -22,6 +22,7 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include "crt.h"
#ifdef MMU_SUPPORT
/* Section used for exception/timer interrupt stack area */
@@ -420,7 +421,7 @@ start:
#endif /* MMU_SUPPORT */
pt/l .Lzero_bss_loop, tr0
- pt/l _init, tr5
+ pt/l GLOBAL(_init), tr5
pt/l ___setup_argv_and_call_main, tr6
pt/l _exit, tr7
@@ -452,7 +453,7 @@ start:
! arrange for exit to call fini
pt/l _atexit, tr1
- LOAD_ADDR (_fini, r2)
+ LOAD_ADDR (GLOBAL(_fini), r2)
blink tr1, r18
! call init
@@ -850,9 +851,9 @@ exit_k:
atexit_k:
.long _atexit
init_k:
- .long _init
+ .long GLOBAL(_init)
fini_k:
- .long _fini
+ .long GLOBAL(_fini)
#ifdef VBR_SETUP
old_vbr_k:
.long old_vbr
@@ -1116,9 +1117,7 @@ vbr_600:
#if defined(__SH_FPU_ANY__)
.balign 4
pervading_precision_k:
-#define CONCAT1(A,B) A##B
-#define CONCAT(A,B) CONCAT1(A,B)
- .long CONCAT(__USER_LABEL_PREFIX__,__fpscr_values)+4
+ .long GLOBAL(__fpscr_values)+4
#endif
#else
mov.l 2f, r0 ! Load the old vbr setting (if any).
diff --git a/libgcc/config/sh/crti.S b/libgcc/config/sh/crti.S
index 550f637..cacd514 100644
--- a/libgcc/config/sh/crti.S
+++ b/libgcc/config/sh/crti.S
@@ -22,6 +22,7 @@ a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
+#include "crt.h"
/* The code in sections .init and .fini is supposed to be a single
regular function. The function in .init is called directly from
@@ -44,8 +45,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#else
.p2align 1
#endif
- .global _init
-_init:
+ .global GLOBAL(_init)
+GLOBAL(_init):
#if __SHMEDIA__
addi r15, -16, r15
st.q r15, 8, r14
@@ -89,8 +90,8 @@ _init:
#else
.p2align 1
#endif
- .global _fini
-_fini:
+ .global GLOBAL(_fini)
+GLOBAL(_fini):
#if __SHMEDIA__
addi r15, -16, r15
st.q r15, 8, r14
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 48114d1..380caf5 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1812,7 +1812,7 @@ s-syscall_arch: Makefile
sysinfo.go: s-sysinfo; @true
s-sysinfo: $(srcdir)/mksysinfo.sh config.h
- CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh
+ CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS) -O" $(SHELL) $(srcdir)/mksysinfo.sh
$(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
$(STAMP) $@
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 259d134..d495bf6 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -4421,7 +4421,7 @@ s-syscall_arch: Makefile
sysinfo.go: s-sysinfo; @true
s-sysinfo: $(srcdir)/mksysinfo.sh config.h
- CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS)" $(SHELL) $(srcdir)/mksysinfo.sh
+ CC="$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(OSCFLAGS) -O" $(SHELL) $(srcdir)/mksysinfo.sh
$(SHELL) $(srcdir)/mvifdiff.sh tmp-sysinfo.go sysinfo.go
$(STAMP) $@
diff --git a/libsanitizer/ChangeLog b/libsanitizer/ChangeLog
index e5f389b..8b2eb82 100644
--- a/libsanitizer/ChangeLog
+++ b/libsanitizer/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-16 Jakub Jelinek <jakub@redhat.com>
+
+ * sanitizer_common/sanitizer_symbolizer_libbacktrace.cc,
+ sanitizer_common/sanitizer_symbolizer_libbacktrace.h,
+ sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc: Cherry pick
+ upstream r224308.
+
2014-11-21 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/63784
diff --git a/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc b/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
index 9050794..8bae57b 100644
--- a/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc
@@ -165,9 +165,9 @@ uptr LibbacktraceSymbolizer::SymbolizeCode(uptr addr, AddressInfo *frames,
return data.n_frames;
}
-bool LibbacktraceSymbolizer::SymbolizeData(DataInfo *info) {
- backtrace_syminfo((backtrace_state *)state_, info->start,
- SymbolizeDataCallback, ErrorCallback, info);
+bool LibbacktraceSymbolizer::SymbolizeData(uptr addr, DataInfo *info) {
+ backtrace_syminfo((backtrace_state *)state_, addr, SymbolizeDataCallback,
+ ErrorCallback, info);
return true;
}
@@ -185,7 +185,7 @@ uptr LibbacktraceSymbolizer::SymbolizeCode(uptr addr, AddressInfo *frames,
return 0;
}
-bool LibbacktraceSymbolizer::SymbolizeData(DataInfo *info) {
+bool LibbacktraceSymbolizer::SymbolizeData(uptr addr, DataInfo *info) {
return false;
}
diff --git a/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.h b/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
index c7a83bf..aa75a79 100644
--- a/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
+++ b/libsanitizer/sanitizer_common/sanitizer_symbolizer_libbacktrace.h
@@ -33,7 +33,7 @@ class LibbacktraceSymbolizer {
uptr SymbolizeCode(uptr addr, AddressInfo *frames, uptr max_frames,
const char *module_name, uptr module_offset);
- bool SymbolizeData(DataInfo *info);
+ bool SymbolizeData(uptr addr, DataInfo *info);
// May return NULL if demangling failed.
static char *Demangle(const char *name, bool always_alloc = false);
diff --git a/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
index ccd2d70..5cc21d3 100644
--- a/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
@@ -593,7 +593,7 @@ class POSIXSymbolizer : public Symbolizer {
// First, try to use libbacktrace symbolizer (if it's available).
if (libbacktrace_symbolizer_ != 0) {
mu_.CheckLocked();
- if (libbacktrace_symbolizer_->SymbolizeData(info))
+ if (libbacktrace_symbolizer_->SymbolizeData(addr, info))
return true;
}
const char *str = SendCommand(true, module_name, module_offset);
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2f8c54b..2405bb5 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,28 @@
+2014-12-17 Tim Shen <timshen@google.com>
+
+ PR libstdc++/64302
+ PR libstdc++/64303
+ * include/bits/regex.h (match_results::cbegin, match_results::cend,
+ regex_token_iterator::regex_token_iterator,
+ regex_token_iterator::_M_normalize_result): Fix match_results cbegin
+ and cend and regex_token_iterator::_M_result invariant.
+ * include/bits/regex.tcc: Fix regex_token_iterator::_M_result invariant.
+ * testsuite/28_regex/iterators/regex_token_iterator/64303.cc: Testcase.
+
+2014-12-16 Jakub Jelinek <jakub@redhat.com>
+
+ * config/abi/pre/gnu.ver (CXXABI_1.3.9): Export not just
+ _Zd[la]Pvm, but also _Zd[la]Pv[jy] to cover other std::size_t
+ manglings.
+
+2014-12-16 Jason Merrill <jason@redhat.com>
+
+ * config/abi/pre/gnu-versioned-namespace.ver: And other size_t
+ manglings.
+
+ * config/abi/pre/gnu-versioned-namespace.ver: Export _ZdlPvm and
+ _ZdaPvm.
+
2014-12-15 Jason Merrill <jason@redhat.com>
* libsupc++/del_ops.cc: New.
diff --git a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
index 31155b7..4476a8f 100644
--- a/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
+++ b/libstdc++-v3/config/abi/pre/gnu-versioned-namespace.ver
@@ -338,6 +338,10 @@ CXXABI_2.0 {
_ZTVN10__cxxabiv120__si_class_type_infoE;
_ZTVN10__cxxabiv121__vmi_class_type_infoE;
+ # operator delete(void*, std::size_t)
+ _ZdlPv[jmy];
+ # operator delete[](void*, std::size_t)
+ _ZdaPv[jmy];
};
# Symbols in the support library (libsupc++) supporting trans-mem.
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 9b51659..5893f1b 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1734,9 +1734,9 @@ CXXABI_1.3.9 {
_ZTSPK[no];
# operator delete(void*, std::size_t)
- _ZdlPvm;
+ _ZdlPv[jmy];
# operator delete[](void*, std::size_t)
- _ZdaPvm;
+ _ZdaPv[jmy];
} CXXABI_1.3.8;
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 3afec37..80b1de8 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -1756,7 +1756,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
const_iterator
cbegin() const
- { return _Base_type::cbegin() + 2; }
+ { return this->begin(); }
/**
* @brief Gets an iterator to one-past-the-end of the collection.
@@ -1770,7 +1770,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
const_iterator
cend() const
- { return _Base_type::cend(); }
+ { return this->end(); }
//@}
@@ -2632,7 +2632,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
regex_constants::match_flag_type __m
= regex_constants::match_default)
: _M_position(__a, __b, __re, __m),
- _M_subs(__submatches, *(&__submatches+1)), _M_n(0)
+ _M_subs(__submatches, __submatches + _Nm), _M_n(0)
{ _M_init(__a, __b); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@@ -2660,12 +2660,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/
regex_token_iterator(const regex_token_iterator& __rhs)
: _M_position(__rhs._M_position), _M_subs(__rhs._M_subs),
- _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_result(__rhs._M_result),
- _M_has_m1(__rhs._M_has_m1)
- {
- if (__rhs._M_result == &__rhs._M_suffix)
- _M_result = &_M_suffix;
- }
+ _M_suffix(__rhs._M_suffix), _M_n(__rhs._M_n), _M_has_m1(__rhs._M_has_m1)
+ { _M_normalize_result(); }
/**
* @brief Assigns a %regex_token_iterator to another.
@@ -2737,6 +2733,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_end_of_seq() const
{ return _M_result == nullptr; }
+ // [28.12.2.2.4]
+ void
+ _M_normalize_result()
+ {
+ if (_M_position != _Position())
+ _M_result = &_M_current_match();
+ else if (_M_has_m1)
+ _M_result = &_M_suffix;
+ else
+ _M_result = nullptr;
+ }
+
_Position _M_position;
std::vector<int> _M_subs;
value_type _M_suffix;
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index b676428..0206a6c 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -607,11 +607,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_position = __rhs._M_position;
_M_subs = __rhs._M_subs;
_M_n = __rhs._M_n;
- _M_result = __rhs._M_result;
_M_suffix = __rhs._M_suffix;
_M_has_m1 = __rhs._M_has_m1;
- if (__rhs._M_result == &__rhs._M_suffix)
- _M_result = &_M_suffix;
+ _M_normalize_result();
return *this;
}
diff --git a/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc b/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc
new file mode 100644
index 0000000..f09bbe1
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc
@@ -0,0 +1,49 @@
+// { dg-do run }
+// { dg-options "-std=gnu++11" }
+
+//
+// Copyright (C) 2014 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/>.
+
+// 28.12.2 Class template regex_token_iterator
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ const std::string s(" 111 222 ");
+ const std::regex re("\\w+");
+
+ std::sregex_token_iterator it1(s.begin(), s.end(), re), it2(it1), end;
+
+ for (; it1 != end; ++it1, ++it2) {
+ VERIFY(it1 == it2);
+ VERIFY(*it1 == *it2);
+ }
+ VERIFY(it2 == end);
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}