summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog145
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in15
-rw-r--r--gcc/ada/ChangeLog51
-rw-r--r--gcc/ada/adaint.h2
-rw-r--r--gcc/ada/gcc-interface/decl.c2
-rw-r--r--gcc/ada/gcc-interface/utils.c10
-rw-r--r--gcc/ada/s-osinte-aix.adb61
-rw-r--r--gcc/ada/s-osinte-aix.ads17
-rw-r--r--gcc/ada/s-osinte-darwin.adb59
-rw-r--r--gcc/ada/s-osinte-darwin.ads14
-rw-r--r--gcc/ada/s-osinte-hpux-dce.adb26
-rw-r--r--gcc/ada/s-osinte-hpux-dce.ads14
-rw-r--r--gcc/ada/s-osinte-hpux.ads16
-rw-r--r--gcc/ada/s-osinte-irix.adb31
-rw-r--r--gcc/ada/s-osinte-irix.ads14
-rw-r--r--gcc/ada/s-osinte-kfreebsd-gnu.ads19
-rw-r--r--gcc/ada/s-osinte-linux.ads6
-rw-r--r--gcc/ada/s-osinte-rtems.adb34
-rw-r--r--gcc/ada/s-osinte-rtems.ads14
-rw-r--r--gcc/ada/s-osinte-solaris-posix.ads14
-rw-r--r--gcc/ada/s-osinte-solaris.adb34
-rw-r--r--gcc/ada/s-osinte-solaris.ads16
-rw-r--r--gcc/config/alpha/alpha.md12
-rw-r--r--gcc/config/arm/arm.c19
-rw-r--r--gcc/config/i386/i386-protos.h3
-rw-r--r--gcc/config/i386/i386.c125
-rw-r--r--gcc/config/i386/i386.md67
-rw-r--r--gcc/config/i386/predicates.md26
-rw-r--r--gcc/config/i386/sse.md83
-rw-r--r--gcc/config/mips/mips-protos.h5
-rw-r--r--gcc/config/mips/mips.c33
-rw-r--r--gcc/config/mips/mips.md24
-rw-r--r--gcc/config/sh/sh.md2
-rw-r--r--gcc/cp/ChangeLog45
-rw-r--r--gcc/cp/Make-lang.in2
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/cp-objcp-common.c2
-rw-r--r--gcc/cp/cp-tree.def10
-rw-r--r--gcc/cp/cp-tree.h47
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/cp/pt.c109
-rw-r--r--gcc/cp/semantics.c57
-rw-r--r--gcc/cp/tree.c15
-rw-r--r--gcc/doc/invoke.texi2
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/resolve.c3
-rw-r--r--gcc/fortran/trans-const.c8
-rw-r--r--gcc/ipa-cp.c14
-rw-r--r--gcc/ipa-inline.c5
-rw-r--r--gcc/ira-lives.c2
-rw-r--r--gcc/opts.c3
-rw-r--r--gcc/predict.c2
-rw-r--r--gcc/testsuite/ChangeLog134
-rw-r--r--gcc/testsuite/g++.dg/template/typedef13.C4
-rw-r--r--gcc/testsuite/g++.dg/template/typedef19.C4
-rw-r--r--gcc/testsuite/g++.dg/template/typedef20.C4
-rw-r--r--gcc/testsuite/g++.dg/template/typedef22.C18
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr42025-1.c24
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr42025-2.c32
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr40404.c7
-rw-r--r--gcc/testsuite/gcc.dg/Wtype-limits.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c2
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr41264-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/block-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/id-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-0.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/interchange-6.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/pr40157.c1
-rw-r--r--gcc/testsuite/gcc.dg/graphite/run-id-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-17.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-18.c2
-rw-r--r--gcc/testsuite/gcc.dg/graphite/scop-matmult.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr36998.c24
-rw-r--r--gcc/testsuite/gcc.dg/pr39226.c9
-rw-r--r--gcc/testsuite/gcc.dg/pr41340.c1
-rw-r--r--gcc/testsuite/gcc.dg/profile-generate-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/raw-string-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/raw-string-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/sms-6.c5
-rw-r--r--gcc/testsuite/gcc.dg/sms-7.c5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr37868.c12
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/asmgoto-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr33920.c2
-rw-r--r--gcc/testsuite/gcc.dg/utf-array-short-wchar.c2
-rw-r--r--gcc/testsuite/gcc.dg/utf-array.c2
-rw-r--r--gcc/testsuite/gcc.dg/utf-cvt.c10
-rw-r--r--gcc/testsuite/gcc.dg/utf32-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/utf32-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/utf32-3.c1
-rw-r--r--gcc/testsuite/gcc.dg/utf32-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/utf8-2.c2
-rw-r--r--gcc/testsuite/gcc.target/alpha/pr42113.c12
-rw-r--r--gcc/testsuite/gcc.target/ia64/fptr-1.c16
-rw-r--r--gcc/testsuite/gcc.target/mips/mult-1.c4
-rw-r--r--gcc/testsuite/gcc.target/mips/octeon-dmul-3.c19
-rw-r--r--gcc/testsuite/gfortran.dg/array_constructor_32.f9028
-rw-r--r--gcc/testsuite/gfortran.dg/data_value_1.f904
-rw-r--r--gcc/testsuite/gnat.dg/specs/weak1.ads7
-rw-r--r--gcc/testsuite/lib/compat.exp6
-rw-r--r--gcc/testsuite/lib/lto.exp10
-rw-r--r--gcc/tree-cfg.c27
-rw-r--r--gcc/tree-dfa.c22
-rw-r--r--gcc/tree-optimize.c4
-rw-r--r--gcc/tree-sra.c86
116 files changed, 1376 insertions, 587 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fee14941bc8..8ed02bd787e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,131 @@
+2009-11-24 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/i386/i386.md (add<mode>3_carry): Change insn pattern
+ to expander.
+ (sub<mode>3_carry): Ditto.
+ (x86_mov<mode>cc_0_m1): Ditto.
+ (*add<mode>3_carry): New insn pattern. Use VOIDmode match_operator
+ for ix86_carry_flag_operator operator predicate.
+ (*sub<mode>3_carry): Ditto.
+ (*x86_mov<mode>cc_0_m1): Ditto.
+ (*addsi3_carry_zext): Use VOIDmode match_operator for
+ ix86_carry_flag_operator operator predicate.
+ (*subsi3_carry_zext): Ditto.
+ (*x86_mov<mode>cc_0_m1_s): Ditto.
+ (*x86_mov<mode>cc_0_m1_neg): Ditto.
+ * config/i386/predocates.md (ix86_carry_flag_operator): Do not
+ check operator sub-expressions for FLAGS_REG and const0_rtx.
+ * config/i386/i386.c (*ix86_gen_sub3_carry): Update prototype.
+ (ix86_expand_int_movcc): Update calls to gen_x86_mov{si,di}cc_0_m1.
+ (ix86_expand_int_addcc): Update calls to
+ gen_{add,sub}{qi,hi,si,di}3_carry. Do not set mode of compare_op.
+ (ix86_expand_strlensi_unroll_1): Update calls to ix86_gen_sub3_carry.
+ Do not set mode of compare operation.
+
+2009-11-23 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/42151
+ * ipa-inline.c (inline_transform): Avoid ICE when transform is called
+ twice.
+
+2009-11-23 Jan Hubicka <jh@suse.cz>
+
+ * ipa-cp.c (ipcp_compute_node_scale): Work around completely
+ wrong profile updates.
+ * predict.c (counts_to_freqs): Be expected for ENTRY/EXIT block
+ having largest frequency.
+ * ira-live.c (ira_implicitly_set_insn_hard_regs): Silecne
+ used uninitalized warning.
+ * tree-optimize.c (execute_fixup_cfg): Rescale entry and exit block
+ frequencies.
+
+2009-11-23 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.md (*cmp_sadd_sidi): Use gen_lowpart instead
+ of gen_rtx_REG to generate operand 5.
+ (*cmp_ssub_sidi): Ditto.
+
+2009-11-23 Richard Henderson <rth@redhat.com>
+
+ * config/i386/i386.c (avx_vpermilp_parallel): Fix sign compare
+ mismatch.
+
+2009-11-23 Paul Brook <paul@codesourcery.com>
+
+ * config/arm/arm.c (arm_compute_save_reg0_reg12_mask): Add special
+ case for noreturn functions.
+ (arm_compute_save_reg_mask): Remove special noreturn handling.
+
+2009-11-23 Richard Guenther <rguenther@suse.de>
+
+ * tree-dfa.c (get_ref_base_and_extent): Adjust maximum access
+ size for DECL bases.
+
+2009-11-22 Richard Henderson <rth@redhat.com>
+
+ * i386.c (avx_vpermilp_parallel): New function.
+ * i386-protos.h: Declare it.
+ * predicates.md (avx_vpermilp_v8sf_operand, avx_vpermilp_v4df_operand,
+ avx_vpermilp_v4sf_operand, avx_vpermilp_v2df_operand): New.
+ * sse.md (AVXMODEFDP, AVXMODEFSP): New iterators.
+ (ssescalarnum, ssedoublesizemode): Add AVX modes.
+ (vpermilbits): Remove.
+ (avx_vpermil<mode>): Change insns to expanders.
+ (*avx_vpermil<mode>): New. Use vec_select.
+
+2009-11-22 Richard Earnshaw <rearnsha@arm.com>
+
+ * opts.c (decode_options): Don't enable flag_schedule_insns
+ when optimizing for size.
+ * doc/invoke.texi: Document change.
+
+2009-11-22 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/42113
+ * config/alpha/alpha.md (*cmp_sadd_si): Change mode
+ of scratch register to SImode.
+ (*cmp_sadd_sidi): Ditto.
+ (*cmp_ssub_si): Ditto.
+ (*cmp_ssub_sidi): Ditto.
+
+2009-11-21 Ian Lance Taylor <iant@google.com>
+
+ * Makefile.in (HOST_LIBS): Move higher in file.
+ (LINKER, LINKER_FLAGS): If ENABLE_BUILD_WITH_CXX, but $(HOST_LIBS)
+ is not empty, set to $(CC) and $(CFLAGS).
+
+2009-11-22 Martin Jambor <mjambor@suse.cz>
+
+ * tree-cfg.c (verify_types_in_gimple_reference): Error out on
+ V_C_E of an SSA_NAME or an invariant if lvalue is required.
+ (verify_gimple_call): Verify LHS also with with
+ verify_types_in_gimple_reference.
+
+2009-11-21 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/42025
+ * tree-sra.c (access_precludes_ipa_sra_p): New function.
+ (splice_param_accesses): Check all accesses by calling
+ access_precludes_ipa_sra_p.
+ (sra_ipa_modify_expr): Rename argument erite to dont_convert and do
+ not convert types if it is true.
+ (sra_ipa_modify_assign): Convert types in case of mismatch.
+
+2009-11-21 Kaushik Phatak <kaushik.phatak@kpitcummins.com>
+
+ * config/sh/sh.md (cmpeqsi_t-1): Use logical_operand predicate
+ for operand 1.
+
+2009-11-21 Adam Nemet <adambnemet@gmail.com>
+
+ * config/mips/mips-protos.h (mulsidi3_gen_fn): New typedef.
+ (mips_mulsidi3_gen_fn): Declare new function.
+ * config/mips/mips.c (mips_mulsidi3_gen_fn): New function.
+ * config/mips/mips.md (<u>mulsidi3): Change condition to use
+ mips_mulsidi3_gen_fn. Use mips_mulsidi3_gen_fn to generate the insn.
+ (<u>mulsidi3_64bit): Don't match for ISA_HAS_DMUL3.
+ (mulsidi3_64bit_dmul): New define_insn.
+
2009-11-21 Ben Elliston <bje@au.ibm.com>
* gengtype-lex.l: Enable noinput flex option.
@@ -85,7 +213,7 @@
(INT8_TYPE, INT16_TYPE, INT32_TYPE, INT64_TYPE): Define.
(UINT8_TYPE, UINT16_TYPE, UINT32_TYPE, UINT64_TYPE): Define.
(INT_LEAST8_TYPE, INT_LEAST16_TYPE, INT_LEAST32_TYPE,
- (INT_LEAST64_TYPE): Define.
+ INT_LEAST64_TYPE): Define.
(UINT_LEAST8_TYPE, UINT_LEAST16_TYPE, UINT_LEAST32_TYPE,
UINT_LEAST64_TYPE): Define.
(INT_FAST8_TYPE, INT_FAST16_TYPE, INT_FAST32_TYPE,
@@ -105,11 +233,10 @@
* dwarf2out.c (get_context_die): Take TYPE_MAIN_VARIANT.
2009-11-19 Basile Starynkevitch <basile@starynkevitch.net>
- Rafael Avila de Espindola <espindola@google.com>
+ Rafael Avila de Espindola <espindola@google.com>
* doc/plugins.texi (Plugin initialization): Added advices for
- retrieving the version of GCC at plugin compilation and loading
- times.
+ retrieving the version of GCC at plugin compilation and loading times.
2009-11-19 Basile Starynkevitch <basile@starynkevitch.net>
@@ -156,11 +283,10 @@
2009-11-18 Daniel Jacobowitz <dan@codesourcery.com>
- * config/arm/neon-docgen.ml (analyze_shape_elt): Handle
- Alternatives.
+ * config/arm/neon-docgen.ml (analyze_shape_elt): Handle alternatives.
2009-11-18 Paul Brook <paul@codesourcery.com>
- Daniel Jacobowitz <dan@codesourcery.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
* config/arm/arm.c (FL_ARCH7EM, FL_FOR_ARCH7EM): Define.
(arm_arch7em): New variable.
@@ -210,14 +336,13 @@
2009-11-18 Shujing Zhao <pearly.zhao@oracle.com>
PR middle-end/22201
- * params.def (PARAM_INLINE_UNIT_GROWTH)
- PARAM_IPCP_UNIT_GROWTH)
+ * params.def (PARAM_INLINE_UNIT_GROWTH, PARAM_IPCP_UNIT_GROWTH)
(PARAM_EARLY_INLINING_INSNS, PARAM_IRA_MAX_LOOPS_NUM)
(PARAM_IRA_MAX_CONFLICT_TABLE_SIZE)
(PARAM_LOOP_INVARIANT_MAX_BBS_IN_LOOP)
(PARAM_MIN_INSN_TO_PREFETCH_RATIO)
(PARAM_PREFETCH_MIN_INSN_TO_MEM_RATIO)
- PARAM_IPA_SRA_PTR_GROWTH_FACTOR): Uppercase the first letter of the
+ (PARAM_IPA_SRA_PTR_GROWTH_FACTOR): Uppercase the first letter of the
description string.
2009-11-18 Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index ecb16ef0a6b..d2e62f24674 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20091121
+20091124
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 0c706b95f5c..b9edc4a2051 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -207,6 +207,9 @@ NM = @NM@
RANLIB = @RANLIB@
RANLIB_FLAGS = @ranlib_flags@
+# Libraries to use on the host.
+HOST_LIBS = @HOST_LIBS@
+
# The name of the compiler to use.
ENABLE_BUILD_WITH_CXX = @ENABLE_BUILD_WITH_CXX@
ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
@@ -217,8 +220,17 @@ LINKER_FLAGS = $(CFLAGS)
else
COMPILER = $(CXX)
COMPILER_FLAGS = $(CXXFLAGS)
+# If HOST_LIBS is set, then the user is controlling the libraries to
+# link against. In that case, link with $(CC) so that the -lstdc++
+# library is not introduced. If HOST_LIBS is not set, link with
+# $(CXX) to pick up -lstdc++.
+ifeq ($(HOST_LIBS),)
LINKER = $(CXX)
LINKER_FLAGS = $(CXXFLAGS)
+else
+LINKER = $(CC)
+LINKER_FLAGS = $(CFLAGS)
+endif
endif
# -------------------------------------------
@@ -289,9 +301,6 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \
# In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
OUTPUT_OPTION = @OUTPUT_OPTION@
-# Libraries to use on the host.
-HOST_LIBS = @HOST_LIBS@
-
# This is where we get zlib from. zlibdir is -L../zlib and zlibinc is
# -I../zlib, unless we were configured with --with-system-zlib, in which
# case both are empty.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 86f2bcc3c22..a0ed110a50f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,13 +1,46 @@
-2009-11-21 Eric Botcazou <ebotcazou@adacore.com>
- Laurent GUERBY <laurent@guerby.net>
+2009-11-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Pass the list
+ of attributes when building the corresponding variable of a constant.
+ * gcc-interface/utils.c (create_var_decl_1): Do not process attributes
+ for constants.
+
+2009-11-23 Laurent GUERBY <laurent@guerby.net>
+ Eric Botcazou <ebotcazou@adacore.com>
- * s-osinte-linux.ads (struct_timeval, To_Duration, To_Timeval,
- gettimeofday): Delete.
- * s-osinte-posix.adb (To_Duration, To_Timeval): Delete.
- * s-osprim-posix.adb (struct_timezone, struct_timeval,
- gettimeofday): Delete.
- (Clock): Use cal.c timeval_to_duration.
- * s-taprop-linux.adb (Monotonic_Clock): Likewise.
+ PR ada/42153
+ * s-osinte-linux.ads (struct_timeval): Delete.
+ * s-osinte-hpux.ads (struct_timeval, To_Duration, To_Timeval): Delete.
+ * s-osinte-kfreebsd-gnu.ads: Likewise.
+ * s-osinte-rtems.ads: Likewise.
+ * s-osinte-aix.ads: Likewise.
+ * s-osinte-hpux-dce.ads: Likewise.
+ * s-osinte-darwin.ads: Likewise.
+ * s-osinte-solaris-posix.ads: Likewise.
+ * s-osinte-irix.ads: Likewise.
+ * s-osinte-solaris.ads: Likewise.
+ * s-osinte-hpux-dce.adb (To_Duration, To_Timeval): Delete.
+ * s-osinte-irix.adb: Likewise.
+ * s-osinte-solaris.adb: Likewise.
+ * s-osinte-rtems.adb: Likewise. Minor reformatting.
+ * s-osinte-aix.adb (To_Duration, To_Timeval): Delete.
+ (clock_gettime): Use cal.c's timeval_to_duration.
+ * s-osinte-darwin.adb: Likewise.
+
+2009-11-23 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * adaint.h: Assume large file support on IRIX only if _LFAPI.
+
+2009-11-21 Laurent GUERBY <laurent@guerby.net>
+ Eric Botcazou <ebotcazou@adacore.com>
+
+ * s-osinte-linux.ads (struct_timeval, To_Duration, To_Timeval,
+ gettimeofday): Delete.
+ * s-osinte-posix.adb (To_Duration, To_Timeval): Delete.
+ * s-osprim-posix.adb (struct_timezone, struct_timeval, gettimeofday):
+ Delete.
+ (Clock): Use cal.c's timeval_to_duration.
+ * s-taprop-linux.adb (Monotonic_Clock): Likewise.
2009-11-12 Eric Botcazou <ebotcazou@adacore.com>
Laurent GUERBY <laurent@guerby.net>
diff --git a/gcc/ada/adaint.h b/gcc/ada/adaint.h
index 76a181a001c..0412ffbf808 100644
--- a/gcc/ada/adaint.h
+++ b/gcc/ada/adaint.h
@@ -47,7 +47,7 @@
determine at compile time what support the system offers for large files.
For now we just list the platforms we have manually tested. */
-#if defined (__GLIBC__) || defined (sun) || defined (__sgi)
+#if defined (__GLIBC__) || defined (sun) || (defined (__sgi) && defined(_LFAPI))
#define GNAT_FOPEN fopen64
#define GNAT_STAT stat64
#define GNAT_FSTAT fstat64
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 9e643a3108b..ceb1f349ce8 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -1366,7 +1366,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
tree gnu_corr_var
= create_true_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
gnu_expr, true, Is_Public (gnat_entity),
- !definition, static_p, NULL,
+ !definition, static_p, attr_list,
gnat_entity);
SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var);
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index c79dd4e7a65..ae2bf744421 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1404,10 +1404,12 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
!= null_pointer_node)
DECL_IGNORED_P (var_decl) = 1;
- if (asm_name && VAR_OR_FUNCTION_DECL_P (var_decl))
- SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
-
- process_attributes (var_decl, attr_list);
+ if (TREE_CODE (var_decl) == VAR_DECL)
+ {
+ if (asm_name)
+ SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
+ process_attributes (var_decl, attr_list);
+ }
/* Add this decl to the current binding level. */
gnat_pushdecl (var_decl, gnat_node);
diff --git a/gcc/ada/s-osinte-aix.adb b/gcc/ada/s-osinte-aix.adb
index 3c54faf50e8..15b4d63db43 100644
--- a/gcc/ada/s-osinte-aix.adb
+++ b/gcc/ada/s-osinte-aix.adb
@@ -48,11 +48,6 @@ package body System.OS_Interface is
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
- function To_Duration (TV : struct_timeval) return Duration is
- begin
- return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
- end To_Duration;
-
------------------------
-- To_Target_Priority --
------------------------
@@ -104,31 +99,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- ----------------
- -- To_Timeval --
- ----------------
-
- function To_Timeval (D : Duration) return struct_timeval is
- S : long;
- F : Duration;
-
- begin
- S := long (Long_Long_Integer (D));
- F := D - Duration (S);
-
- -- If F is negative due to a round-up, adjust for positive F value
-
- if F < 0.0 then
- S := S - 1;
- F := F + 1.0;
- end if;
-
- return
- struct_timeval'
- (tv_sec => S,
- tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
- end To_Timeval;
-
-------------------
-- clock_gettime --
-------------------
@@ -138,20 +108,37 @@ package body System.OS_Interface is
tp : access timespec)
return int
is
- pragma Warnings (Off, clock_id);
+ pragma Unreferenced (clock_id);
+
+ -- Darwin threads don't have clock_gettime, so use
+ -- gettimeofday() instead.
+
+ use Interfaces;
+
+ type timeval is array (1 .. 2) of C.long;
+
+ procedure timeval_to_duration
+ (T : not null access timeval;
+ sec : not null access C.long;
+ usec : not null access C.long);
+ pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
+ Micro : constant := 10**6;
+ sec : aliased C.long;
+ usec : aliased C.long;
+ TV : aliased timeval;
Result : int;
- tv : aliased struct_timeval;
function gettimeofday
- (tv : access struct_timeval;
- tz : System.Address := System.Null_Address)
- return int;
+ (Tv : access timeval;
+ Tz : System.Address := System.Null_Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
begin
- Result := gettimeofday (tv'Unchecked_Access);
- tp.all := To_Timespec (To_Duration (tv));
+ Result := gettimeofday (TV'Access, System.Null_Address);
+ pragma Assert (Result = 0);
+ timeval_to_duration (TV'Access, sec'Access, usec'Access);
+ tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro);
return Result;
end clock_gettime;
diff --git a/gcc/ada/s-osinte-aix.ads b/gcc/ada/s-osinte-aix.ads
index b5de4f28ba9..b1639a77e3f 100644
--- a/gcc/ada/s-osinte-aix.ads
+++ b/gcc/ada/s-osinte-aix.ads
@@ -206,7 +206,6 @@ package System.OS_Interface is
function clock_gettime
(clock_id : clockid_t;
tp : access timespec) return int;
- -- AIX threads don't have clock_gettime, so use gettimeofday() instead
function To_Duration (TS : timespec) return Duration;
pragma Inline (To_Duration);
@@ -221,16 +220,6 @@ package System.OS_Interface is
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
- type struct_timeval is private;
- -- This is needed on systems that do not have clock_gettime() but do have
- -- gettimeofday().
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -554,12 +543,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
- type struct_timeval is record
- tv_sec : long;
- tv_usec : long;
- end record;
- pragma Convention (C, struct_timeval);
-
type pthread_attr_t is new System.Address;
pragma Convention (C, pthread_attr_t);
-- typedef struct __pt_attr *pthread_attr_t;
diff --git a/gcc/ada/s-osinte-darwin.adb b/gcc/ada/s-osinte-darwin.adb
index ac016d06927..1f47ddeb409 100644
--- a/gcc/ada/s-osinte-darwin.adb
+++ b/gcc/ada/s-osinte-darwin.adb
@@ -48,11 +48,6 @@ package body System.OS_Interface is
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
- function To_Duration (TV : struct_timeval) return Duration is
- begin
- return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
- end To_Duration;
-
------------------------
-- To_Target_Priority --
------------------------
@@ -88,31 +83,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- ----------------
- -- To_Timeval --
- ----------------
-
- function To_Timeval (D : Duration) return struct_timeval is
- S : time_t;
- F : Duration;
-
- begin
- S := time_t (D);
- F := D - Duration (S);
-
- -- If F has negative value due to a round-up, adjust for positive F
- -- value.
-
- if F < 0.0 then
- S := S - 1;
- F := F + 1.0;
- end if;
-
- return struct_timeval'
- (Tv_Sec => S,
- tv_usec => int32_t (Long_Long_Integer (F * 10#1#E6)));
- end To_Timeval;
-
-------------------
-- clock_gettime --
-------------------
@@ -122,17 +92,36 @@ package body System.OS_Interface is
tp : access timespec) return int
is
pragma Unreferenced (clock_id);
+
+ -- AIX threads don't have clock_gettime, so use
+ -- gettimeofday() instead.
+
+ use Interfaces;
+
+ type timeval is array (1 .. 2) of C.long;
+
+ procedure timeval_to_duration
+ (T : not null access timeval;
+ sec : not null access C.long;
+ usec : not null access C.long);
+ pragma Import (C, timeval_to_duration, "__gnat_timeval_to_duration");
+
+ Micro : constant := 10**6;
+ sec : aliased C.long;
+ usec : aliased C.long;
+ TV : aliased timeval;
Result : int;
- tv : aliased struct_timeval;
function gettimeofday
- (tv : access struct_timeval;
- tz : System.Address := System.Null_Address) return int;
+ (Tv : access timeval;
+ Tz : System.Address := System.Null_Address) return int;
pragma Import (C, gettimeofday, "gettimeofday");
begin
- Result := gettimeofday (tv'Unchecked_Access);
- tp.all := To_Timespec (To_Duration (tv));
+ Result := gettimeofday (TV'Access, System.Null_Address);
+ pragma Assert (Result = 0);
+ timeval_to_duration (TV'Access, sec'Access, usec'Access);
+ tp.all := To_Timespec (Duration (sec) + Duration (usec) / Micro);
return Result;
end clock_gettime;
diff --git a/gcc/ada/s-osinte-darwin.ads b/gcc/ada/s-osinte-darwin.ads
index 71cbe1517ab..99bdc6d8ea6 100644
--- a/gcc/ada/s-osinte-darwin.ads
+++ b/gcc/ada/s-osinte-darwin.ads
@@ -199,14 +199,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -528,12 +520,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : int32_t;
- end record;
- pragma Convention (C, struct_timeval);
-
--
-- Darwin specific signal implementation
--
diff --git a/gcc/ada/s-osinte-hpux-dce.adb b/gcc/ada/s-osinte-hpux-dce.adb
index ea8f80810b0..45a5ed1dc56 100644
--- a/gcc/ada/s-osinte-hpux-dce.adb
+++ b/gcc/ada/s-osinte-hpux-dce.adb
@@ -78,32 +78,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- function To_Duration (TV : struct_timeval) return Duration is
- begin
- return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
- end To_Duration;
-
- function To_Timeval (D : Duration) return struct_timeval is
- S : time_t;
- F : Duration;
- begin
- S := time_t (Long_Long_Integer (D));
- F := D - Duration (S);
-
- -- If F has negative value due to a round-up, adjust for positive F
- -- value.
-
- if F < 0.0 then
- S := S - 1;
- F := F + 1.0;
- end if;
-
- return
- struct_timeval'
- (tv_sec => S,
- tv_usec => time_t (Long_Long_Integer (F * 10#1#E6)));
- end To_Timeval;
-
-------------------------
-- POSIX.1c Section 3 --
-------------------------
diff --git a/gcc/ada/s-osinte-hpux-dce.ads b/gcc/ada/s-osinte-hpux-dce.ads
index d296cfe1f27..417aae98e91 100644
--- a/gcc/ada/s-osinte-hpux-dce.ads
+++ b/gcc/ada/s-osinte-hpux-dce.ads
@@ -207,14 +207,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -459,12 +451,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 1;
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type cma_t_address is new System.Address;
type cma_t_handle is record
diff --git a/gcc/ada/s-osinte-hpux.ads b/gcc/ada/s-osinte-hpux.ads
index 29605b8e1d0..5c4003d30a3 100644
--- a/gcc/ada/s-osinte-hpux.ads
+++ b/gcc/ada/s-osinte-hpux.ads
@@ -209,16 +209,6 @@ package System.OS_Interface is
pragma Convention (C, struct_timezone);
type struct_timezone_ptr is access all struct_timezone;
- type struct_timeval is private;
- -- This is needed on systems that do not have clock_gettime()
- -- but do have gettimeofday().
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -535,12 +525,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 1;
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type pthread_attr_t is new int;
type pthread_condattr_t is new int;
type pthread_mutexattr_t is new int;
diff --git a/gcc/ada/s-osinte-irix.adb b/gcc/ada/s-osinte-irix.adb
index d63ee9cbba7..cc3e015f742 100644
--- a/gcc/ada/s-osinte-irix.adb
+++ b/gcc/ada/s-osinte-irix.adb
@@ -60,11 +60,6 @@ package body System.OS_Interface is
return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
end To_Duration;
- function To_Duration (TV : struct_timeval) return Duration is
- begin
- return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
- end To_Duration;
-
-----------------
-- To_Timespec --
-----------------
@@ -89,30 +84,4 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- ----------------
- -- To_Timeval --
- ----------------
-
- function To_Timeval (D : Duration) return struct_timeval is
- S : time_t;
- F : Duration;
-
- begin
- S := time_t (Long_Long_Integer (D));
- F := D - Duration (S);
-
- -- If F has negative value due to a round-up, adjust for positive F
- -- value.
-
- if F < 0.0 then
- S := S - 1;
- F := F + 1.0;
- end if;
-
- return
- struct_timeval'
- (tv_sec => S,
- tv_usec => time_t (Long_Long_Integer (F * 10#1#E6)));
- end To_Timeval;
-
end System.OS_Interface;
diff --git a/gcc/ada/s-osinte-irix.ads b/gcc/ada/s-osinte-irix.ads
index 5432656208f..7231c39e9eb 100644
--- a/gcc/ada/s-osinte-irix.ads
+++ b/gcc/ada/s-osinte-irix.ads
@@ -201,14 +201,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -493,12 +485,6 @@ private
CLOCK_SGI_CYCLE : constant clockid_t := 2;
CLOCK_SGI_FAST : constant clockid_t := 3;
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type array_type_9 is array (Integer range 0 .. 4) of long;
type pthread_attr_t is record
X_X_D : array_type_9;
diff --git a/gcc/ada/s-osinte-kfreebsd-gnu.ads b/gcc/ada/s-osinte-kfreebsd-gnu.ads
index e85af994422..958d4217de4 100644
--- a/gcc/ada/s-osinte-kfreebsd-gnu.ads
+++ b/gcc/ada/s-osinte-kfreebsd-gnu.ads
@@ -208,19 +208,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
- function gettimeofday
- (tv : access struct_timeval;
- tz : System.Address := System.Null_Address) return int;
- pragma Import (C, gettimeofday, "gettimeofday");
-
function sysconf (name : int) return long;
pragma Import (C, sysconf);
@@ -511,12 +498,6 @@ private
end record;
pragma Convention (C, timespec);
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type pthread_attr_t is record
detachstate : int;
schedpolicy : int;
diff --git a/gcc/ada/s-osinte-linux.ads b/gcc/ada/s-osinte-linux.ads
index 2a620c5504a..323fc158f05 100644
--- a/gcc/ada/s-osinte-linux.ads
+++ b/gcc/ada/s-osinte-linux.ads
@@ -518,12 +518,6 @@ private
end record;
pragma Convention (C, timespec);
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type pthread_attr_t is record
detachstate : int;
schedpolicy : int;
diff --git a/gcc/ada/s-osinte-rtems.adb b/gcc/ada/s-osinte-rtems.adb
index ab98de558fd..d8e57f692d4 100644
--- a/gcc/ada/s-osinte-rtems.adb
+++ b/gcc/ada/s-osinte-rtems.adb
@@ -89,35 +89,19 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- function To_Duration (TV : struct_timeval) return Duration is
- begin
- return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
- end To_Duration;
-
- function To_Timeval (D : Duration) return struct_timeval is
- S : int;
- F : Duration;
- begin
- S := int (Long_Long_Integer (D));
- F := D - Duration (S);
-
- -- If F has negative value due to a round-up, adjust for positive F
- -- value.
- if F < 0.0 then
- S := S - 1;
- F := F + 1.0;
- end if;
- return
- struct_timeval'
- (tv_sec => S,
- tv_usec => int (Long_Long_Integer (F * 10#1#E6)));
- end To_Timeval;
+ ------------------
+ -- pthread_init --
+ ------------------
procedure pthread_init is
begin
null;
end pthread_init;
+ --------------------
+ -- Get_Stack_Base --
+ --------------------
+
function Get_Stack_Base (thread : pthread_t) return Address is
pragma Warnings (Off, thread);
@@ -125,6 +109,10 @@ package body System.OS_Interface is
return Null_Address;
end Get_Stack_Base;
+ -----------------
+ -- sigaltstack --
+ -----------------
+
function sigaltstack
(ss : not null access stack_t;
oss : access stack_t) return int is
diff --git a/gcc/ada/s-osinte-rtems.ads b/gcc/ada/s-osinte-rtems.ads
index 70e4a27e0a4..eb8b17d5f5c 100644
--- a/gcc/ada/s-osinte-rtems.ads
+++ b/gcc/ada/s-osinte-rtems.ads
@@ -191,14 +191,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -595,12 +587,6 @@ private
type clockid_t is new rtems_id;
CLOCK_REALTIME : constant clockid_t := 1;
- type struct_timeval is record
- tv_sec : int;
- tv_usec : int;
- end record;
- pragma Convention (C, struct_timeval);
-
type pthread_attr_t is record
is_initialized : int;
stackaddr : System.Address;
diff --git a/gcc/ada/s-osinte-solaris-posix.ads b/gcc/ada/s-osinte-solaris-posix.ads
index ae318060ccd..c5885e72a9a 100644
--- a/gcc/ada/s-osinte-solaris-posix.ads
+++ b/gcc/ada/s-osinte-solaris-posix.ads
@@ -204,14 +204,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------------------
-- Priority Scheduling --
-------------------------
@@ -524,12 +516,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
- type struct_timeval is record
- tv_sec : time_t;
- tv_usec : time_t;
- end record;
- pragma Convention (C, struct_timeval);
-
type pthread_attr_t is record
pthread_attrp : System.Address;
end record;
diff --git a/gcc/ada/s-osinte-solaris.adb b/gcc/ada/s-osinte-solaris.adb
index b9997bfa753..3f40bc677d3 100644
--- a/gcc/ada/s-osinte-solaris.adb
+++ b/gcc/ada/s-osinte-solaris.adb
@@ -77,40 +77,6 @@ package body System.OS_Interface is
tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
end To_Timespec;
- -----------------
- -- To_Duration --
- -----------------
-
- function To_Duration (TV : struct_timeval) return Duration is
- begin
- return Duration (TV.tv_sec) + Duration (TV.tv_usec) / 10#1#E6;
- end To_Duration;
-
- ----------------
- -- To_Timeval --
- ----------------
-
- function To_Timeval (D : Duration) return struct_timeval is
- S : long;
- F : Duration;
-
- begin
- S := long (Long_Long_Integer (D));
- F := D - Duration (S);
-
- -- If F has negative value due to a round-up, adjust for positive F
-
- if F < 0.0 then
- S := S - 1;
- F := F + 1.0;
- end if;
-
- return
- struct_timeval'
- (tv_sec => S,
- tv_usec => long (Long_Long_Integer (F * 10#1#E6)));
- end To_Timeval;
-
------------------
-- pthread_init --
------------------
diff --git a/gcc/ada/s-osinte-solaris.ads b/gcc/ada/s-osinte-solaris.ads
index a937f6ea36a..0728b18ef8e 100644
--- a/gcc/ada/s-osinte-solaris.ads
+++ b/gcc/ada/s-osinte-solaris.ads
@@ -263,16 +263,6 @@ package System.OS_Interface is
function To_Timespec (D : Duration) return timespec;
pragma Inline (To_Timespec);
- type struct_timeval is private;
- -- This is needed on systems that do not have clock_gettime()
- -- but do have gettimeofday().
-
- function To_Duration (TV : struct_timeval) return Duration;
- pragma Inline (To_Duration);
-
- function To_Timeval (D : Duration) return struct_timeval;
- pragma Inline (To_Timeval);
-
-------------
-- Process --
-------------
@@ -528,12 +518,6 @@ private
type clockid_t is new int;
CLOCK_REALTIME : constant clockid_t := 0;
- type struct_timeval is record
- tv_sec : long;
- tv_usec : long;
- end record;
- pragma Convention (C, struct_timeval);
-
type array_type_9 is array (0 .. 3) of unsigned_char;
type record_type_3 is record
flag : array_type_9;
diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md
index 232787974a0..6a1c43ae5bf 100644
--- a/gcc/config/alpha/alpha.md
+++ b/gcc/config/alpha/alpha.md
@@ -4197,7 +4197,7 @@
(match_dup 4)))]
{
if (can_create_pseudo_p ())
- operands[5] = gen_reg_rtx (DImode);
+ operands[5] = gen_reg_rtx (SImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
operands[5] = operands[0];
})
@@ -4223,9 +4223,9 @@
(match_dup 4))))]
{
if (can_create_pseudo_p ())
- operands[5] = gen_reg_rtx (DImode);
+ operands[5] = gen_reg_rtx (SImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
- operands[5] = operands[0];
+ operands[5] = gen_lowpart (SImode, operands[0]);
})
(define_insn_and_split "*cmp_ssub_di"
@@ -4273,7 +4273,7 @@
(match_dup 4)))]
{
if (can_create_pseudo_p ())
- operands[5] = gen_reg_rtx (DImode);
+ operands[5] = gen_reg_rtx (SImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
operands[5] = operands[0];
})
@@ -4299,9 +4299,9 @@
(match_dup 4))))]
{
if (can_create_pseudo_p ())
- operands[5] = gen_reg_rtx (DImode);
+ operands[5] = gen_reg_rtx (SImode);
else if (reg_overlap_mentioned_p (operands[5], operands[4]))
- operands[5] = operands[0];
+ operands[5] = gen_lowpart (SImode, operands[0]);
})
;; Here are the CALL and unconditional branch insns. Calls on NT and OSF
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 3a9474535ea..289f27a5226 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -12831,6 +12831,20 @@ arm_compute_save_reg0_reg12_mask (void)
&& crtl->uses_pic_offset_table)
save_reg_mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
}
+ else if (IS_VOLATILE(func_type))
+ {
+ /* For noreturn functions we historically omitted register saves
+ altogether. However this really messes up debugging. As a
+ compromise save just the fame pointers. Combined with the link
+ register saved elsewhere this should be sufficient to get
+ a backtrace. */
+ if (frame_pointer_needed)
+ save_reg_mask |= 1 << HARD_FRAME_POINTER_REGNUM;
+ if (df_regs_ever_live_p (ARM_HARD_FRAME_POINTER_REGNUM))
+ save_reg_mask |= 1 << ARM_HARD_FRAME_POINTER_REGNUM;
+ if (df_regs_ever_live_p (THUMB_HARD_FRAME_POINTER_REGNUM))
+ save_reg_mask |= 1 << THUMB_HARD_FRAME_POINTER_REGNUM;
+ }
else
{
/* In the normal case we only need to save those registers
@@ -12917,11 +12931,6 @@ arm_compute_save_reg_mask (void)
| (1 << LR_REGNUM)
| (1 << PC_REGNUM);
- /* Volatile functions do not return, so there
- is no need to save any other registers. */
- if (IS_VOLATILE (func_type))
- return save_reg_mask;
-
save_reg_mask |= arm_compute_save_reg0_reg12_mask ();
/* Decide if we need to save the link register.
diff --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h
index 58da13168de..d36b269c211 100644
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@ -47,6 +47,8 @@ extern bool x86_extended_QIreg_mentioned_p (rtx);
extern bool x86_extended_reg_mentioned_p (rtx);
extern enum machine_mode ix86_cc_mode (enum rtx_code, rtx, rtx);
+extern int avx_vpermilp_parallel (rtx par, enum machine_mode mode);
+
extern int ix86_expand_movmem (rtx, rtx, rtx, rtx, rtx, rtx);
extern int ix86_expand_setmem (rtx, rtx, rtx, rtx, rtx, rtx);
extern int ix86_expand_strlen (rtx, rtx, rtx, rtx);
@@ -275,3 +277,4 @@ extern int asm_preferred_eh_data_format (int, int);
#ifdef HAVE_ATTR_cpu
extern enum attr_cpu ix86_schedule;
#endif
+
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index b85ef632c3a..4310e49cfbc 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1808,7 +1808,7 @@ static rtx (*ix86_gen_leave) (void);
static rtx (*ix86_gen_pop1) (rtx);
static rtx (*ix86_gen_add3) (rtx, rtx, rtx);
static rtx (*ix86_gen_sub3) (rtx, rtx, rtx);
-static rtx (*ix86_gen_sub3_carry) (rtx, rtx, rtx, rtx);
+static rtx (*ix86_gen_sub3_carry) (rtx, rtx, rtx, rtx, rtx);
static rtx (*ix86_gen_one_cmpl2) (rtx, rtx);
static rtx (*ix86_gen_monitor) (rtx, rtx, rtx);
static rtx (*ix86_gen_andsp) (rtx, rtx, rtx);
@@ -15404,15 +15404,20 @@ ix86_expand_int_movcc (rtx operands[])
if (!sign_bit_compare_p)
{
+ rtx flags;
+ rtx (*insn)(rtx, rtx, rtx);
bool fpcmp = false;
compare_code = GET_CODE (compare_op);
- if (GET_MODE (XEXP (compare_op, 0)) == CCFPmode
- || GET_MODE (XEXP (compare_op, 0)) == CCFPUmode)
+ flags = XEXP (compare_op, 0);
+
+ if (GET_MODE (flags) == CCFPmode
+ || GET_MODE (flags) == CCFPUmode)
{
fpcmp = true;
- compare_code = ix86_fp_compare_code_to_integer (compare_code);
+ compare_code
+ = ix86_fp_compare_code_to_integer (compare_code);
}
/* To simplify rest of code, restrict to the GEU case. */
@@ -15431,7 +15436,8 @@ ix86_expand_int_movcc (rtx operands[])
reverse_condition_maybe_unordered
(GET_CODE (compare_op)));
else
- PUT_CODE (compare_op, reverse_condition (GET_CODE (compare_op)));
+ PUT_CODE (compare_op,
+ reverse_condition (GET_CODE (compare_op)));
}
diff = ct - cf;
@@ -15440,10 +15446,11 @@ ix86_expand_int_movcc (rtx operands[])
tmp = gen_reg_rtx (mode);
if (mode == DImode)
- emit_insn (gen_x86_movdicc_0_m1 (tmp, compare_op));
+ insn = gen_x86_movdicc_0_m1;
else
- emit_insn (gen_x86_movsicc_0_m1 (gen_lowpart (SImode, tmp),
- compare_op));
+ insn = gen_x86_movsicc_0_m1;
+
+ emit_insn (insn (tmp, flags, compare_op));
}
else
{
@@ -16377,11 +16384,12 @@ int
ix86_expand_int_addcc (rtx operands[])
{
enum rtx_code code = GET_CODE (operands[1]);
- rtx (*insn)(rtx, rtx, rtx, rtx);
+ rtx flags;
+ rtx (*insn)(rtx, rtx, rtx, rtx, rtx);
rtx compare_op;
rtx val = const0_rtx;
bool fpcmp = false;
- enum machine_mode mode = GET_MODE (operands[0]);
+ enum machine_mode mode;
ix86_compare_op0 = XEXP (operands[1], 0);
ix86_compare_op1 = XEXP (operands[1], 1);
@@ -16393,8 +16401,10 @@ ix86_expand_int_addcc (rtx operands[])
return 0;
code = GET_CODE (compare_op);
- if (GET_MODE (XEXP (compare_op, 0)) == CCFPmode
- || GET_MODE (XEXP (compare_op, 0)) == CCFPUmode)
+ flags = XEXP (compare_op, 0);
+
+ if (GET_MODE (flags) == CCFPmode
+ || GET_MODE (flags) == CCFPUmode)
{
fpcmp = true;
code = ix86_fp_compare_code_to_integer (code);
@@ -16410,12 +16420,13 @@ ix86_expand_int_addcc (rtx operands[])
else
PUT_CODE (compare_op, reverse_condition (GET_CODE (compare_op)));
}
- PUT_MODE (compare_op, mode);
+
+ mode = GET_MODE (operands[0]);
/* Construct either adc or sbb insn. */
if ((code == LTU) == (operands[3] == constm1_rtx))
{
- switch (GET_MODE (operands[0]))
+ switch (mode)
{
case QImode:
insn = gen_subqi3_carry;
@@ -16435,7 +16446,7 @@ ix86_expand_int_addcc (rtx operands[])
}
else
{
- switch (GET_MODE (operands[0]))
+ switch (mode)
{
case QImode:
insn = gen_addqi3_carry;
@@ -16453,7 +16464,7 @@ ix86_expand_int_addcc (rtx operands[])
gcc_unreachable ();
}
}
- emit_insn (insn (operands[0], operands[2], val, compare_op));
+ emit_insn (insn (operands[0], operands[2], val, flags, compare_op));
return 1; /* DONE */
}
@@ -18986,7 +18997,6 @@ ix86_expand_strlensi_unroll_1 (rtx out, rtx src, rtx align_rtx)
gen_rtx_IF_THEN_ELSE (Pmode, tmp,
reg2,
out)));
-
}
else
{
@@ -19013,8 +19023,9 @@ ix86_expand_strlensi_unroll_1 (rtx out, rtx src, rtx align_rtx)
/* Avoid branch in fixing the byte. */
tmpreg = gen_lowpart (QImode, tmpreg);
emit_insn (gen_addqi3_cc (tmpreg, tmpreg, tmpreg));
- cmp = gen_rtx_LTU (Pmode, gen_rtx_REG (CCmode, FLAGS_REG), const0_rtx);
- emit_insn ((*ix86_gen_sub3_carry) (out, out, GEN_INT (3), cmp));
+ tmp = gen_rtx_REG (CCmode, FLAGS_REG);
+ cmp = gen_rtx_LTU (VOIDmode, tmp, const0_rtx);
+ emit_insn ((*ix86_gen_sub3_carry) (out, out, GEN_INT (3), tmp, cmp));
emit_label (end_0_label);
}
@@ -24527,6 +24538,82 @@ ix86_builtin_reciprocal (unsigned int fn, bool md_fn,
return NULL_TREE;
}
}
+
+/* Helper for avx_vpermilps256_operand et al. This is also used by
+ the expansion functions to turn the parallel back into a mask.
+ The return value is 0 for no match and the imm8+1 for a match. */
+
+int
+avx_vpermilp_parallel (rtx par, enum machine_mode mode)
+{
+ unsigned i, nelt = GET_MODE_NUNITS (mode);
+ unsigned mask = 0;
+ unsigned char ipar[8];
+
+ if (XVECLEN (par, 0) != (int) nelt)
+ return 0;
+
+ /* Validate that all of the elements are constants, and not totally
+ out of range. Copy the data into an integral array to make the
+ subsequent checks easier. */
+ for (i = 0; i < nelt; ++i)
+ {
+ rtx er = XVECEXP (par, 0, i);
+ unsigned HOST_WIDE_INT ei;
+
+ if (!CONST_INT_P (er))
+ return 0;
+ ei = INTVAL (er);
+ if (ei >= nelt)
+ return 0;
+ ipar[i] = ei;
+ }
+
+ switch (mode)
+ {
+ case V4DFmode:
+ /* In the 256-bit DFmode case, we can only move elements within
+ a 128-bit lane. */
+ for (i = 0; i < 2; ++i)
+ {
+ if (ipar[i] >= 2)
+ return 0;
+ mask |= ipar[i] << i;
+ }
+ for (i = 2; i < 4; ++i)
+ {
+ if (ipar[i] < 2)
+ return 0;
+ mask |= (ipar[i] - 2) << i;
+ }
+ break;
+
+ case V8SFmode:
+ /* In the 256-bit SFmode case, we have full freedom of movement
+ within the low 128-bit lane, but the high 128-bit lane must
+ mirror the exact same pattern. */
+ for (i = 0; i < 4; ++i)
+ if (ipar[i] + 4 != ipar[i + 4])
+ return 0;
+ nelt = 4;
+ /* FALLTHRU */
+
+ case V2DFmode:
+ case V4SFmode:
+ /* In the 128-bit case, we've full freedom in the placement of
+ the elements from the source operand. */
+ for (i = 0; i < nelt; ++i)
+ mask |= ipar[i] << (i * (nelt / 2));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ /* Make sure success has a non-zero value by adding one. */
+ return mask + 1;
+}
+
/* Store OPERAND to the memory after reload is completed. This means
that we can't easily use assign_stack_local. */
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 8ed381fd6c6..d31d6a27f3f 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -5915,10 +5915,24 @@
(clobber (reg:CC FLAGS_REG))])]
"split_<dwi> (&operands[0], 3, &operands[0], &operands[3]);")
-(define_insn "add<mode>3_carry"
+(define_expand "add<mode>3_carry"
+ [(parallel
+ [(set (match_operand:SWI 0 "nonimmediate_operand" "")
+ (plus:SWI
+ (plus:SWI (match_operator:SWI 4 "ix86_carry_flag_operator"
+ [(match_operand 3 "flags_reg_operand" "")
+ (const_int 0)])
+ (match_operand:SWI 1 "nonimmediate_operand" ""))
+ (match_operand:SWI 2 "<general_operand>" "")))
+ (clobber (reg:CC FLAGS_REG))])]
+ "ix86_binary_operator_ok (PLUS, <MODE>mode, operands)"
+ "")
+
+(define_insn "*add<mode>3_carry"
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>")
(plus:SWI
- (plus:SWI (match_operand:SWI 3 "ix86_carry_flag_operator" "")
+ (plus:SWI (match_operator 3 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
(match_operand:SWI 1 "nonimmediate_operand" "%0,0"))
(match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m")))
(clobber (reg:CC FLAGS_REG))]
@@ -5933,7 +5947,8 @@
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
(plus:SI
- (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
+ (plus:SI (match_operator 3 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
(match_operand:SI 1 "nonimmediate_operand" "%0"))
(match_operand:SI 2 "general_operand" "g"))))
(clobber (reg:CC FLAGS_REG))]
@@ -7440,12 +7455,27 @@
(clobber (reg:CC FLAGS_REG))])]
"split_<dwi> (&operands[0], 3, &operands[0], &operands[3]);")
-(define_insn "sub<mode>3_carry"
+(define_expand "sub<mode>3_carry"
+ [(parallel
+ [(set (match_operand:SWI 0 "nonimmediate_operand" "")
+ (minus:SWI
+ (match_operand:SWI 1 "nonimmediate_operand" "")
+ (plus:SWI
+ (match_operator:SWI 4 "ix86_carry_flag_operator"
+ [(match_operand 3 "flags_reg_operand" "")
+ (const_int 0)])
+ (match_operand:SWI 2 "<general_operand>" ""))))
+ (clobber (reg:CC FLAGS_REG))])]
+ "ix86_binary_operator_ok (MINUS, <MODE>mode, operands)"
+ "")
+
+(define_insn "*sub<mode>3_carry"
[(set (match_operand:SWI 0 "nonimmediate_operand" "=<r>m,<r>")
(minus:SWI
(match_operand:SWI 1 "nonimmediate_operand" "0,0")
(plus:SWI
- (match_operand:SWI 3 "ix86_carry_flag_operator" "")
+ (match_operator 3 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
(match_operand:SWI 2 "<general_operand>" "<r><i>,<r>m"))))
(clobber (reg:CC FLAGS_REG))]
"ix86_binary_operator_ok (MINUS, <MODE>mode, operands)"
@@ -7459,7 +7489,8 @@
[(set (match_operand:DI 0 "register_operand" "=r")
(zero_extend:DI
(minus:SI (match_operand:SI 1 "register_operand" "0")
- (plus:SI (match_operand:SI 3 "ix86_carry_flag_operator" "")
+ (plus:SI (match_operator 3 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
(match_operand:SI 2 "general_operand" "g")))))
(clobber (reg:CC FLAGS_REG))]
"TARGET_64BIT && ix86_binary_operator_ok (MINUS, SImode, operands)"
@@ -19277,9 +19308,23 @@
;; the register first winds up with `sbbl $0,reg', which is also weird.
;; So just document what we're doing explicitly.
-(define_insn "x86_mov<mode>cc_0_m1"
+(define_expand "x86_mov<mode>cc_0_m1"
+ [(parallel
+ [(set (match_operand:SWI48 0 "register_operand" "")
+ (if_then_else:SWI48
+ (match_operator:SWI48 2 "ix86_carry_flag_operator"
+ [(match_operand 1 "flags_reg_operand" "")
+ (const_int 0)])
+ (const_int -1)
+ (const_int 0)))
+ (clobber (reg:CC FLAGS_REG))])]
+ ""
+ "")
+
+(define_insn "*x86_mov<mode>cc_0_m1"
[(set (match_operand:SWI48 0 "register_operand" "=r")
- (if_then_else:SWI48 (match_operand 1 "ix86_carry_flag_operator" "")
+ (if_then_else:SWI48 (match_operator 1 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
(const_int -1)
(const_int 0)))
(clobber (reg:CC FLAGS_REG))]
@@ -19297,7 +19342,8 @@
(define_insn "*x86_mov<mode>cc_0_m1_se"
[(set (match_operand:SWI48 0 "register_operand" "=r")
- (sign_extract:SWI48 (match_operand 1 "ix86_carry_flag_operator" "")
+ (sign_extract:SWI48 (match_operator 1 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])
(const_int 1)
(const_int 0)))
(clobber (reg:CC FLAGS_REG))]
@@ -19313,7 +19359,8 @@
(define_insn "*x86_mov<mode>cc_0_m1_neg"
[(set (match_operand:SWI48 0 "register_operand" "=r")
- (neg:SWI48 (match_operand 1 "ix86_carry_flag_operator" "")))]
+ (neg:SWI48 (match_operator 1 "ix86_carry_flag_operator"
+ [(reg FLAGS_REG) (const_int 0)])))]
""
"sbb{<imodesuffix>}\t%0, %0"
[(set_attr "type" "alu")
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 31a203758ed..74d2f9633d3 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -1056,11 +1056,6 @@
enum machine_mode inmode = GET_MODE (XEXP (op, 0));
enum rtx_code code = GET_CODE (op);
- if (!REG_P (XEXP (op, 0))
- || REGNO (XEXP (op, 0)) != FLAGS_REG
- || XEXP (op, 1) != const0_rtx)
- return 0;
-
if (inmode == CCFPmode || inmode == CCFPUmode)
{
if (!ix86_trivial_fp_comparison_operator (op, mode))
@@ -1148,3 +1143,24 @@
return 1;
})
+
+;; Return 1 if OP is a parallel for a vpermilp[ds] permute.
+;; ??? It would be much easier if the PARALLEL for a VEC_SELECT
+;; had a mode, but it doesn't. So we have 4 copies and install
+;; the mode by hand.
+
+(define_predicate "avx_vpermilp_v8sf_operand"
+ (and (match_code "parallel")
+ (match_test "avx_vpermilp_parallel (op, V8SFmode)")))
+
+(define_predicate "avx_vpermilp_v4df_operand"
+ (and (match_code "parallel")
+ (match_test "avx_vpermilp_parallel (op, V4DFmode)")))
+
+(define_predicate "avx_vpermilp_v4sf_operand"
+ (and (match_code "parallel")
+ (match_test "avx_vpermilp_parallel (op, V4SFmode)")))
+
+(define_predicate "avx_vpermilp_v2df_operand"
+ (and (match_code "parallel")
+ (match_test "avx_vpermilp_parallel (op, V2DFmode)")))
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index 71447993c2d..79adc77a628 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -58,6 +58,8 @@
(define_mode_iterator AVX256MODE8P [V8SI V8SF])
(define_mode_iterator AVXMODEF2P [V4SF V2DF V8SF V4DF])
(define_mode_iterator AVXMODEF4P [V4SF V4DF])
+(define_mode_iterator AVXMODEFDP [V2DF V4DF])
+(define_mode_iterator AVXMODEFSP [V4SF V8SF])
(define_mode_iterator AVXMODEDCVTDQ2PS [V4SF V8SF])
(define_mode_iterator AVXMODEDCVTPS2DQ [V4SI V8SI])
@@ -95,13 +97,16 @@
(V4SI "SI") (V2DI "DI")])
;; Mapping of vector modes to a vector mode of double size
-(define_mode_attr ssedoublesizemode [(V2DF "V4DF") (V2DI "V4DI")
- (V4SF "V8SF") (V4SI "V8SI")])
+(define_mode_attr ssedoublesizemode
+ [(V2DF "V4DF") (V2DI "V4DI") (V4SF "V8SF") (V4SI "V8SI")
+ (V8HI "V16HI") (V16QI "V32QI")
+ (V4DF "V8DF") (V8SF "V16SF")
+ (V4DI "V8DI") (V8SI "V16SI") (V16HI "V32HI") (V32QI "V64QI")])
;; Number of scalar elements in each vector type
-(define_mode_attr ssescalarnum [(V4SF "4") (V2DF "2")
- (V16QI "16") (V8HI "8")
- (V4SI "4") (V2DI "2")])
+(define_mode_attr ssescalarnum
+ [(V4SF "4") (V2DF "2") (V16QI "16") (V8HI "8") (V4SI "4") (V2DI "2")
+ (V8SF "8") (V4DF "4") (V32QI "32") (V16HI "16") (V8SI "8") (V4DI "4")])
;; Mapping for AVX
(define_mode_attr avxvecmode
@@ -134,10 +139,6 @@
(define_mode_attr blendbits
[(V8SF "255") (V4SF "15") (V4DF "15") (V2DF "3")])
-;; Mapping of immediate bits for vpermil instructions
-(define_mode_attr vpermilbits
- [(V8SF "255") (V4SF "255") (V4DF "15") (V2DF "3")])
-
;; Mapping of immediate bits for pinsr instructions
(define_mode_attr pinsrbits [(V16QI "32768") (V8HI "128") (V4SI "8")])
@@ -12088,14 +12089,66 @@
(set_attr "prefix" "vex")
(set_attr "mode" "OI")])
-(define_insn "avx_vpermil<mode>"
+(define_expand "avx_vpermil<mode>"
+ [(set (match_operand:AVXMODEFDP 0 "register_operand" "")
+ (vec_select:AVXMODEFDP
+ (match_operand:AVXMODEFDP 1 "nonimmediate_operand" "")
+ (match_operand:SI 2 "const_0_to_255_operand" "")))]
+ "TARGET_AVX"
+{
+ int mask = INTVAL (operands[2]);
+ rtx perm[<ssescalarnum>];
+
+ perm[0] = GEN_INT (mask & 1);
+ perm[1] = GEN_INT ((mask >> 1) & 1);
+ if (<MODE>mode == V4DFmode)
+ {
+ perm[2] = GEN_INT (((mask >> 2) & 1) + 2);
+ perm[3] = GEN_INT (((mask >> 3) & 1) + 2);
+ }
+
+ operands[2]
+ = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
+})
+
+(define_expand "avx_vpermil<mode>"
+ [(set (match_operand:AVXMODEFSP 0 "register_operand" "")
+ (vec_select:AVXMODEFSP
+ (match_operand:AVXMODEFSP 1 "nonimmediate_operand" "")
+ (match_operand:SI 2 "const_0_to_255_operand" "")))]
+ "TARGET_AVX"
+{
+ int mask = INTVAL (operands[2]);
+ rtx perm[<ssescalarnum>];
+
+ perm[0] = GEN_INT (mask & 3);
+ perm[1] = GEN_INT ((mask >> 2) & 3);
+ perm[2] = GEN_INT ((mask >> 4) & 3);
+ perm[3] = GEN_INT ((mask >> 6) & 3);
+ if (<MODE>mode == V8SFmode)
+ {
+ perm[4] = GEN_INT ((mask & 3) + 4);
+ perm[5] = GEN_INT (((mask >> 2) & 3) + 4);
+ perm[6] = GEN_INT (((mask >> 4) & 3) + 4);
+ perm[7] = GEN_INT (((mask >> 6) & 3) + 4);
+ }
+
+ operands[2]
+ = gen_rtx_PARALLEL (VOIDmode, gen_rtvec_v (<ssescalarnum>, perm));
+})
+
+(define_insn "*avx_vpermilp<mode>"
[(set (match_operand:AVXMODEF2P 0 "register_operand" "=x")
- (unspec:AVXMODEF2P
- [(match_operand:AVXMODEF2P 1 "register_operand" "xm")
- (match_operand:SI 2 "const_0_to_<vpermilbits>_operand" "n")]
- UNSPEC_VPERMIL))]
+ (vec_select:AVXMODEF2P
+ (match_operand:AVXMODEF2P 1 "nonimmediate_operand" "xm")
+ (match_parallel 2 "avx_vpermilp_<mode>_operand"
+ [(match_operand 3 "const_int_operand" "")])))]
"TARGET_AVX"
- "vpermilp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}"
+{
+ int mask = avx_vpermilp_parallel (operands[2], <MODE>mode) - 1;
+ operands[2] = GEN_INT (mask);
+ return "vpermilp<avxmodesuffixf2c>\t{%2, %1, %0|%0, %1, %2}";
+}
[(set_attr "type" "sselog")
(set_attr "prefix_extra" "1")
(set_attr "length_immediate" "1")
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h
index 716b7acad82..e4fbb32b959 100644
--- a/gcc/config/mips/mips-protos.h
+++ b/gcc/config/mips/mips-protos.h
@@ -346,4 +346,9 @@ extern void mips_final_prescan_insn (rtx, rtx *, int);
extern int mips_trampoline_code_size (void);
extern void mips_function_profiler (FILE *);
+typedef rtx (*mulsidi3_gen_fn) (rtx, rtx, rtx);
+#ifdef RTX_CODE
+extern mulsidi3_gen_fn mips_mulsidi3_gen_fn (enum rtx_code);
+#endif
+
#endif /* ! GCC_MIPS_PROTOS_H */
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index c8c1dca25ce..eeff72d4b33 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -15982,6 +15982,39 @@ mips_final_postscan_insn (FILE *file ATTRIBUTE_UNUSED, rtx insn,
if (mips_need_noat_wrapper_p (insn, opvec, noperands))
mips_pop_asm_switch (&mips_noat);
}
+
+/* Return the function that is used to expand the <u>mulsidi3 pattern.
+ EXT_CODE is the code of the extension used. Return NULL if widening
+ multiplication shouldn't be used. */
+
+mulsidi3_gen_fn
+mips_mulsidi3_gen_fn (enum rtx_code ext_code)
+{
+ bool signed_p;
+
+ signed_p = ext_code == SIGN_EXTEND;
+ if (TARGET_64BIT)
+ {
+ /* Don't use widening multiplication with MULT when we have DMUL. Even
+ with the extension of its input operands DMUL is faster. Note that
+ the extension is not needed for signed multiplication. In order to
+ ensure that we always remove the redundant sign-extension in this
+ case we still expand mulsidi3 for DMUL. */
+ if (ISA_HAS_DMUL3)
+ return signed_p ? gen_mulsidi3_64bit_dmul : NULL;
+ if (TARGET_FIX_R4000)
+ return NULL;
+ return signed_p ? gen_mulsidi3_64bit : gen_umulsidi3_64bit;
+ }
+ else
+ {
+ if (TARGET_FIX_R4000)
+ return signed_p ? gen_mulsidi3_32bit_r4000 : gen_umulsidi3_32bit_r4000;
+ if (ISA_HAS_DSPR2)
+ return signed_p ? gen_mips_mult : gen_mips_multu;
+ return signed_p ? gen_mulsidi3_32bit : gen_umulsidi3_32bit;
+ }
+}
/* Return the size in bytes of the trampoline code, padded to
TRAMPOLINE_ALIGNMENT bits. The static chain pointer and target
diff --git a/gcc/config/mips/mips.md b/gcc/config/mips/mips.md
index 76fc37bd479..2179b8a46c6 100644
--- a/gcc/config/mips/mips.md
+++ b/gcc/config/mips/mips.md
@@ -1847,15 +1847,10 @@
[(set (match_operand:DI 0 "register_operand")
(mult:DI (any_extend:DI (match_operand:SI 1 "register_operand"))
(any_extend:DI (match_operand:SI 2 "register_operand"))))]
- "!TARGET_64BIT || !TARGET_FIX_R4000"
+ "mips_mulsidi3_gen_fn (<CODE>) != NULL"
{
- if (TARGET_64BIT)
- emit_insn (gen_<u>mulsidi3_64bit (operands[0], operands[1], operands[2]));
- else if (TARGET_FIX_R4000)
- emit_insn (gen_<u>mulsidi3_32bit_r4000 (operands[0], operands[1],
- operands[2]));
- else
- emit_insn (gen_<u>mulsidi3_32bit (operands[0], operands[1], operands[2]));
+ mulsidi3_gen_fn fn = mips_mulsidi3_gen_fn (<CODE>);
+ emit_insn (fn (operands[0], operands[1], operands[2]));
DONE;
})
@@ -1885,7 +1880,7 @@
(any_extend:DI (match_operand:SI 2 "register_operand" "d"))))
(clobber (match_scratch:TI 3 "=x"))
(clobber (match_scratch:DI 4 "=d"))]
- "TARGET_64BIT && !TARGET_FIX_R4000"
+ "TARGET_64BIT && !TARGET_FIX_R4000 && !ISA_HAS_DMUL3"
"#"
[(set_attr "type" "imul")
(set_attr "mode" "SI")
@@ -1961,6 +1956,17 @@
[(set_attr "type" "imul")
(set_attr "mode" "SI")])
+;; See comment before the ISA_HAS_DMUL3 case in mips_mulsidi3_gen_fn.
+(define_insn "mulsidi3_64bit_dmul"
+ [(set (match_operand:DI 0 "register_operand" "=d")
+ (mult:DI (sign_extend:DI (match_operand:SI 1 "register_operand" "d"))
+ (sign_extend:DI (match_operand:SI 2 "register_operand" "d"))))
+ (clobber (match_scratch:DI 3 "=l"))]
+ "TARGET_64BIT && ISA_HAS_DMUL3"
+ "dmul\t%0,%1,%2"
+ [(set_attr "type" "imul3")
+ (set_attr "mode" "DI")])
+
;; Widening multiply with negation.
(define_insn "*muls<u>_di"
[(set (match_operand:DI 0 "register_operand" "=x")
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 7fa634777b3..4318c702b42 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -591,7 +591,7 @@
(define_insn ""
[(set (reg:SI T_REG)
(eq:SI (and:SI (match_operand:SI 0 "arith_reg_operand" "z,r")
- (match_operand:SI 1 "arith_operand" "K08,r"))
+ (match_operand:SI 1 "logical_operand" "K08,r"))
(const_int 0)))]
"TARGET_SH1"
"tst %1,%0"
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b9f1cbebbfb..b40ddb60f63 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,48 @@
+2009-11-23 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/42095
+ * tree.c: Include cgraph.h.
+ (cp_fix_function_decl_p): Don't return true for same_body aliases.
+ * Make-lang.in (cp/tree.o): Depend on $(CGRAPH_H).
+
+2009-11-23 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/14777
+ * cp-tree.def <TEMPLATE_INFO>: Declare new kind of tree
+ node.
+ * cp-tree.h (struct tree_template_info,
+ struct qualified_typedef_usage_s): New.
+ (cp_tree_node_structure_enum): add TS_CP_TEMPLATE_INFO.
+ (union lang_tree_node): Add template_info.
+ (TI_TEMPLATE, TI_ARGS, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING):
+ Adjust.
+ (build_template_info): Declare.
+ (get_types_needing_access_check): Adjust return type.
+ (add_typedef_to_current_template_for_access_check): Declare.
+ * cp-objcp-common.c (cp_tree_size): Handle TEMPLATE_INFO.
+ * semantics.c (add_typedef_to_current_template_for_access_check):
+ Split from ...
+ (check_accessibility_of_qualified_id): ... here.
+ * decl.c (make_typename_type): Use it.
+ * pt.c (build_template_info): Define.
+ (check_explicit_specialization, find_parameter_packs_r,
+ push_template_decl_real, lookup_template_class,
+ for_each_template_parm_r, tsubst_decl, tsubst): Use
+ build_template_info.
+ (get_types_needing_access_check): Adjust return type.
+ (append_type_to_template_for_access_check_1): Record the
+ location of the usage point of the typedef. Adjust to TEMPLATE_INFO.
+ (append_type_to_template_for_access_check): Add new location
+ parameter. Pass it to append_type_to_template_for_access_check_1.
+ Adjust to TEMPLATE_INFO.
+ (perform_typedefs_access_check): Temporarily set input_location to
+ the usage point of the typedef we are checking access for. Adjust
+ to new TEMPLATE_INFO tree node.
+ * tree.c (bind_template_template_parm): Use build_template_info.
+ * call.c (add_template_candidate_real): Likewise.
+ * decl.c (grokfndecl): Likewise.
+ (cp_tree_node_structure): Handle TEMPLATE_INFO.
+
2009-11-20 Jason Merrill <jason@redhat.com>
PR c++/9050, DR 147, DR 318
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index f5c652ec552..6e102960da0 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -281,7 +281,7 @@ cp/cvt.o: cp/cvt.c $(CXX_TREE_H) $(TM_H) cp/decl.h $(FLAGS_H) toplev.h \
cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H)
cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \
insn-config.h $(INTEGRATE_H) $(TREE_INLINE_H) $(REAL_H) gt-cp-tree.h \
- $(TARGET_H) debug.h $(TREE_FLOW_H)
+ $(TARGET_H) debug.h $(TREE_FLOW_H) $(CGRAPH_H)
cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h convert.h \
$(TARGET_H) $(C_PRAGMA_H) gt-cp-rtti.h
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index b4c8176c626..70a5b1efbf5 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -2581,7 +2581,7 @@ add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
for this will point at template <class T> template <> S<T>::f(int),
so that we can find the definition. For the purposes of
overload resolution, however, we want the original TMPL. */
- cand->template_decl = tree_cons (tmpl, targs, NULL_TREE);
+ cand->template_decl = build_template_info (tmpl, targs);
else
cand->template_decl = DECL_TEMPLATE_INFO (fn);
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index da6f8291ba4..f06ad5b86c8 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -140,6 +140,8 @@ cp_tree_size (enum tree_code code)
case LAMBDA_EXPR: return sizeof (struct tree_lambda_expr);
+ case TEMPLATE_INFO: return sizeof (struct tree_template_info);
+
default:
gcc_unreachable ();
}
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index 28ecc5bf681..c71f94caa61 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -439,6 +439,16 @@ DEFTREECODE (LAMBDA_EXPR, "lambda_expr", tcc_exceptional, 0)
DECLTYPE_FOR_LAMBDA_RETURN is set if we want lambda return deduction. */
DEFTREECODE (DECLTYPE_TYPE, "decltype_type", tcc_type, 0)
+/* Used to represent the template information stored by template
+ specializations.
+ The accessors are:
+ TI_TEMPLATE the template declaration associated to the specialization
+ TI_ARGS the arguments of the template specialization
+ TI_TYPEDEFS_NEEDING_ACCESS_CHECKING the vector of typedefs used in
+ the pattern of the template for which access check is needed at template
+ instantiation time. */
+DEFTREECODE (TEMPLATE_INFO, "template_info", tcc_exceptional, 0)
+
/*
Local variables:
mode:c
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 88387705a1b..c6de2b488d9 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -633,6 +633,34 @@ struct GTY (()) tree_lambda_expr
int discriminator;
};
+/* A (typedef,context,usage location) triplet.
+ It represents a typedef used through a
+ context at a given source location.
+ e.g.
+ struct foo {
+ typedef int myint;
+ };
+
+ struct bar {
+ foo::myint v; // #1<-- this location.
+ };
+
+ In bar, the triplet will be (myint, foo, #1).
+ */
+struct GTY(()) qualified_typedef_usage_s {
+ tree typedef_decl;
+ tree context;
+ location_t locus;
+};
+typedef struct qualified_typedef_usage_s qualified_typedef_usage_t;
+DEF_VEC_O (qualified_typedef_usage_t);
+DEF_VEC_ALLOC_O (qualified_typedef_usage_t,gc);
+
+struct GTY(()) tree_template_info {
+ struct tree_common common;
+ VEC(qualified_typedef_usage_t,gc) *typedefs_needing_access_checking;
+};
+
enum cp_tree_node_structure_enum {
TS_CP_GENERIC,
TS_CP_IDENTIFIER,
@@ -647,6 +675,7 @@ enum cp_tree_node_structure_enum {
TS_CP_ARGUMENT_PACK_SELECT,
TS_CP_TRAIT_EXPR,
TS_CP_LAMBDA_EXPR,
+ TS_CP_TEMPLATE_INFO,
LAST_TS_CP_ENUM
};
@@ -669,6 +698,8 @@ union GTY((desc ("cp_tree_node_structure (&%h)"),
trait_expression;
struct tree_lambda_expr GTY ((tag ("TS_CP_LAMBDA_EXPR")))
lambda_expression;
+ struct tree_template_info GTY ((tag ("TS_CP_TEMPLATE_INFO")))
+ template_info;
};
@@ -2441,12 +2472,14 @@ extern void decl_shadowed_for_var_insert (tree, tree);
? (ENUM_TEMPLATE_INFO (NODE) = (VAL)) \
: (CLASSTYPE_TEMPLATE_INFO (NODE) = (VAL)))
-#define TI_TEMPLATE(NODE) (TREE_PURPOSE (NODE))
-#define TI_ARGS(NODE) (TREE_VALUE (NODE))
+#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
+#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
#define TI_PENDING_TEMPLATE_FLAG(NODE) TREE_LANG_FLAG_1 (NODE)
/* The list of typedefs - used in the template - that need
access checking at template instantiation time. */
-#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) (TREE_CHAIN (NODE))
+#define TI_TYPEDEFS_NEEDING_ACCESS_CHECKING(NODE) \
+ ((struct tree_template_info*)TEMPLATE_INFO_CHECK \
+ (NODE))->typedefs_needing_access_checking
/* We use TREE_VECs to hold template arguments. If there is only one
level of template arguments, then the TREE_VEC contains the
@@ -4809,7 +4842,8 @@ extern tree check_explicit_specialization (tree, tree, int, int);
extern tree make_auto (void);
extern tree do_auto_deduction (tree, tree, tree);
extern tree type_uses_auto (tree);
-extern void append_type_to_template_for_access_check (tree, tree, tree);
+extern void append_type_to_template_for_access_check (tree, tree, tree,
+ location_t);
extern tree splice_late_return_type (tree, tree);
extern bool is_auto (const_tree);
extern tree process_template_parm (tree, location_t, tree,
@@ -4843,8 +4877,9 @@ extern bool function_parameter_pack_p (const_tree);
extern bool function_parameter_expanded_from_pack_p (tree, tree);
extern tree make_pack_expansion (tree);
extern bool check_for_bare_parameter_packs (tree);
+extern tree build_template_info (tree, tree);
extern tree get_template_info (const_tree);
-extern tree get_types_needing_access_check (tree);
+extern VEC(qualified_typedef_usage_t,gc)* get_types_needing_access_check (tree);
extern int template_class_depth (tree);
extern int is_specialization_of (tree, tree);
extern bool is_specialization_of_friend (tree, tree);
@@ -5073,6 +5108,8 @@ extern void finish_mem_initializers (tree);
extern tree check_template_template_default_arg (tree);
extern bool expand_or_defer_fn_1 (tree);
extern void expand_or_defer_fn (tree);
+extern void add_typedef_to_current_template_for_access_check (tree, tree,
+ location_t);
extern void check_accessibility_of_qualified_id (tree, tree, tree);
extern tree finish_qualified_id_expr (tree, tree, bool, bool,
bool, bool);
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 7f5a688873b..db289b50197 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3089,6 +3089,11 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
if (complain & tf_error)
perform_or_defer_access_check (TYPE_BINFO (context), t, t);
+ /* If we are currently parsing a template and if T is a typedef accessed
+ through CONTEXT then we need to remember and check access of T at
+ template instantiation time. */
+ add_typedef_to_current_template_for_access_check (t, context, input_location);
+
if (want_template)
return lookup_template_class (t, TREE_OPERAND (fullname, 1),
NULL_TREE, context,
@@ -6713,7 +6718,7 @@ grokfndecl (tree ctype,
}
gcc_assert (TREE_CODE (fns) == IDENTIFIER_NODE
|| TREE_CODE (fns) == OVERLOAD);
- DECL_TEMPLATE_INFO (decl) = tree_cons (fns, args, NULL_TREE);
+ DECL_TEMPLATE_INFO (decl) = build_template_info (fns, args);
for (t = TYPE_ARG_TYPES (TREE_TYPE (decl)); t; t = TREE_CHAIN (t))
if (TREE_PURPOSE (t)
@@ -12881,6 +12886,7 @@ cp_tree_node_structure (union lang_tree_node * t)
case ARGUMENT_PACK_SELECT: return TS_CP_ARGUMENT_PACK_SELECT;
case TRAIT_EXPR: return TS_CP_TRAIT_EXPR;
case LAMBDA_EXPR: return TS_CP_LAMBDA_EXPR;
+ case TEMPLATE_INFO: return TS_CP_TEMPLATE_INFO;
default: return TS_CP_GENERIC;
}
}
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0a194440ae6..2e58ed9e757 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -189,7 +189,8 @@ static tree tsubst_copy (tree, tree, tsubst_flags_t, tree);
static tree tsubst_pack_expansion (tree, tree, tsubst_flags_t, tree);
static tree tsubst_decl (tree, tree, tsubst_flags_t);
static void perform_typedefs_access_check (tree tmpl, tree targs);
-static void append_type_to_template_for_access_check_1 (tree, tree, tree);
+static void append_type_to_template_for_access_check_1 (tree, tree, tree,
+ location_t);
static hashval_t iterative_hash_template_arg (tree arg, hashval_t val);
static tree listify (tree);
static tree listify_autos (tree, tree);
@@ -286,6 +287,17 @@ finish_member_template_decl (tree decl)
return error_mark_node;
}
+/* Create a template info node. */
+
+tree
+build_template_info (tree template_decl, tree template_args)
+{
+ tree result = make_node (TEMPLATE_INFO);
+ TI_TEMPLATE (result) = template_decl;
+ TI_ARGS (result) = template_args;
+ return result;
+}
+
/* Return the template info node corresponding to T, whatever T is. */
tree
@@ -2492,7 +2504,7 @@ check_explicit_specialization (tree declarator,
}
/* Set up the DECL_TEMPLATE_INFO for DECL. */
- DECL_TEMPLATE_INFO (decl) = tree_cons (tmpl, targs, NULL_TREE);
+ DECL_TEMPLATE_INFO (decl) = build_template_info (tmpl, targs);
/* Inherit default function arguments from the template
DECL is specializing. */
@@ -2900,7 +2912,7 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
case UNION_TYPE:
case ENUMERAL_TYPE:
if (TYPE_TEMPLATE_INFO (t))
- cp_walk_tree (&TREE_VALUE (TYPE_TEMPLATE_INFO (t)),
+ cp_walk_tree (&TI_ARGS (TYPE_TEMPLATE_INFO (t)),
&find_parameter_packs_r, ppd, ppd->visited);
*walk_subtrees = 0;
@@ -4351,7 +4363,7 @@ push_template_decl_real (tree decl, bool is_friend)
DECL_TI_TEMPLATE (decl) = new_tmpl;
SET_DECL_TEMPLATE_SPECIALIZATION (new_tmpl);
DECL_TEMPLATE_INFO (new_tmpl)
- = tree_cons (tmpl, args, NULL_TREE);
+ = build_template_info (tmpl, args);
register_specialization (new_tmpl,
most_general_template (tmpl),
@@ -4470,7 +4482,7 @@ template arguments to %qD do not match original template %qD",
if (DECL_TEMPLATE_INFO (tmpl))
args = add_outermost_template_args (DECL_TI_ARGS (tmpl), args);
- info = tree_cons (tmpl, args, NULL_TREE);
+ info = build_template_info (tmpl, args);
if (DECL_IMPLICIT_TYPEDEF_P (decl))
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
@@ -6448,7 +6460,7 @@ lookup_template_class (tree d1,
found = CLASSTYPE_TI_TEMPLATE (found);
}
- SET_TYPE_TEMPLATE_INFO (t, tree_cons (found, arglist, NULL_TREE));
+ SET_TYPE_TEMPLATE_INFO (t, build_template_info (found, arglist));
elt.spec = t;
slot = (spec_entry **) htab_find_slot_with_hash (type_specializations,
@@ -6524,7 +6536,7 @@ for_each_template_parm_r (tree *tp, int *walk_subtrees, void *d)
case ENUMERAL_TYPE:
if (!TYPE_TEMPLATE_INFO (t))
*walk_subtrees = 0;
- else if (for_each_template_parm (TREE_VALUE (TYPE_TEMPLATE_INFO (t)),
+ else if (for_each_template_parm (TI_ARGS (TYPE_TEMPLATE_INFO (t)),
fn, data, pfd->visited,
pfd->include_nondeduced_p))
return error_mark_node;
@@ -7380,17 +7392,24 @@ apply_late_template_attributes (tree *decl_p, tree attributes, int attr_flags,
static void
perform_typedefs_access_check (tree tmpl, tree targs)
{
- tree t;
+ location_t saved_location;
+ int i;
+ qualified_typedef_usage_t *iter;
if (!tmpl
|| (!CLASS_TYPE_P (tmpl)
&& TREE_CODE (tmpl) != FUNCTION_DECL))
return;
- for (t = get_types_needing_access_check (tmpl); t; t = TREE_CHAIN (t))
+ saved_location = input_location;
+ for (i = 0;
+ VEC_iterate (qualified_typedef_usage_t,
+ get_types_needing_access_check (tmpl),
+ i, iter);
+ ++i)
{
- tree type_decl = TREE_PURPOSE (t);
- tree type_scope = TREE_VALUE (t);
+ tree type_decl = iter->typedef_decl;
+ tree type_scope = iter->context;
if (!type_decl || !type_scope || !CLASS_TYPE_P (type_scope))
continue;
@@ -7400,9 +7419,13 @@ perform_typedefs_access_check (tree tmpl, tree targs)
if (uses_template_parms (type_scope))
type_scope = tsubst (type_scope, targs, tf_error, NULL_TREE);
+ /* Make access check error messages point to the location
+ of the use of the typedef. */
+ input_location = iter->locus;
perform_or_defer_access_check (TYPE_BINFO (type_scope),
type_decl, type_decl);
}
+ input_location = saved_location;
}
tree
@@ -8654,7 +8677,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
gcc_assert (DECL_LANG_SPECIFIC (r) != 0);
TREE_CHAIN (r) = NULL_TREE;
- DECL_TEMPLATE_INFO (r) = build_tree_list (t, args);
+ DECL_TEMPLATE_INFO (r) = build_template_info (t, args);
if (TREE_CODE (decl) == TYPE_DECL)
{
@@ -8883,7 +8906,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
if (gen_tmpl)
{
DECL_TEMPLATE_INFO (r)
- = tree_cons (gen_tmpl, argvec, NULL_TREE);
+ = build_template_info (gen_tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
register_specialization (r, gen_tmpl, argvec, false, hash);
@@ -9297,7 +9320,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
DECL_EXTERNAL (r) = 1;
register_specialization (r, gen_tmpl, argvec, false, hash);
- DECL_TEMPLATE_INFO (r) = tree_cons (tmpl, argvec, NULL_TREE);
+ DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
}
else if (cp_unevaluated_operand)
@@ -9906,7 +9929,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
return error_mark_node;
TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (r)
- = tree_cons (TYPE_TI_TEMPLATE (t), argvec, NULL_TREE);
+ = build_template_info (TYPE_TI_TEMPLATE (t), argvec);
}
}
break;
@@ -18079,28 +18102,29 @@ type_uses_auto (tree type)
return NULL_TREE;
}
-/* For a given template T, return the list of typedefs referenced
+/* For a given template T, return the vector of typedefs referenced
in T for which access check is needed at T instantiation time.
T is either a FUNCTION_DECL or a RECORD_TYPE.
Those typedefs were added to T by the function
append_type_to_template_for_access_check. */
-tree
+VEC(qualified_typedef_usage_t,gc)*
get_types_needing_access_check (tree t)
{
- tree ti, result = NULL_TREE;
+ tree ti;
+ VEC(qualified_typedef_usage_t,gc) *result = NULL;
if (!t || t == error_mark_node)
- return t;
+ return NULL;
if (!(ti = get_template_info (t)))
- return NULL_TREE;
+ return NULL;
if (CLASS_TYPE_P (t)
|| TREE_CODE (t) == FUNCTION_DECL)
{
if (!TI_TEMPLATE (ti))
- return NULL_TREE;
+ return NULL;
result = TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (ti);
}
@@ -18114,6 +18138,7 @@ get_types_needing_access_check (tree t)
T is either a FUNCTION_DECL or a RECORD_TYPE.
TYPE_DECL is a TYPE_DECL node representing a typedef.
SCOPE is the scope through which TYPE_DECL is accessed.
+ LOCATION is the location of the usage point of TYPE_DECL.
This function is a subroutine of
append_type_to_template_for_access_check. */
@@ -18121,8 +18146,10 @@ get_types_needing_access_check (tree t)
static void
append_type_to_template_for_access_check_1 (tree t,
tree type_decl,
- tree scope)
+ tree scope,
+ location_t location)
{
+ qualified_typedef_usage_t typedef_usage;
tree ti;
if (!t || t == error_mark_node)
@@ -18139,14 +18166,20 @@ append_type_to_template_for_access_check_1 (tree t,
gcc_assert (TI_TEMPLATE (ti));
- TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (ti) =
- tree_cons (type_decl, scope, TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (ti));
+ typedef_usage.typedef_decl = type_decl;
+ typedef_usage.context = scope;
+ typedef_usage.locus = location;
+
+ VEC_safe_push (qualified_typedef_usage_t, gc,
+ TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (ti),
+ &typedef_usage);
}
/* Append TYPE_DECL to the template TEMPL.
TEMPL is either a class type, a FUNCTION_DECL or a a TEMPLATE_DECL.
At TEMPL instanciation time, TYPE_DECL will be checked to see
if it can be accessed through SCOPE.
+ LOCATION is the location of the usage point of TYPE_DECL.
e.g. consider the following code snippet:
@@ -18157,7 +18190,7 @@ append_type_to_template_for_access_check_1 (tree t,
template<class U> struct S
{
- C::myint mi;
+ C::myint mi; // <-- usage point of the typedef C::myint
};
S<char> s;
@@ -18174,25 +18207,25 @@ append_type_to_template_for_access_check_1 (tree t,
void
append_type_to_template_for_access_check (tree templ,
tree type_decl,
- tree scope)
+ tree scope,
+ location_t location)
{
- tree node;
+ qualified_typedef_usage_t *iter;
+ int i;
gcc_assert (type_decl && (TREE_CODE (type_decl) == TYPE_DECL));
/* Make sure we don't append the type to the template twice. */
- for (node = get_types_needing_access_check (templ);
- node;
- node = TREE_CHAIN (node))
- {
- tree decl = TREE_PURPOSE (node);
- tree type_scope = TREE_VALUE (node);
-
- if (decl == type_decl && type_scope == scope)
- return;
- }
+ for (i = 0;
+ VEC_iterate (qualified_typedef_usage_t,
+ get_types_needing_access_check (templ),
+ i, iter);
+ ++i)
+ if (iter->typedef_decl == type_decl && scope == iter->context)
+ return;
- append_type_to_template_for_access_check_1 (templ, type_decl, scope);
+ append_type_to_template_for_access_check_1 (templ, type_decl,
+ scope, location);
}
/* Set up the hash tables for template instantiations. */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 7401593bcc6..34b5d574d07 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1531,6 +1531,37 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
}
}
+/* If we are currently parsing a template and we encountered a typedef
+ TYPEDEF_DECL that is being accessed though CONTEXT, this function
+ adds the typedef to a list tied to the current template.
+ At tempate instantiatin time, that list is walked and access check
+ performed for each typedef.
+ LOCATION is the location of the usage point of TYPEDEF_DECL. */
+
+void
+add_typedef_to_current_template_for_access_check (tree typedef_decl,
+ tree context,
+ location_t location)
+{
+ tree template_info = NULL;
+ tree cs = current_scope ();
+
+ if (!is_typedef_decl (typedef_decl)
+ || !context
+ || !CLASS_TYPE_P (context)
+ || !cs)
+ return;
+
+ if (CLASS_TYPE_P (cs) || TREE_CODE (cs) == FUNCTION_DECL)
+ template_info = get_template_info (cs);
+
+ if (template_info
+ && TI_TEMPLATE (template_info)
+ && !currently_open_class (context))
+ append_type_to_template_for_access_check (cs, typedef_decl,
+ context, location);
+}
+
/* DECL was the declaration to which a qualified-id resolved. Issue
an error message if it is not accessible. If OBJECT_TYPE is
non-NULL, we have just seen `x->' or `x.' and OBJECT_TYPE is the
@@ -1549,27 +1580,11 @@ check_accessibility_of_qualified_id (tree decl,
add it to a list tied to the template.
At template instantiation time, that list will be walked and
access check performed. */
- if (is_typedef_decl (decl))
- {
- /* This the scope through which type_decl is accessed.
- It will be useful information later to do access check for
- type_decl usage. */
- tree scope = nested_name_specifier
- ? nested_name_specifier
- : DECL_CONTEXT (decl);
- tree templ_info = NULL;
- tree cs = current_scope ();
-
- if (cs && (CLASS_TYPE_P (cs) || TREE_CODE (cs) == FUNCTION_DECL))
- templ_info = get_template_info (cs);
-
- if (templ_info
- && TI_TEMPLATE (templ_info)
- && scope
- && CLASS_TYPE_P (scope)
- && !currently_open_class (scope))
- append_type_to_template_for_access_check (current_scope (), decl, scope);
- }
+ add_typedef_to_current_template_for_access_check (decl,
+ nested_name_specifier
+ ? nested_name_specifier
+ : DECL_CONTEXT (decl),
+ input_location);
/* If we're not checking, return immediately. */
if (deferred_access_no_check)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index f9e1cd707a9..17fc495c9a3 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "convert.h"
#include "tree-flow.h"
+#include "cgraph.h"
static tree bot_manip (tree *, int *, void *);
static tree bot_replace (tree *, int *, void *);
@@ -1490,8 +1491,7 @@ bind_template_template_parm (tree t, tree newargs)
TEMPLATE_TYPE_PARM_INDEX (t2) = copy_node (TEMPLATE_TYPE_PARM_INDEX (t));
TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (t2)) = decl;
TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2)
- = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t),
- newargs, NULL_TREE);
+ = build_template_info (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t), newargs);
TREE_TYPE (decl) = t2;
TYPE_NAME (t2) = decl;
@@ -3126,7 +3126,16 @@ cp_fix_function_decl_p (tree decl)
if (!gimple_has_body_p (decl)
&& !DECL_THUNK_P (decl)
&& !DECL_EXTERNAL (decl))
- return true;
+ {
+ struct cgraph_node *node = cgraph_get_node (decl);
+
+ /* Don't fix same_body aliases. Although they don't have their own
+ CFG, they share it with what they alias to. */
+ if (!node
+ || node->decl == decl
+ || !node->same_body)
+ return true;
+ }
return false;
}
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9d549920681..42e8848169f 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -6300,7 +6300,7 @@ helps machines that have slow floating point or memory load instructions
by allowing other instructions to be issued until the result of the load
or floating point instruction is required.
-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+Enabled at levels @option{-O2}, @option{-O3}.
@item -fschedule-insns2
@opindex fschedule-insns2
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 234a0d166b9..64061e7682e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/41807
+ * trans-const.c (gfc_conv_const): Fix typo in comment. Replace assert
+ with error message if not constant.
+ * resolve.c (next_data_value): Delete check for constant.
+
2009-11-20 Janus Weil <janus@gcc.gnu.org>
* intrinsic.texi (C_F_PROCPOINTER): Remove obsolete comment.
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index f3fce1b38ad..bd690a71f0e 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -11083,9 +11083,6 @@ next_data_value (void)
{
while (mpz_cmp_ui (values.left, 0) == 0)
{
- if (!gfc_is_constant_expr (values.vnode->expr))
- gfc_error ("non-constant DATA value at %L",
- &values.vnode->expr->where);
if (values.vnode->next == NULL)
return FAILURE;
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index 035f40b125c..e2cd40bc954 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -340,7 +340,7 @@ void
gfc_conv_constant (gfc_se * se, gfc_expr * expr)
{
/* We may be receiving an expression for C_NULL_PTR or C_NULL_FUNPTR. If
- so, they expr_type will not yet be an EXPR_CONSTANT. We need to make
+ so, the expr_type will not yet be an EXPR_CONSTANT. We need to make
it so here. */
if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
&& expr->ts.u.derived->attr.is_iso_c)
@@ -353,7 +353,11 @@ gfc_conv_constant (gfc_se * se, gfc_expr * expr)
}
}
- gcc_assert (expr->expr_type == EXPR_CONSTANT);
+ if (expr->expr_type != EXPR_CONSTANT)
+ {
+ gfc_error ("non-constant initialization expression at %L", &expr->where);
+ return;
+ }
if (se->ss != NULL)
{
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index 4b632c0d9fb..2af2c7f2d6f 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -578,7 +578,13 @@ build_const_val (struct ipcp_lattice *lat, tree tree_type)
/* Compute the proper scale for NODE. It is the ratio between the number of
direct calls (represented on the incoming cgraph_edges) and sum of all
- invocations of NODE (represented as count in cgraph_node). */
+ invocations of NODE (represented as count in cgraph_node).
+
+ FIXME: This code is wrong. Since the callers can be also clones and
+ the clones are not scaled yet, the sums gets unrealistically high.
+ To properly compute the counts, we would need to do propagation across
+ callgraph (as external call to A might imply call to non-clonned B
+ if A's clone calls clonned B). */
static void
ipcp_compute_node_scale (struct cgraph_node *node)
{
@@ -589,6 +595,12 @@ ipcp_compute_node_scale (struct cgraph_node *node)
/* Compute sum of all counts of callers. */
for (cs = node->callers; cs != NULL; cs = cs->next_caller)
sum += cs->count;
+ /* Work around the unrealistically high sum problem. We just don't want
+ the non-cloned body to have negative or very low frequency. Since
+ majority of execution time will be spent in clones anyway, this should
+ give good enough profile. */
+ if (sum > node->count * 9 / 10)
+ sum = node->count * 9 / 10;
if (node->count == 0)
ipcp_set_node_scale (node, 0);
else
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 786c21c0ca3..495d8851247 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1974,6 +1974,11 @@ inline_transform (struct cgraph_node *node)
unsigned int todo = 0;
struct cgraph_edge *e;
+ /* FIXME: Currently the passmanager is adding inline transform more than once to some
+ clones. This needs revisiting after WPA cleanups. */
+ if (cfun->after_inlining)
+ return 0;
+
/* We might need the body of this function so that we can expand
it inline somewhere else. */
if (cgraph_preserve_function_body_p (node->decl))
diff --git a/gcc/ira-lives.c b/gcc/ira-lives.c
index c67e89cbd79..ea241f4732c 100644
--- a/gcc/ira-lives.c
+++ b/gcc/ira-lives.c
@@ -745,7 +745,7 @@ single_reg_operand_class (int op_num)
void
ira_implicitly_set_insn_hard_regs (HARD_REG_SET *set)
{
- int i, c, regno;
+ int i, c, regno = 0;
bool ignore_p;
enum reg_class cl;
rtx op;
diff --git a/gcc/opts.c b/gcc/opts.c
index b2b6c4454ee..4e8fdcc6700 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -884,7 +884,8 @@ decode_options (unsigned int argc, const char **argv)
flag_caller_saves = opt2;
flag_peephole2 = opt2;
#ifdef INSN_SCHEDULING
- flag_schedule_insns = opt2;
+ /* Only run the pre-regalloc scheduling pass if optimizing for speed. */
+ flag_schedule_insns = opt2 && ! optimize_size;
flag_schedule_insns_after_reload = opt2;
#endif
flag_regmove = opt2;
diff --git a/gcc/predict.c b/gcc/predict.c
index df859066b96..058901e5903 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2020,7 +2020,7 @@ counts_to_freqs (void)
gcov_type count_max, true_count_max = 0;
basic_block bb;
- FOR_EACH_BB (bb)
+ FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
true_count_max = MAX (bb->count, true_count_max);
count_max = MAX (true_count_max, 1);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0cf2d2d124..ccaae0cbf9a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,135 @@
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.c-torture/execute/pr40404.c: Use long for bitfield on 16bit
+ int targets.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc-dg/Wtype-limits.c: Add line to correct line numbers.
+
+2009-11-23 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR testsuite/42086
+ * gcc.target/ia64/fptr-1.c: Make it a compile test.
+
+2009-11-23 Janis Johnson <janis187@us.ibm.com>
+
+ * lib/lto.exp (lto_option_list): Rename from option_list.
+ * lib/compat.exp (compat_option_list): Rename from option_list.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc-dg/raw-string-1.c: Require-effective-target wchar.
+ * gcc-dg/raw-string-2.c: Ditto.
+ * gcc-dg/utf-array-short-wchar.c: Ditto.
+ * gcc-dg/utf-array.c: Ditto.
+ * gcc-dg/utf8-2.c: Ditto.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.dg/torture/pr37868.c: Use smaller bitfield for 16bit int
+ targets.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.dg/tree-ssa/pr33920.c: Remove warning check for 16 bit target.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc-dg/Wtype-limits.c: Remove XFAIL for avr target.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ PR testsuite/36470
+ * gcc.dg/utf-cvt.c: Skip int test for 16bit int targets.
+ Enable short test for avr target.
+ * gcc.dg/utf32-1.c: Enable test for avr and m32 targets.
+ * gcc.dg/utf32-2.c: Ditto.
+ * gcc.dg/utf32-3.c: Ditto.
+ * gcc.dg/utf32-4.c: Enable test for non-32bit targets.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.dg/tree-ssa/asmgoto-1.c: Suppress warnings.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.c-torture/execute/ipa-sra-2.x: New. Skip for 16bit targets.
+
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.dg/sms-6.c: Use long for 16 bit int targets.
+ * gcc.dg/sms-7.c: Ditto.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.dg/pr36998.c: Frame pointer required for avr target.
+ * gcc.dg/debug/pr41264-1.c: Use long if int size 16bit or smaller.
+ * gcc.dg/pr39226.c: Use smaller bitfield if int size is 16bit.
+ * gcc.dg/pr41340.c: Test requires long pointer target.
+ * gcc.dg/profile-generate-3.c: Test requires profiling support.
+
+2009-11-23 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+
+ * gcc.dg/graphite/block-1.c: Require 32-bit or larger array support.
+ * gcc.dg/graphite/block-3.c: Ditto.
+ * gcc.dg/graphite/block-4.c: Ditto.
+ * gcc.dg/graphite/block-5.c: Ditto.
+ * gcc.dg/graphite/block-6.c: Ditto.
+ * gcc.dg/graphite/interchange-0.c: Ditto.
+ * gcc.dg/graphite/interchange-1.c: Ditto.
+ * gcc.dg/graphite/interchange-2.c: Ditto.
+ * gcc.dg/graphite/interchange-3.c: Ditto.
+ * gcc.dg/graphite/interchange-4.c: Ditto.
+ * gcc.dg/graphite/interchange-5.c: Ditto.
+ * gcc.dg/graphite/interchange-6.c: Ditto.
+ * gcc.dg/graphite/run-id-1.c: Ditto.
+ * gcc.dg/graphite/scop-16.c: Ditto.
+ * gcc.dg/graphite/scop-17.c: Ditto.
+ * gcc.dg/graphite/scop-18.c: Ditto.
+ * gcc.dg/graphite/scop-matmult.c: Ditto.
+ * gcc.dg/graphite/pr40157.c: Require 32bit or larger int.
+ * gcc.dg/graphite/id-15.c: Ditto.
+
+2009-11-23 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/specs/weak1.ads: New test.
+
+2009-11-23 Steve Ellcey <sje@cup.hp.com>
+
+ * gcc.dg/debug/dwarf2/inline2.c: Modify scan.
+
+2009-11-23 Dodji Seketeli <dodji@redhat.com>
+
+ PR c++/14777
+ * g++.dg/template/typedef13.C: Adjust.
+ * g++.dg/template/typedef19.C: Adjust.
+ * g++.dg/template/typedef20.C: Adjust.
+ * g++.dg/template/typedef22.C: New test.
+
+2009-11-22 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/42113
+ * gcc.target/alpha/pr42113.c: New test.
+
+2009-11-21 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/41807
+ * gfortran.dg/data_value_1.f90: Update test.
+ * gfortran.dg/array_constructor_32.f90: New test.
+
+2009-11-21 Martin Jambor <mjambor@suse.cz>
+
+ PR middle-end/42025
+ * gcc.c-torture/compile/pr42025-1.c: New test.
+ * gcc.c-torture/compile/pr42025-2.c: New test.
+
+2009-11-21 Adam Nemet <adambnemet@gmail.com>
+
+ * gcc.target/mips/mult-1.c: Forbid octeon.
+ * gcc.target/mips/octeon-dmul-3.c: New test.
+
2009-11-21 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* gcc.dg/tree-ssa/vrp47.c: Fix target check.
@@ -16,7 +148,7 @@
PR tree-optimization/42078
* gcc.dg/pr42078.c: New test.
-2009-11-19 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
+2009-11-20 Andy Hutchinson <hutchinsonandy@gcc.gnu.org>
PR Testsuite/42114
* gcc-dg/c99-stdint-1.c: Condition test for target without signal.h.
diff --git a/gcc/testsuite/g++.dg/template/typedef13.C b/gcc/testsuite/g++.dg/template/typedef13.C
index aa8bb326829..a22e1cb11ca 100644
--- a/gcc/testsuite/g++.dg/template/typedef13.C
+++ b/gcc/testsuite/g++.dg/template/typedef13.C
@@ -8,8 +8,8 @@ class A
};
template <class T> class B : public A
-{ // { dg-error "within this context" }
- mytype mem;
+{
+ mytype mem; // { dg-error "within this context" }
};
B<int> b; // { dg-message "instantiated from here" }
diff --git a/gcc/testsuite/g++.dg/template/typedef19.C b/gcc/testsuite/g++.dg/template/typedef19.C
index f576d4828e4..2fac20ea065 100644
--- a/gcc/testsuite/g++.dg/template/typedef19.C
+++ b/gcc/testsuite/g++.dg/template/typedef19.C
@@ -14,8 +14,8 @@ class B : public A
template<class T>
class B<T*> : public A
-{ // { dg-error "within this context" }
- mytype mem;
+{
+ mytype mem; // { dg-error "within this context" }
};
B<int*> b;
diff --git a/gcc/testsuite/g++.dg/template/typedef20.C b/gcc/testsuite/g++.dg/template/typedef20.C
index a5cbdeb236b..c768ce0a78a 100644
--- a/gcc/testsuite/g++.dg/template/typedef20.C
+++ b/gcc/testsuite/g++.dg/template/typedef20.C
@@ -18,9 +18,9 @@ struct y : public x
template<typename T>
struct y<T*> : public x
-{ // { dg-error "within this context" }
+{
typedef x::type good;
- typedef x::privtype bad;
+ typedef x::privtype bad; // { dg-error "within this context" }
};
template class y<int>;
diff --git a/gcc/testsuite/g++.dg/template/typedef22.C b/gcc/testsuite/g++.dg/template/typedef22.C
new file mode 100644
index 00000000000..e3ecfcb3673
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/typedef22.C
@@ -0,0 +1,18 @@
+// Contributed by Dodji Seketeli <dodji@redhat.com>
+// Origin: PR c++/14777
+// { dg-do compile }
+
+template <typename T>
+struct B
+{
+protected:
+ typedef int M; // { dg-error "protected" }
+};
+
+template <typename T>
+struct A : B<T> {
+ typedef typename B<char>::M N; // { dg-error "context" }
+ A (int = N ());
+};
+
+A<int> a = A<int> ();
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c b/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c
new file mode 100644
index 00000000000..f19123eafa6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr42025-1.c
@@ -0,0 +1,24 @@
+typedef void* Ptr;
+
+struct A
+{
+ int i;
+ union
+ {
+ Ptr p;
+ char *q;
+ } u;
+};
+
+static void foo(struct A *p, char *q)
+{
+ if (p->i)
+ p->u.p = 0;
+ else
+ p->u.q = q;
+}
+
+void bar(struct A *p, char *q)
+{
+ foo(p, q);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c b/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c
new file mode 100644
index 00000000000..14cb36d1c0e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr42025-2.c
@@ -0,0 +1,32 @@
+typedef struct
+{
+ void *p;
+} Ptr;
+
+struct A
+{
+ int i;
+ union
+ {
+ Ptr p;
+ char *q;
+ } u;
+};
+
+extern Ptr get_stuff (void);
+extern void use_stuff (char *);
+
+static void foo(struct A p, char *q)
+{
+ if (p.i)
+ p.u.p = get_stuff ();
+ else
+ p.u.q = q;
+
+ use_stuff (p.u.q);
+}
+
+void bar(struct A *p, char *q)
+{
+ foo(*p, q);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x
new file mode 100644
index 00000000000..c65423ef6d9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/ipa-sra-2.x
@@ -0,0 +1,3 @@
+load_lib target-supports.exp
+
+return [expr [check_effective_target_int16 ]]
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40404.c b/gcc/testsuite/gcc.c-torture/execute/pr40404.c
index a759a3f5c7d..b2e0ea2755c 100644
--- a/gcc/testsuite/gcc.c-torture/execute/pr40404.c
+++ b/gcc/testsuite/gcc.c-torture/execute/pr40404.c
@@ -1,7 +1,14 @@
extern void abort (void);
+
+#if (__SIZEOF_INT__ <= 2)
+struct S {
+ unsigned long ui17 : 17;
+} s;
+#else
struct S {
unsigned int ui17 : 17;
} s;
+#endif
int main()
{
s.ui17 = 0x1ffff;
diff --git a/gcc/testsuite/gcc.dg/Wtype-limits.c b/gcc/testsuite/gcc.dg/Wtype-limits.c
index 5ff9ac053da..16173e5b25c 100644
--- a/gcc/testsuite/gcc.dg/Wtype-limits.c
+++ b/gcc/testsuite/gcc.dg/Wtype-limits.c
@@ -1,8 +1,8 @@
/* { dg-do compile } */
-/* { dg-excess-errors "short=int" { target { avr-*-* } } } */
/* { dg-options "-Wtype-limits" } */
+
void a (unsigned char x)
{
if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
index 3a6318ea586..641712bf26f 100644
--- a/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
+++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline2.c
@@ -34,7 +34,7 @@
/* There are 3 DW_AT_inline attributes: one per abstract inline instance.
The value of the attribute must be 0x3, meaning the function was
actually inlined. */
-/* { dg-final { scan-assembler-times "byte.*?0x3.*? DW_AT_inline" 3 } } */
+/* { dg-final { scan-assembler-times "(?:byte|data1)\[^\n\]*0x3\[^\n\]* DW_AT_inline" 3 } } */
inline void
diff --git a/gcc/testsuite/gcc.dg/debug/pr41264-1.c b/gcc/testsuite/gcc.dg/debug/pr41264-1.c
index b5555b554ba..34bdcfe2047 100644
--- a/gcc/testsuite/gcc.dg/debug/pr41264-1.c
+++ b/gcc/testsuite/gcc.dg/debug/pr41264-1.c
@@ -1,6 +1,10 @@
/* { dg-do compile } */
+#if (__SIZEOF_INT__ <= 2)
+typedef unsigned long hashval_t;
+#else
typedef unsigned int hashval_t;
+#endif
static hashval_t __attribute__((always_inline))
iterative_hash_host_wide_int (long val, hashval_t val2)
{
diff --git a/gcc/testsuite/gcc.dg/graphite/block-1.c b/gcc/testsuite/gcc.dg/graphite/block-1.c
index ba772b3f952..7eb38663ec8 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-1.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define MAX 8192
void bar (void);
diff --git a/gcc/testsuite/gcc.dg/graphite/block-3.c b/gcc/testsuite/gcc.dg/graphite/block-3.c
index 6358bce1e24..06eecfb0ae9 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-3.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 24
#define M 100
diff --git a/gcc/testsuite/gcc.dg/graphite/block-4.c b/gcc/testsuite/gcc.dg/graphite/block-4.c
index 773dfef5df6..26b088ec7b4 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-4.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 24
#define M 1000
diff --git a/gcc/testsuite/gcc.dg/graphite/block-5.c b/gcc/testsuite/gcc.dg/graphite/block-5.c
index 7864f32e1fc..5b2263051b9 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-5.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/block-6.c b/gcc/testsuite/gcc.dg/graphite/block-6.c
index 5545ec9fc91..1c92e395026 100644
--- a/gcc/testsuite/gcc.dg/graphite/block-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/block-6.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/id-15.c b/gcc/testsuite/gcc.dg/graphite/id-15.c
index 109d5bbdb01..89ff32f7620 100644
--- a/gcc/testsuite/gcc.dg/graphite/id-15.c
+++ b/gcc/testsuite/gcc.dg/graphite/id-15.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target int32plus } */
+
typedef long unsigned int size_t;
extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__)) __attribute__ ((__nonnull__ (1)));
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-0.c b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
index bfbbb20800a..3e8525070bf 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-0.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-0.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
int a[1000][1000];
int
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-1.c b/gcc/testsuite/gcc.dg/graphite/interchange-1.c
index 3d3da117d17..339698a5c3d 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-1.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
/* Formerly known as ltrans-1.c */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-2.c b/gcc/testsuite/gcc.dg/graphite/interchange-2.c
index 4c9ed5ba800..6b1dbe6514f 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-2.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
/* Formerly known as ltrans-2.c */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-3.c b/gcc/testsuite/gcc.dg/graphite/interchange-3.c
index bd3dde671a2..72880e386a3 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-3.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-3.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
/* Formerly known as ltrans-3.c */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-4.c b/gcc/testsuite/gcc.dg/graphite/interchange-4.c
index d7af311ff9b..ae529649de0 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-4.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-4.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
/* Formerly known as ltrans-4.c */
double u[1782225];
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-5.c b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
index 2aec56758cc..19a5e09397f 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-5.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-5.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
/* Formerly known as ltrans-5.c */
int foo ()
diff --git a/gcc/testsuite/gcc.dg/graphite/interchange-6.c b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
index a10dc0c5c7c..18454879b1f 100644
--- a/gcc/testsuite/gcc.dg/graphite/interchange-6.c
+++ b/gcc/testsuite/gcc.dg/graphite/interchange-6.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
/* Formerly known as ltrans-6.c */
int medium_loop_interchange(int A[100][200])
diff --git a/gcc/testsuite/gcc.dg/graphite/pr40157.c b/gcc/testsuite/gcc.dg/graphite/pr40157.c
index 8b3d7298613..db61c623ca4 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr40157.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr40157.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target int32plus } */
/* { dg-options "-O2 -fgraphite-identity" } */
int buffer[256*256];
diff --git a/gcc/testsuite/gcc.dg/graphite/run-id-1.c b/gcc/testsuite/gcc.dg/graphite/run-id-1.c
index 0a0ff6ab801..4787ac56e32 100644
--- a/gcc/testsuite/gcc.dg/graphite/run-id-1.c
+++ b/gcc/testsuite/gcc.dg/graphite/run-id-1.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
void abort (void);
void foo (int N)
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-16.c b/gcc/testsuite/gcc.dg/graphite/scop-16.c
index d465d953b26..0849e86b855 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-16.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-16.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-17.c b/gcc/testsuite/gcc.dg/graphite/scop-17.c
index dd7bdadc4e8..ee37aea9587 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-17.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-17.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 10000
void foo (int);
int test ()
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-18.c b/gcc/testsuite/gcc.dg/graphite/scop-18.c
index 7d56cb74279..4c2a8cdf644 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-18.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-18.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
#define N 24
#define M 1000
diff --git a/gcc/testsuite/gcc.dg/graphite/scop-matmult.c b/gcc/testsuite/gcc.dg/graphite/scop-matmult.c
index 2d2dce3c160..018de2c4e0d 100644
--- a/gcc/testsuite/gcc.dg/graphite/scop-matmult.c
+++ b/gcc/testsuite/gcc.dg/graphite/scop-matmult.c
@@ -1,3 +1,5 @@
+/* { dg-require-effective-target size32plus } */
+
float A[1000][1000], B[1000][1000], C[1000][1000];
/* Multiply two n x n matrices A and B and store the result in C. */
diff --git a/gcc/testsuite/gcc.dg/pr36998.c b/gcc/testsuite/gcc.dg/pr36998.c
new file mode 100644
index 00000000000..9315fd54444
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36998.c
@@ -0,0 +1,24 @@
+/* PR rtl-optimization/36998 */
+/* { dg-do compile } */
+/* { dg-options "-Os -fasynchronous-unwind-tables" } */
+/* { dg-options "-Os -mpreferred-stack-boundary=2 -fasynchronous-unwind-tables" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-options "-fno-omit-frame-pointer" { target { avr-*-* } } } */
+
+void foo (const char *, ...) __attribute__ ((noreturn));
+int bar (const char *, ...);
+extern __SIZE_TYPE__ strlen (const char *);
+int baz (char *, char *, int, void *);
+
+void
+test (char *w, int x, char *y, char *z)
+{
+ char *p, b[32];
+ for (p = y; *p; p += strlen (p) + 1)
+ {
+ baz (w, p, x, z);
+ foo ("msg1 %s", b);
+ }
+ for (p = y; *p; p += strlen (p) + 1)
+ bar (" %s", p);
+ foo ("msg2 %s", b);
+}
diff --git a/gcc/testsuite/gcc.dg/pr39226.c b/gcc/testsuite/gcc.dg/pr39226.c
index 1442ccc1435..3d336360ae5 100644
--- a/gcc/testsuite/gcc.dg/pr39226.c
+++ b/gcc/testsuite/gcc.dg/pr39226.c
@@ -3,12 +3,21 @@
/* { dg-options "-O2" } */
/* { dg-options "-O2 -mtune=cell -mminimal-toc" { target { powerpc*-*-* && lp64 } } } */
+#if (__SIZEOF_INT__ == 2)
+struct A
+{
+ char *a;
+ unsigned int b : 1;
+ unsigned int c : 15;
+};
+#else
struct A
{
char *a;
unsigned int b : 1;
unsigned int c : 31;
};
+#endif
struct B
{
diff --git a/gcc/testsuite/gcc.dg/pr41340.c b/gcc/testsuite/gcc.dg/pr41340.c
index bafa61f5185..72ad9296894 100644
--- a/gcc/testsuite/gcc.dg/pr41340.c
+++ b/gcc/testsuite/gcc.dg/pr41340.c
@@ -2,6 +2,7 @@
/* { dg-do compile } */
/* { dg-options "-O3 -g -fcompare-debug" } */
/* { dg-options "-O3 -g -fcompare-debug -march=i686" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+/* { dg-skip-if "no long pointers" { { ! ilp32 } && { ! lp64 } } } */
typedef struct { int t; } *T;
struct S1 { unsigned s1; };
diff --git a/gcc/testsuite/gcc.dg/profile-generate-3.c b/gcc/testsuite/gcc.dg/profile-generate-3.c
index 307045afe04..0d78ff38232 100644
--- a/gcc/testsuite/gcc.dg/profile-generate-3.c
+++ b/gcc/testsuite/gcc.dg/profile-generate-3.c
@@ -1,4 +1,5 @@
/* { dg-do link } */
+/* { dg-require-profiling "-fprofile-generate=." } */
/* { dg-options "-fprofile-generate=." } */
int
diff --git a/gcc/testsuite/gcc.dg/raw-string-1.c b/gcc/testsuite/gcc.dg/raw-string-1.c
index 679e9a6c893..f556b3ff552 100644
--- a/gcc/testsuite/gcc.dg/raw-string-1.c
+++ b/gcc/testsuite/gcc.dg/raw-string-1.c
@@ -1,5 +1,5 @@
/* { dg-do run } */
-/* { dg-skip-if "No wchar.h" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-require-effective-target wchar } */
/* { dg-options "-std=gnu99" } */
#include <wchar.h>
diff --git a/gcc/testsuite/gcc.dg/raw-string-2.c b/gcc/testsuite/gcc.dg/raw-string-2.c
index 533abe2bc89..4517a0330c9 100644
--- a/gcc/testsuite/gcc.dg/raw-string-2.c
+++ b/gcc/testsuite/gcc.dg/raw-string-2.c
@@ -1,4 +1,5 @@
/* { dg-do run } */
+/* { dg-require-effective-target wchar } */
/* { dg-options "-std=gnu99" } */
#include <wchar.h>
diff --git a/gcc/testsuite/gcc.dg/sms-6.c b/gcc/testsuite/gcc.dg/sms-6.c
index cd6356530a8..34e9cf82da4 100644
--- a/gcc/testsuite/gcc.dg/sms-6.c
+++ b/gcc/testsuite/gcc.dg/sms-6.c
@@ -20,7 +20,12 @@ void foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c)
int a[100], b[100], c[100];
int main()
{
+#if (__SIZEOF_INT__ <= 2)
+ int i;
+ long res;
+#else
int i, res;
+#endif
for(i = 0; i < 100; i++)
{
b[i] = c[i] = i;
diff --git a/gcc/testsuite/gcc.dg/sms-7.c b/gcc/testsuite/gcc.dg/sms-7.c
index a0aa14b1561..29791ff2a4f 100644
--- a/gcc/testsuite/gcc.dg/sms-7.c
+++ b/gcc/testsuite/gcc.dg/sms-7.c
@@ -21,7 +21,12 @@ short c[100];
int main()
{
+#if (__SIZEOF_INT__ <= 2)
+ int i;
+ long res;
+#else
int i, res;
+#endif
for(i = 0; i < 100; i++)
{
b[i] = c[i] = i;
diff --git a/gcc/testsuite/gcc.dg/torture/pr37868.c b/gcc/testsuite/gcc.dg/torture/pr37868.c
index 50fa903008f..1f89dff2fff 100644
--- a/gcc/testsuite/gcc.dg/torture/pr37868.c
+++ b/gcc/testsuite/gcc.dg/torture/pr37868.c
@@ -3,7 +3,14 @@
/* { dg-skip-if "unaligned access" { sparc*-*-* } "*" "" } */
extern void abort (void);
-
+#if (__SIZEOF_INT__ <= 2)
+struct X {
+ unsigned char pad : 4;
+ unsigned int a : 16;
+ unsigned int b : 8;
+ unsigned int c : 6;
+} __attribute__((packed));
+#else
struct X {
unsigned char pad : 4;
unsigned int a : 32;
@@ -11,6 +18,9 @@ struct X {
unsigned int c : 6;
} __attribute__((packed));
+#endif
+
+
int main (void)
{
struct X x;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/asmgoto-1.c b/gcc/testsuite/gcc.dg/tree-ssa/asmgoto-1.c
index 1d08067bba2..9dd549906b6 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/asmgoto-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/asmgoto-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -w -fdump-tree-optimized" } */
extern void XYZZY (void);
typedef unsigned long __kernel_size_t;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr33920.c b/gcc/testsuite/gcc.dg/tree-ssa/pr33920.c
index 0b91dae3840..e6a9e711881 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr33920.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr33920.c
@@ -30,7 +30,7 @@ void init_code ()
object V658;
T1240:
-if (V648 >= (intptr_t)V651) /* { dg-warning "cast from pointer to integer of different size" "" { target { ! int32plus } } } */
+if (V648 >= (intptr_t)V651)
goto T1243;
V653 = ((char *) V654->v.v_self)[V648];
V659 = (object) V654 + V653;
diff --git a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
index 91f48273e85..ec478121a07 100644
--- a/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
+++ b/gcc/testsuite/gcc.dg/utf-array-short-wchar.c
@@ -1,7 +1,7 @@
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Expected errors for char16_t/char32_t string literals. */
/* { dg-do compile } */
-/* { dg-skip-if "No wchar.h" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-require-effective-target wchar } */
/* { dg-options "-std=gnu99 -fshort-wchar" } */
#include <wchar.h>
diff --git a/gcc/testsuite/gcc.dg/utf-array.c b/gcc/testsuite/gcc.dg/utf-array.c
index b25c2af0c69..433ddcfaf48 100644
--- a/gcc/testsuite/gcc.dg/utf-array.c
+++ b/gcc/testsuite/gcc.dg/utf-array.c
@@ -1,7 +1,7 @@
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Expected errors for char16_t/char32_t string literals. */
/* { dg-do compile } */
-/* { dg-skip-if "No wchar.h" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-require-effective-target wchar } */
/* { dg-options "-std=gnu99" } */
#include <wchar.h>
diff --git a/gcc/testsuite/gcc.dg/utf-cvt.c b/gcc/testsuite/gcc.dg/utf-cvt.c
index 4c82dda2f7d..7f51179eeb4 100644
--- a/gcc/testsuite/gcc.dg/utf-cvt.c
+++ b/gcc/testsuite/gcc.dg/utf-cvt.c
@@ -44,11 +44,11 @@ void m (char16_t c0, char32_t c1)
f_c (c1); /* { dg-warning "alter its value" } */
fsc (c1); /* { dg-warning "alter its value" } */
fuc (c1); /* { dg-warning "alter its value" } */
- f_s (c1); /* { dg-warning "alter its value" "" { target { ! "avr-*-*" } } } */
- fss (c1); /* { dg-warning "alter its value" "" { target { ! "avr-*-*" } } } */
- fus (c1); /* { dg-warning "alter its value" "" { target { ! "avr-*-*" } } } */
- f_i (c1); /* { dg-warning "change the sign" } */
- fsi (c1); /* { dg-warning "change the sign" } */
+ f_s (c1); /* { dg-warning "alter its value" } */
+ fss (c1); /* { dg-warning "alter its value" } */
+ fus (c1); /* { dg-warning "alter its value" } */
+ f_i (c1); /* { dg-warning "change the sign" "" { target { ! int16 } } } */
+ fsi (c1); /* { dg-warning "change the sign" "" { target { ! int16 } } } */
fui (c1);
f_l (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
fsl (c1); /* { dg-warning "change the sign" "" { target { llp64 || ilp32 } } } */
diff --git a/gcc/testsuite/gcc.dg/utf32-1.c b/gcc/testsuite/gcc.dg/utf32-1.c
index 7919faa6371..f9d24c4d0c3 100644
--- a/gcc/testsuite/gcc.dg/utf32-1.c
+++ b/gcc/testsuite/gcc.dg/utf32-1.c
@@ -1,7 +1,6 @@
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Test the support for char32_t character constants. */
/* { dg-do run } */
-/* { dg-xfail-run-if "PR36470" { "avr-*-*" "m32c-*-*" } { "*" } { "" } } */
/* { dg-options "-std=gnu99 -Wall -Werror" } */
typedef __CHAR32_TYPE__ char32_t;
diff --git a/gcc/testsuite/gcc.dg/utf32-2.c b/gcc/testsuite/gcc.dg/utf32-2.c
index 3fd1cf1fdf2..c0d23fb36ef 100644
--- a/gcc/testsuite/gcc.dg/utf32-2.c
+++ b/gcc/testsuite/gcc.dg/utf32-2.c
@@ -1,7 +1,6 @@
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Test the support for char32_t* string constants. */
/* { dg-do run } */
-/* { dg-xfail-run-if "PR36470" { "avr-*-*" "m32c-*-*" } { "*" } { "" } } */
/* { dg-options "-std=gnu99 -Wall -Werror" } */
typedef __CHAR32_TYPE__ char32_t;
diff --git a/gcc/testsuite/gcc.dg/utf32-3.c b/gcc/testsuite/gcc.dg/utf32-3.c
index 486d04f946d..de7b2aa3532 100644
--- a/gcc/testsuite/gcc.dg/utf32-3.c
+++ b/gcc/testsuite/gcc.dg/utf32-3.c
@@ -1,7 +1,6 @@
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Test concatenation of char32_t* string literals. */
/* { dg-do run } */
-/* { dg-xfail-run-if "PR36470" { "avr-*-*" "m32c-*-*" } { "*" } { "" } } */
/* { dg-options "-std=gnu99 -Wall -Werror" } */
typedef __CHAR32_TYPE__ char32_t;
diff --git a/gcc/testsuite/gcc.dg/utf32-4.c b/gcc/testsuite/gcc.dg/utf32-4.c
index 34a78da5f4b..aa7f66a3685 100644
--- a/gcc/testsuite/gcc.dg/utf32-4.c
+++ b/gcc/testsuite/gcc.dg/utf32-4.c
@@ -1,6 +1,6 @@
/* Contributed by Kris Van Hees <kris.van.hees@oracle.com> */
/* Expected errors for char32_t character constants. */
-/* { dg-do compile { target int32plus } } */
+/* { dg-do compile } */
/* { dg-options "-std=gnu99" } */
typedef __CHAR32_TYPE__ char32_t;
diff --git a/gcc/testsuite/gcc.dg/utf8-2.c b/gcc/testsuite/gcc.dg/utf8-2.c
index 173d797e1af..f3b83fe3341 100644
--- a/gcc/testsuite/gcc.dg/utf8-2.c
+++ b/gcc/testsuite/gcc.dg/utf8-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-skip-if "No wchar.h" { "avr-*-*" } { "*" } { "" } } */
+/* { dg-require-effective-target wchar } */
/* { dg-options "-std=gnu99" } */
#include <wchar.h>
diff --git a/gcc/testsuite/gcc.target/alpha/pr42113.c b/gcc/testsuite/gcc.target/alpha/pr42113.c
new file mode 100644
index 00000000000..228c14abb64
--- /dev/null
+++ b/gcc/testsuite/gcc.target/alpha/pr42113.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int foo (int a, int b)
+{
+ int bar = a * sizeof (int);
+
+ if (b)
+ bar += sizeof (int);
+
+ return bar;
+}
diff --git a/gcc/testsuite/gcc.target/ia64/fptr-1.c b/gcc/testsuite/gcc.target/ia64/fptr-1.c
index 8dc2efa2964..b3d4536bf97 100644
--- a/gcc/testsuite/gcc.target/ia64/fptr-1.c
+++ b/gcc/testsuite/gcc.target/ia64/fptr-1.c
@@ -1,10 +1,10 @@
-/* { dg-do run { target ia64-*-linux* } } */
+/* { dg-do compile { target ia64-*-linux* } } */
/* { dg-options "-O2" } */
-/* Test function descriptor access. */
+/* { dg-final { scan-assembler-not "@ltoffx\\(os_boot_rendez#\\)" } } */
+/* { dg-final { scan-assembler "@ltoff\\(@fptr\\(os_boot_rendez#\\)\\)" } } */
-extern unsigned long *_GLOBAL_OFFSET_TABLE_;
-extern void abort(void);
+/* Test function descriptor access. */
struct ia64_fdesc
{
@@ -17,11 +17,7 @@ os_boot_rendez (void)
{
}
-static int
-check (unsigned long gp)
-{
- return gp != (unsigned long) &_GLOBAL_OFFSET_TABLE_;
-}
+extern int check (unsigned long);
int
main (int argc, char **argv)
@@ -31,7 +27,5 @@ main (int argc, char **argv)
for (i = 0; i < 1; i++)
res += check (((struct ia64_fdesc *) os_boot_rendez)->gp);
- if (res)
- abort ();
return res;
}
diff --git a/gcc/testsuite/gcc.target/mips/mult-1.c b/gcc/testsuite/gcc.target/mips/mult-1.c
index d82a4778263..43dd08c0b52 100644
--- a/gcc/testsuite/gcc.target/mips/mult-1.c
+++ b/gcc/testsuite/gcc.target/mips/mult-1.c
@@ -1,6 +1,6 @@
/* For SI->DI widening multiplication we should use DINS to combine the two
- halves. */
-/* { dg-options "-O -mgp64 isa_rev>=2" } */
+ halves. For Octeon use DMUL with explicit widening. */
+/* { dg-options "-O -mgp64 isa_rev>=2 forbid_cpu=octeon" } */
/* { dg-final { scan-assembler "\tdins\t" } } */
/* { dg-final { scan-assembler-not "\tdsll\t" } } */
/* { dg-final { scan-assembler-not "\tdsrl\t" } } */
diff --git a/gcc/testsuite/gcc.target/mips/octeon-dmul-3.c b/gcc/testsuite/gcc.target/mips/octeon-dmul-3.c
new file mode 100644
index 00000000000..01f0eefca80
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/octeon-dmul-3.c
@@ -0,0 +1,19 @@
+/* Use DMUL for widening multiplication too. */
+/* { dg-options "-O -march=octeon -mgp64" } */
+/* { dg-final { scan-assembler-times "\tdmul\t" 2 } } */
+/* { dg-final { scan-assembler-not "\td?mult\t" } } */
+/* { dg-final { scan-assembler-times "\tdext\t" 2 } } */
+
+NOMIPS16 long long
+f (int i, int j)
+{
+ i++;
+ return (long long) i * j;
+}
+
+NOMIPS16 unsigned long long
+g (unsigned int i, unsigned int j)
+{
+ i++;
+ return (unsigned long long) i * j;
+}
diff --git a/gcc/testsuite/gfortran.dg/array_constructor_32.f90 b/gcc/testsuite/gfortran.dg/array_constructor_32.f90
new file mode 100644
index 00000000000..5cf49aee744
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/array_constructor_32.f90
@@ -0,0 +1,28 @@
+! { dg-do run }
+! PR41807 data statement with nested type constructors
+! Test case provided by Steve Kargl
+ implicit none
+
+ type :: a
+ real :: x(3)
+ end type a
+
+ integer, parameter :: n = 3
+
+ type(a) :: b(n)
+
+ real, parameter :: d1(3) = (/1., 2., 3./)
+ real, parameter :: d2(3) = (/4., 5., 6./)
+ real, parameter :: d3(3) = (/7., 8., 9./)
+
+ integer :: i, z(n)
+
+ data (b(i), i = 1, n) /a(d1), a(d2), a(d3)/
+ data (z(i), i = 1, n) / 1, 2, 3/
+
+ if (any(z.ne.[1, 2, 3])) call abort
+ if (any(b(1)%x.ne.[1, 2, 3]) .or. &
+ any(b(2)%x.ne.[4, 5, 6]) .or. &
+ any(b(3)%x.ne.[7, 8, 9])) call abort
+end
+
diff --git a/gcc/testsuite/gfortran.dg/data_value_1.f90 b/gcc/testsuite/gfortran.dg/data_value_1.f90
index ea05a91d30d..cb3e4c3ec2b 100644
--- a/gcc/testsuite/gfortran.dg/data_value_1.f90
+++ b/gcc/testsuite/gfortran.dg/data_value_1.f90
@@ -3,12 +3,14 @@
! is not a constant and so the DATA statement did not have
! a constant value expression.
!
+! Modified dg-error for PR41807
+!
! Contributed by Philippe Marguinaud <philippe.marguinaud@meteo.fr>
!
TYPE POINT
REAL :: X
ENDTYPE
TYPE(POINT) :: P
- DATA P / POINT(1.+X) / ! { dg-error "non-constant DATA value" }
+ DATA P / POINT(1.+X) / ! { dg-error "non-constant initialization" }
print *, p
END
diff --git a/gcc/testsuite/gnat.dg/specs/weak1.ads b/gcc/testsuite/gnat.dg/specs/weak1.ads
new file mode 100644
index 00000000000..82cddc09ac2
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/weak1.ads
@@ -0,0 +1,7 @@
+package Weak1 is
+
+ Myconst : constant Integer := 1234;
+ pragma Export (C, Myconst, "myconst");
+ pragma Weak_External (Myconst);
+
+end Weak1;
diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp
index a4ec3601e56..84053f3ecbd 100644
--- a/gcc/testsuite/lib/compat.exp
+++ b/gcc/testsuite/lib/compat.exp
@@ -48,7 +48,7 @@ if ![info exists COMPAT_OPTIONS] {
[list {} {}]]
}
-set option_list $COMPAT_OPTIONS
+set compat_option_list $COMPAT_OPTIONS
# Subsets of tests can be selectively disabled by members of this list:
# - ATTRIBUTE: disable all tests using the __attribute__ extension,
@@ -245,7 +245,7 @@ proc compat-get-options { src } {
#
proc compat-execute { src1 sid use_alt } {
global srcdir tmpdir
- global option_list
+ global compat_option_list
global tool
global verbose
global testcase
@@ -328,7 +328,7 @@ proc compat-execute { src1 sid use_alt } {
# Loop through all of the option lists used for this test.
set count 0
- foreach option_pair $option_list {
+ foreach option_pair $compat_option_list {
# Pick out each set of options.
set tst_option [lindex $option_pair 0]
diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
index 9e9084d1b68..1dd9c34df55 100644
--- a/gcc/testsuite/lib/lto.exp
+++ b/gcc/testsuite/lib/lto.exp
@@ -311,7 +311,7 @@ proc lto-get-options { src } {
# SID identifies a test suite in the names of temporary files.
proc lto-execute { src1 sid } {
global srcdir tmpdir
- global option_list
+ global lto_option_list
global tool
global verbose
global testcase
@@ -334,12 +334,12 @@ proc lto-execute { src1 sid } {
set compile_xfail(0) ""
# If the main file defines dg-options, those flags are used to
- # overwrite the default option_list taken from LTO_OPTIONS.
+ # overwrite the default lto_option_list taken from LTO_OPTIONS.
if { [string length $extra_flags(0)] > 0 } {
- set option_list $extra_flags(0)
+ set lto_option_list $extra_flags(0)
set extra_flags(0) ""
} else {
- set option_list $LTO_OPTIONS
+ set lto_option_list $LTO_OPTIONS
}
# Check whether this test is supported for this target.
@@ -417,7 +417,7 @@ proc lto-execute { src1 sid } {
# Loop through all of the option lists used for this test.
set count 0
- foreach option $option_list {
+ foreach option $lto_option_list {
verbose "Testing $testcase, $option"
# There's a unique name for each executable we generate.
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index b3b71b9abba..13aa63f1d59 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2889,12 +2889,24 @@ verify_types_in_gimple_reference (tree expr, bool require_lvalue)
return true;
}
- /* For VIEW_CONVERT_EXPRs which are allowed here, too, there
- is nothing to verify. Gross mismatches at most invoke
- undefined behavior. */
- if (TREE_CODE (expr) == VIEW_CONVERT_EXPR
- && !handled_component_p (op))
- return false;
+ if (TREE_CODE (expr) == VIEW_CONVERT_EXPR)
+ {
+ /* For VIEW_CONVERT_EXPRs which are allowed here too, we only check
+ that their operand is not an SSA name or an invariant when
+ requiring an lvalue (this usually means there is a SRA or IPA-SRA
+ bug). Otherwise there is nothing to verify, gross mismatches at
+ most invoke undefined behavior. */
+ if (require_lvalue
+ && (TREE_CODE (op) == SSA_NAME
+ || is_gimple_min_invariant (op)))
+ {
+ error ("Conversion of an SSA_NAME on the left hand side.");
+ debug_generic_stmt (expr);
+ return true;
+ }
+ else if (!handled_component_p (op))
+ return false;
+ }
expr = op;
}
@@ -2951,7 +2963,8 @@ verify_gimple_call (gimple stmt)
}
if (gimple_call_lhs (stmt)
- && !is_gimple_lvalue (gimple_call_lhs (stmt)))
+ && (!is_gimple_lvalue (gimple_call_lhs (stmt))
+ || verify_types_in_gimple_reference (gimple_call_lhs (stmt), true)))
{
error ("invalid LHS in gimple call");
return true;
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index d1f84a2ebaa..20bdad2cbdd 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -914,13 +914,23 @@ get_ref_base_and_extent (tree exp, HOST_WIDE_INT *poffset,
the array. The simplest way to conservatively deal with this
is to punt in the case that offset + maxsize reaches the
base type boundary. This needs to include possible trailing padding
- that is there for alignment purposes. */
+ that is there for alignment purposes.
- if (seen_variable_array_ref
- && maxsize != -1
- && (!host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
- || (bit_offset + maxsize
- == (signed) TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))))))
+ That is of course only true if the base object is not a decl. */
+
+ if (DECL_P (exp))
+ {
+ /* If maxsize is unknown adjust it according to the size of the
+ base decl. */
+ if (maxsize == -1
+ && host_integerp (DECL_SIZE (exp), 1))
+ maxsize = TREE_INT_CST_LOW (DECL_SIZE (exp)) - bit_offset;
+ }
+ else if (seen_variable_array_ref
+ && maxsize != -1
+ && (!host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
+ || (bit_offset + maxsize
+ == (signed) TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))))))
maxsize = -1;
/* ??? Due to negative offsets in ARRAY_REF we can end up with
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 61d687daa13..778658a70b4 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -255,6 +255,10 @@ execute_fixup_cfg (void)
else
count_scale = REG_BR_PROB_BASE;
+ ENTRY_BLOCK_PTR->count = cgraph_node (current_function_decl)->count;
+ EXIT_BLOCK_PTR->count = (EXIT_BLOCK_PTR->count * count_scale
+ + REG_BR_PROB_BASE / 2) / REG_BR_PROB_BASE;
+
FOR_EACH_BB (bb)
{
bb->count = (bb->count * count_scale
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 67001a64564..fe82d9851be 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -3042,6 +3042,27 @@ unmodified_by_ref_scalar_representative (tree parm)
return repr;
}
+/* Return true iff this access precludes IPA-SRA of the parameter it is
+ associated with. */
+
+static bool
+access_precludes_ipa_sra_p (struct access *access)
+{
+ /* Avoid issues such as the second simple testcase in PR 42025. The problem
+ is incompatible assign in a call statement (and possibly even in asm
+ statements). This can be relaxed by using a new temporary but only for
+ non-TREE_ADDRESSABLE types and is probably not worth the complexity. (In
+ intraprocedural SRA we deal with this by keeping the old aggregate around,
+ something we cannot do in IPA-SRA.) */
+ if (access->write
+ && (is_gimple_call (access->stmt)
+ || gimple_code (access->stmt) == GIMPLE_ASM))
+ return true;
+
+ return false;
+}
+
+
/* Sort collected accesses for parameter PARM, identify representatives for
each accessed region and link them together. Return NULL if there are
different but overlapping accesses, return the special ptr value meaning
@@ -3073,6 +3094,8 @@ splice_param_accesses (tree parm, bool *ro_grp)
bool modification;
access = VEC_index (access_p, access_vec, i);
modification = access->write;
+ if (access_precludes_ipa_sra_p (access))
+ return NULL;
/* Access is about to become group representative unless we find some
nasty overlap which would preclude us from breaking this parameter
@@ -3093,6 +3116,9 @@ splice_param_accesses (tree parm, bool *ro_grp)
else if (ac2->size != access->size)
return NULL;
+ if (access_precludes_ipa_sra_p (ac2))
+ return NULL;
+
modification |= ac2->write;
ac2->group_representative = access;
ac2->next_sibling = access->next_sibling;
@@ -3523,13 +3549,19 @@ replace_removed_params_ssa_names (gimple stmt, void *data)
return true;
}
-/* Callback for scan_function. If the expression *EXPR should be replaced by a
- reduction of a parameter, do so. DATA is a pointer to a vector of
- adjustments. */
+/* Callback for scan_function and helper to sra_ipa_modify_assign. If the
+ expression *EXPR should be replaced by a reduction of a parameter, do so.
+ DATA is a pointer to a vector of adjustments. DONT_CONVERT specifies
+ whether the function should care about type incompatibility the current and
+ new expressions. If it is true, the function will leave incompatibility
+ issues to the caller.
+
+ When called directly by scan_function, DONT_CONVERT is true when the EXPR is
+ a write (LHS) expression. */
static bool
sra_ipa_modify_expr (tree *expr, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
- bool write ATTRIBUTE_UNUSED, void *data)
+ bool dont_convert, void *data)
{
ipa_parm_adjustment_vec adjustments;
int i, len;
@@ -3543,10 +3575,10 @@ sra_ipa_modify_expr (tree *expr, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
if (TREE_CODE (*expr) == BIT_FIELD_REF
|| TREE_CODE (*expr) == IMAGPART_EXPR
|| TREE_CODE (*expr) == REALPART_EXPR)
- expr = &TREE_OPERAND (*expr, 0);
- while (TREE_CODE (*expr) == NOP_EXPR
- || TREE_CODE (*expr) == VIEW_CONVERT_EXPR)
- expr = &TREE_OPERAND (*expr, 0);
+ {
+ expr = &TREE_OPERAND (*expr, 0);
+ dont_convert = false;
+ }
base = get_ref_base_and_extent (*expr, &offset, &size, &max_size);
if (!base || size == -1 || max_size == -1)
@@ -3594,13 +3626,14 @@ sra_ipa_modify_expr (tree *expr, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
fprintf (dump_file, "\n");
}
- if (!useless_type_conversion_p (TREE_TYPE (*expr), cand->type))
+ if (!dont_convert
+ && !useless_type_conversion_p (TREE_TYPE (*expr), cand->type))
{
tree vce = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr), src);
*expr = vce;
}
- else
- *expr = src;
+ else
+ *expr = src;
return true;
}
@@ -3608,20 +3641,37 @@ sra_ipa_modify_expr (tree *expr, gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED,
essentially the same function like sra_ipa_modify_expr. */
static enum scan_assign_result
-sra_ipa_modify_assign (gimple *stmt_ptr,
- gimple_stmt_iterator *gsi ATTRIBUTE_UNUSED, void *data)
+sra_ipa_modify_assign (gimple *stmt_ptr, gimple_stmt_iterator *gsi, void *data)
{
gimple stmt = *stmt_ptr;
- bool any = false;
+ tree *lhs_p, *rhs_p;
+ bool any;
if (!gimple_assign_single_p (stmt))
return SRA_SA_NONE;
- any |= sra_ipa_modify_expr (gimple_assign_rhs1_ptr (stmt), gsi, false,
- data);
- any |= sra_ipa_modify_expr (gimple_assign_lhs_ptr (stmt), gsi, true, data);
+ rhs_p = gimple_assign_rhs1_ptr (stmt);
+ lhs_p = gimple_assign_lhs_ptr (stmt);
+
+ any = sra_ipa_modify_expr (rhs_p, gsi, true, data);
+ any |= sra_ipa_modify_expr (lhs_p, gsi, true, data);
+ if (any)
+ {
+ if (!useless_type_conversion_p (TREE_TYPE (*lhs_p), TREE_TYPE (*rhs_p)))
+ {
+ location_t loc = gimple_location (stmt);
+ tree vce = fold_build1_loc (loc, VIEW_CONVERT_EXPR,
+ TREE_TYPE (*lhs_p), *rhs_p);
+ tree tmp = force_gimple_operand_gsi (gsi, vce, true, NULL_TREE,
+ true, GSI_SAME_STMT);
+
+ gimple_assign_set_rhs_from_tree (gsi, tmp);
+ }
+
+ return SRA_SA_PROCESSED;
+ }
- return any ? SRA_SA_PROCESSED : SRA_SA_NONE;
+ return SRA_SA_NONE;
}
/* Call gimple_debug_bind_reset_value on all debug statements describing