summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.MELT3
-rw-r--r--gcc/ChangeLog371
-rw-r--r--gcc/DATESTAMP2
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/ada/ChangeLog13
-rw-r--r--gcc/ada/gcc-interface/decl.c51
-rw-r--r--gcc/ada/gnat_rm.texi17
-rw-r--r--gcc/ada/sem_prag.adb17
-rw-r--r--gcc/bitmap.c2
-rw-r--r--gcc/c-common.c15
-rw-r--r--gcc/c-common.h9
-rw-r--r--gcc/c-decl.c20
-rw-r--r--gcc/c-parser.c53
-rw-r--r--gcc/c-pch.c7
-rw-r--r--gcc/c-typeck.c38
-rw-r--r--gcc/collect2.c3
-rw-r--r--gcc/config.gcc4
-rw-r--r--gcc/config/i386/i386.c92
-rw-r--r--gcc/config/i386/i386.md170
-rw-r--r--gcc/config/i386/ia32intrin.h230
-rw-r--r--gcc/config/i386/x86intrin.h2
-rw-r--r--gcc/config/rs6000/aix.h2
-rw-r--r--gcc/config/rs6000/constraints.md4
-rw-r--r--gcc/config/rs6000/dfp.md136
-rw-r--r--gcc/config/rs6000/ppu_intrinsics.h42
-rw-r--r--gcc/config/rs6000/rs6000.c8
-rw-r--r--gcc/config/rs6000/rs6000.md276
-rw-r--r--gcc/convert.c31
-rw-r--r--gcc/cp/ChangeLog55
-rw-r--r--gcc/cp/Make-lang.in5
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h12
-rw-r--r--gcc/cp/cvt.c4
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/cp/g++spec.c18
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/cp/name-lookup.c9
-rw-r--r--gcc/cp/parser.c48
-rw-r--r--gcc/cp/pt.c40
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/typeck.c14
-rw-r--r--gcc/dbxout.c7
-rw-r--r--gcc/debug.c9
-rw-r--r--gcc/debug.h8
-rw-r--r--gcc/defaults.h10
-rw-r--r--gcc/df-problems.c4
-rw-r--r--gcc/doc/install.texi22
-rw-r--r--gcc/doc/md.texi5
-rw-r--r--gcc/doc/plugins.texi34
-rw-r--r--gcc/dwarf2out.c17
-rw-r--r--gcc/expr.c27
-rw-r--r--gcc/final.c37
-rw-r--r--gcc/fortran/ChangeLog11
-rw-r--r--gcc/fortran/decl.c30
-rw-r--r--gcc/fortran/resolve.c2
-rw-r--r--gcc/fortran/symbol.c2
-rw-r--r--gcc/gimple.c4
-rw-r--r--gcc/gimple.h1
-rw-r--r--gcc/haifa-sched.c4
-rw-r--r--gcc/ira-build.c3
-rw-r--r--gcc/jump.c2
-rw-r--r--gcc/plugin.c5
-rw-r--r--gcc/profile.c13
-rw-r--r--gcc/reorg.c119
-rw-r--r--gcc/resource.c36
-rw-r--r--gcc/resource.h7
-rw-r--r--gcc/sdbout.c5
-rw-r--r--gcc/sel-sched.c2
-rw-r--r--gcc/testsuite/ChangeLog131
-rw-r--r--gcc/testsuite/g++.dg/other/pr40446.C46
-rw-r--r--gcc/testsuite/g++.dg/torture/pr40460.C9
-rw-r--r--gcc/testsuite/g++.dg/warn/skip-1.C17
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/bitfld-5.c35
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr40404.c12
-rw-r--r--gcc/testsuite/gcc.dg/Wcxx-compat-14.c6
-rw-r--r--gcc/testsuite/gcc.dg/builtin-unreachable-3.c9
-rw-r--r--gcc/testsuite/gcc.dg/builtins-65.c39
-rw-r--r--gcc/testsuite/gcc.dg/func-ptr-conv-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/plugin/one_time-test-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/plugin/one_time_plugin.c60
-rw-r--r--gcc/testsuite/gcc.dg/plugin/plugin.exp1
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c37
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c38
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c42
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-27.c25
-rw-r--r--gcc/testsuite/gcc.target/i386/builtin-unreachable.c13
-rw-r--r--gcc/testsuite/gfortran.dg/proc_ptr_result_4.f9016
-rw-r--r--gcc/toplev.c18
-rw-r--r--gcc/toplev.h12
-rw-r--r--gcc/tree-chrec.c10
-rw-r--r--gcc/tree-chrec.h3
-rw-r--r--gcc/tree-pretty-print.c40
-rw-r--r--gcc/tree-ssa-alias.c76
-rw-r--r--gcc/tree-ssa-alias.h21
-rw-r--r--gcc/tree-ssa-sccvn.c2
-rw-r--r--gcc/tree-ssa-structalias.c83
-rw-r--r--gcc/tree-ssa.c12
-rw-r--r--gcc/tree.c73
-rw-r--r--gcc/tree.h32
-rw-r--r--gcc/vec.c2
-rw-r--r--gcc/vec.h18
-rw-r--r--gcc/vmsdbgout.c10
-rw-r--r--gcc/xcoffout.c3
-rw-r--r--gcc/xcoffout.h2
-rw-r--r--libcpp/ChangeLog4
-rw-r--r--libcpp/include/cpplib.h3
-rw-r--r--libffi/ChangeLog18
-rwxr-xr-xlibffi/configure27
-rw-r--r--libffi/configure.ac2
-rw-r--r--libffi/src/powerpc/ffi.c13
-rw-r--r--libffi/src/powerpc/sysv.S35
-rw-r--r--libffi/testsuite/lib/libffi-dg.exp7
-rw-r--r--libiberty/ChangeLog6
-rw-r--r--libiberty/testsuite/test-demangle.c10
-rw-r--r--libjava/classpath/ChangeLog.gcj10
-rw-r--r--libjava/classpath/tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.classbin80179 -> 79930 bytes
-rw-r--r--libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.classbin29564 -> 29338 bytes
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java15
-rw-r--r--libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java11
-rw-r--r--libstdc++-v3/ChangeLog75
-rw-r--r--libstdc++-v3/include/std/thread4
-rw-r--r--libstdc++-v3/libsupc++/exception_ptr.h12
-rw-r--r--libstdc++-v3/python/hook.in59
-rw-r--r--libstdc++-v3/testsuite/18_support/exception_ptr/move.cc45
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/1.cc45
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/1.h61
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc64
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h79
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/1.cc49
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/1.h63
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/2.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/2.h77
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/3.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/3.h48
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/4.cc45
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/4.h61
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/5.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/5.h51
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/6.cc48
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/6.h64
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/7.cc49
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/7.h65
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/8.cc35
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/8.h51
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/9.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/9.h59
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h78
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/init-list.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/init-list.h65
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc97
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1.h113
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc70
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/2.h86
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc102
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/3.h118
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc78
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h90
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc41
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h58
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc109
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h127
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc138
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h156
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/moveable.cc25
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/moveable.h41
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/1.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/1.h68
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/2.cc38
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/2.h54
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/3.cc52
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/3.h68
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/4.cc75
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/4.h92
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/5.cc116
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/5.h134
177 files changed, 4711 insertions, 2514 deletions
diff --git a/ChangeLog.MELT b/ChangeLog.MELT
index 4adc61e75e0..2f6a4ffa574 100644
--- a/ChangeLog.MELT
+++ b/ChangeLog.MELT
@@ -1,4 +1,7 @@
+2009-06-18 Basile Starynkevitch <basile@starynkevitch.net>
+ MELT branch merged with trunk r148653
+
2009-06-16 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r148523
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 32e21733709..01d2a0d8b54 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,312 @@
+2009-06-18 Uros Bizjak <ubizjak@gmail.com>
+
+ * convert.c (convert_to_integer): Convert (int)logb() into ilogb().
+
+2009-06-17 Olivier Hainque <hainque@adacore.com>
+
+ * collect2.c (main): Use CONST_CAST2 to perform char ** to
+ const char ** conversion in AIX specific section.
+
+2009-06-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/i386/i386.c (ix86_special_builtin_type): Remove
+ UINT64_FTYPE_PINT. Add UINT64_FTYPE_PUNSIGNED.
+ (bdesc_special_args): Updated.
+ (ix86_init_mmx_sse_builtins): Likewise.
+ (ix86_expand_special_args_builtin): Likewise.
+
+2009-06-17 Richard Henderson <rth@redhat.com>
+
+ * tree-pretty-print.c (maybe_dump_asm_name): New.
+ (dump_decl_name): Use it.
+ (PRINT_FUNCTION_NAME): Merge into...
+ (dump_function_name): ... here. Use maybe_dump_asm_name.
+
+2009-06-17 Cary Coutant <ccoutant@google.com>
+
+ * dbxout.c (dbxout_source_line): Add is_stmt parameter.
+ Change caller.
+ * debug.c (struct gcc_debug_hooks): Change placeholder for
+ source_line hook.
+ (debug_nothing_int_charstar_int): Replaced by...
+ (debug_nothing_int_charstar_int_bool): ...this.
+ * debug.h (struct gcc_debug_hooks): Add is_stmt parameter to
+ source_line prototype.
+ (debug_nothing_int_charstar_int): Replaced by...
+ (debug_nothing_int_charstar_int_bool): ...this.
+ * defaults.h (SUPPORTS_DISCRIMINATOR): New constant.
+ * dwarf2out.c (dwarf2out_source_line): Add is_stmt parameter.
+ Output is_stmt operand when necessary.
+ * final.c (final_scan_insn): Pass is_stmt to source_line debug hook.
+ (notice_source_line): Add is_stmt parameter.
+ * sdbout.c (sdbout_source_line): Add is_stmt parameter.
+ * vmsdbgout.c (vmsdbgout_source_line): Add is_stmt parameter.
+ Change callers.
+ * xcoffout.c (xcoffout_source_line): Add is_stmt parameter.
+ * xcoffout.h (xcoffout_source_line): Add is_stmt parameter.
+
+2009-06-17 Ian Lance Taylor <iant@google.com>
+
+ * expr.c (struct move_by_pieces_d): Rename from move_by_pieces.
+ Change all uses.
+ (struct store_by_pieces_d): Rename from store_by_pieces. Change
+ call uses.
+
+2009-06-17 Adam Nemet <anemet@caviumnetworks.com>
+
+ * tree.h (STRIP_NOPS, STRIP_SIGN_NOPS,
+ STRIP_USELESS_TYPE_CONVERSION): Use tree_strip_nop_conversions,
+ tree_strip_sign_nop_conversions and
+ tree_ssa_strip_useless_type_conversions rather than stripping
+ the operations here.
+ (tree_strip_nop_conversions, tree_strip_sign_nop_conversions):
+ Declare them.
+ * gimple.h (tree_ssa_strip_useless_type_conversions): Declare it.
+ * tree-ssa.c (tree_ssa_strip_useless_type_conversions): New function.
+ * tree.c (tree_nop_conversion, tree_sign_nop_conversion,
+ tree_strip_nop_conversions, tree_strip_sign_nop_conversions): New
+ functions.
+
+2009-06-17 Michael Eager <eager@eagercon.com>
+
+ * config/rs6000/constraints.md (register_constraint "d"): New.
+ * config/rs6000/dfp.md (movsd_store, extendsddd2, extendsdtd2,
+ truncddsd2, *negdd2_fpr, *absdd2_fpr, *nabsdd2_fpr,
+ *movdd_hardfloat32, *movdd_hardfloat64_mfpgpr, *movdd_hardfloat64,
+ *negtd2_fp, *abstd2_fpr, *nabstd2_fpr, *movtd_internal, extendddtd2,
+ trunctddd2, adddd3, addtd3, subdd3, subtd3, muldd3, multd3, divdd3,
+ divtd3, *cmpdd_internal1, *cmptd_internal1, floatditd2, ftruncdd2,
+ fixdddi2, ftrunctd2, fixtddi2): replace 'f' constraint with 'd'
+ * config/rs6000/ppu_intrinsics.h (__mffs, __mtfsf, __mtfsfi, __fabs,
+ __fnabs, __fmadd, __fmsub, __fnmadd, __fnmsub, __fsel, __frsqrte,
+ __fsqrt, __fmul, __fmuls, __frsp, __fcfid, __fctid, __fctidz, __fctiw,
+ __fctiwz): Same.
+ * config/rs6000/rs6000.md (*extendsfdf2_fpr, *truncdfsf2_fpr,
+ *fseldfsf4, *negdf2_fpr, *absdf2_fpr, *nabsdf2_fpr, *adddf3_fpr,
+ *subdf3_fpr, *muldf3_fpr, *divdf3_fpr, recipdf3, fred, sqrtdf2,
+ *fseldfdf4, *fselsfdf4, *floatsidf2_internal, *floatunssidf2_internal,
+ *fix_truncdfsi2_internal, fix_truncdfsi2_internal_gfxopt,
+ fix_truncdfsi2_mfpgpr, fctiwz, btruncdf2, ceildf2, floordf2, rounddf2,
+ stfiwx, floatdidf2, fix_truncdfdi2, floatdisf2_internal1,
+ *movdf_hardfloat32, *movdf_hardfloat64_mfpgpr, *movdf_hardfloat64,
+ *movtf_internal, *extenddftf2_internal, trunctfdf2_internal1,
+ trunctfdf2_internal2, trunctfsf2_fprs, fix_trunc_helper,
+ *fix_trunctfsi2_internal, negtf2_internal, *movdi_internal32,
+ *movdi_mfpgpr, *movdi_internal64, *movdf_update1, *movdf_update2,
+ *cmpdf_internal1, *cmptf_internal1, *cmptf_internal2): Same.
+ * doc/md.texi: Describe PowerPC 'd' constraint, update 'f' constraint.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * profile.c (total_num_never_executed): Don't define.
+ (compute_branch_probabilities): Don't count or print
+ num_never_executed.
+ (init_branch_prob): Don't set total_num_never_executed.
+ (end_branch_prob): Don't print total_num_never_executed.
+
+2009-06-17 David Daney <ddaney@caviumnetworks.com>
+
+ * jump.c (cleanup_barriers): Handle case of no insns before a barrier.
+
+2009-06-17 David Edelsohn <edelsohn@gnu.org>
+
+ * config/rs6000/dfp.md (nabsdd2_fpr): Correct mode.
+ (nabstd2_fpr): Same.
+
+2009-06-17 Steve Ellcey <sje@cup.hp.com>
+
+ * expr.c (expand_assignment): Change complex type check.
+
+2009-06-17 Basile Starynkevitch <basile@starynkevitch.net>
+
+ * doc/plugins.texi (Building GCC plugins): Added new section.
+
+2009-06-17 Ian Lance Taylor <iant@google.com>
+
+ * c-pch.c (get_ident): Don't set size of templ array.
+ (pch_init): Don't set size of partial_pch array.
+
+ * c-typeck.c (digest_init): If -Wc++-compat, warn about using a
+ string constant to intialize an array whose size is the length of
+ the string.
+
+2009-06-17 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/40389
+ * tree-ssa-structalias.c (handle_rhs_call): Restrict NRV case
+ to addressable types.
+ * gimple.c (walk_stmt_load_store_addr_ops): Likewise.
+
+2009-06-17 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40460
+ * tree-chrec.h (build_polynomial_chrec): If we cannot determine
+ if there is no evolution of left in the loop bail out.
+ * tree-chrec.c (chrec_fold_multiply_poly_poly): CSE one
+ chrec_fold_multiply.
+
+2009-06-16 J"orn Rennecke <joern.rennecke@arc.com>
+ Janis Johnson <janis187@us.ibm.com>
+
+ PR target/39254
+ * config/rs6000/rs6000.c (rs6000_emit_move): Don't emit a USE
+ for the symbol ref of a constant that is the source of a move
+ - nor for any other not-obvious-label-ref constants.
+
+2009-06-16 Olatunji Ruwase <tjruwase@google.com>
+
+ * plugin.c (position_pass): Skip newly inserted pass during list
+ traversal to avoid repeated insertion.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * vec.h (VEC_stack_alloc): Define different version if
+ GATHER_STATISTICS is defined, to accept and ignore MEM_STAT.
+ (DEF_VEC_ALLOC_FUNC_P_STACK): Remove MEM_STAT_DECL.
+ (DEF_VEC_ALLOC_FUNC_O_STACK): Likewise.
+ (DEF_VEC_ALLOC_FUNC_I_STACK): Likewise.
+
+2009-06-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config.gcc (extra_headers): Add ia32intrin.h for x86.
+
+ * config/i386/i386.c (ix86_builtins): Add IX86_BUILTIN_BSRSI,
+ IX86_BUILTIN_BSRDI. IX86_BUILTIN_RDPMC, IX86_BUILTIN_RDTSC.
+ IX86_BUILTIN_RDTSCP. IX86_BUILTIN_ROLQI, IX86_BUILTIN_ROLHI,
+ IX86_BUILTIN_RORQI and IX86_BUILTIN_RORHI.
+ (ix86_special_builtin_type): Add UINT64_FTYPE_VOID,
+ UINT64_FTYPE_PINT, INT_FTYPE_INT, UINT64_FTYPE_INT,
+ INT64_FTYPE_INT64, UINT16_FTYPE_UINT16_INT and UINT8_FTYPE_UINT8_INT.
+ (bdesc_special_args): Add __builtin_ia32_rdtsc and
+ __builtin_ia32_rdtscp.
+ (bdesc_args): Add __builtin_ia32_bsrsi, __builtin_ia32_bsrdi,
+ __builtin_ia32_rolqi, __builtin_ia32_rolhi, __builtin_ia32_rorqi
+ and __builtin_ia32_rorhi.
+ (ix86_init_mmx_sse_builtins): Handle UINT64_FTYPE_VOID,
+ UINT64_FTYPE_PINT, INT_FTYPE_INT, UINT64_FTYPE_INT,
+ INT64_FTYPE_INT64, UINT16_FTYPE_UINT16_INT and UINT8_FTYPE_UINT8_INT.
+ (ix86_expand_args_builtin): Likewise.
+ (ix86_expand_special_args_builtin): Likewise.
+
+ * config/i386/i386.md (UNSPECV_RDTSCP): New.
+ (UNSPECV_RDTSC): Likewise.
+ (UNSPECV_RDPMC): Likewise.
+ (*bsr): Renamed to ...
+ (bsr): This
+ (*bsr_rex64): Renamed to ...
+ (bsr_rex64): This.
+ (rdpmc): New.
+ (*rdpmc): Likewise.
+ (*rdpmc_rex64): Likewise.
+ (rdtsc): Likewise.
+ (*rdtsc): Likewise.
+ (*rdtsc_rex64): Likewise.
+ (rdtscp): Likewise.
+ (*rdtscp): Likewise.
+ (*rdtscp_rex64): Likewise.
+
+ * config/i386/ia32intrin.h: New.
+
+ * config/i386/x86intrin.h: Include <ia32intrin.h>.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * ira-build.c (copy_info_to_removed_store_destinations):
+ Initialize parent_a.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * c-decl.c (grokdeclarator): Change size_varies to bool.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * sel-sched.c: Make forward declarations of move_op_hooks and
+ fur_hooks explicitly extern.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * df-problems.c (df_byte_lr_alloc): Don't set problem_data to itself.
+ * vec.c (vec_gc_o_reserve_1): Don't set alloc to itself.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * resource.c (mark_referenced_resources): Change
+ include_delayed_effects parameter to bool. Change all callers.
+ (mark_end_of_function_resources): Likewise.
+ * reorg.c (insn_references_resource_p): Likewise.
+ (insn_sets_resource_p): Likewise.
+ * resource.h (mark_referenced_resources): Update declaration.
+ (mark_end_of_function_resources): Update declaration.
+
+2009-06-16 David Edelsohn <edelsohn@gnu.org>
+
+ * config/rs6000/aix.h (LIBSTDCXX_STATIC): Remove -lstdc++.
+
+2009-06-16 David Edelsohn <edelsohn@gnu.org>
+
+ * doc/install.texi (*-*-aix): Update explanation of XLC bootstrap.
+ GCC can bootstrap on AIX with GNU Binutils 2.20.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * Makefile.in (tree-vect-stmts.o): Depend upon $(TOPLEV_H).
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * toplev.h (floor_log2): If GCC_VERSION >= 3004, declare as static
+ inline, not extern inline.
+ (exact_log2): Likewise.
+ * toplev.c (floor_log2): Only define if GCC_VERSION < 3004. Don't
+ test CLZ_HWI.
+ (exact_log2): Likewise, but don't test CTZ_HWI.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * bitmap.c (bitmap_clear): Don't declare as inline.
+ * gimple.c (gimplify_assign): Likewise.
+ * tree-ssa-sccvn.c (vn_nary_op_compute_hash): Likewise.
+ * haifa-sched.c (insn_cost): Don't declare with HAIFA_INLINE.
+ (sched_scan_info): Remove duplicate definition.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * c-common.c (skip_evaluation): Don't define.
+ (c_inhibit_evaluation_warnings): Define global variable.
+ (overflow_warning): Check c_inhibit_evaluation_warnings rather
+ than skip_evaluation.
+ (convert_and_check, warn_for_div_by_zero): Likewise.
+ * c-common.h (skip_evaluation): Don't declare.
+ (c_inhibit_evaluation_warnings): Declare.
+ * c-parser.c (c_parser_typeof_specifier): Set
+ c_inhibit_evaluation_warnings rather than skip_evaluation.
+ (c_parser_conditional_expression): Likewise.
+ (c_parser_binary_expression): Likewise.
+ (c_parser_sizeof_expression): Likewise.
+ (c_parser_alignof_expression): Likewise.
+ * c-typeck.c (build_indirect_ref): Check
+ c_inhibit_evaluation_warnings rather than skip_evaluation.
+ (build_conditional_expr, build_binary_op): Likewise.
+
+2009-06-16 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-alias.c (is_escape_site): Remove.
+ * tree-ssa-alias.h (enum escape_type): Remove.
+ (is_escape_site): Likewise.
+ * tree-ssa-structalias.c (find_func_aliases): Handle escapes
+ via casts and asms without deferring to is_escape_site.
+
+2009-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/40446
+ * expr.c (expand_expr_real_1) <case VIEW_CONVERT_EXPR>: Don't
+ use gen_lowpart if op0 has complex mode.
+
+2009-06-16 Richard Guenther <rguenther@suse.de>
+
+ * tree-ssa-structalias.c (do_ds_constraint): Stores in global
+ variables add them to ESCAPED.
+ (find_func_aliases): Do not make all indirectly stored values escaped.
+
2009-06-16 Rafael Avila de Espindola <espindola@google.com>
* config/i386/winnt.c (i386_pe_encode_section_info): Update call to
@@ -20,7 +329,7 @@
* tree-parloops.c (loop_parallel_p): Call vect_is_simple_reduction
with additional parameter.
- * tree-vectorizer.h (enum vect_def_type): Add new value
+ * tree-vectorizer.h (enum vect_def_type): Add new value
vect_nested_cycle.
(enum vect_relevant): Add comments.
(vect_is_simple_reduction): Add new argument.
@@ -34,13 +343,13 @@
(vect_create_epilog_for_reduction): Add new argument to specify
reduction variable.
(vect_finalize_reduction): Handle subtraction, fix comments.
- (vectorizable_reduction): Handle nested cycles. In case of nested cycle
- keep track of the reduction variable position. Call
+ (vectorizable_reduction): Handle nested cycles. In case of nested
+ cycle keep track of the reduction variable position. Call
vect_is_simple_reduction with additional parameter. Use original
statement code in reduction epilogue for nested cycle. Call
vect_create_epilog_for_reduction with additional parameter.
- * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Assert inner-loop
- vectorization.
+ * tree-vect-patterns.c (vect_recog_dot_prod_pattern): Assert
+ inner-loop vectorization.
(vect_recog_widen_sum_pattern): Likewise.
* tree-vect-stmts.c (process_use): Distinguish between nested cycles
and reductions.
@@ -64,8 +373,7 @@
* doc/plugins.texi (Interacting with the GCC Garbage Collector):
Mention the plugin mode of gengtype.
- * doc/gty.texi (Source Files Containing Type Information):
- Likewise.
+ * doc/gty.texi (Source Files Containing Type Information): Likewise.
* gengtype.c: Updated copyright.
(plugin_files, nb_plugin_files) Added new static variables.
(measure_input_list) Care about plugin_files.
@@ -83,8 +391,7 @@
2009-06-15 Ian Lance Taylor <iant@google.com>
- * df-problems.c (df_simulate_one_insn_forwards): Fix braces in
- switch.
+ * df-problems.c (df_simulate_one_insn_forwards): Fix braces in switch.
* gcov.c (read_count_file): Add braces around variables declared
before label.
@@ -190,7 +497,8 @@
Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
* cgraph.c (cgraph_create_virtual_clone): Use DECL_COMDAT_GROUP.
* config/i386/i386.c (ix86_file_end): Compute DECL_COMDAT_GROUP.
- * dwarf2asm.c(dw2_force_const_mem): Update call to make_decl_one_only.
+ * dwarf2asm.c (dw2_force_const_mem): Update call to
+ make_decl_one_only.
* langhooks-def.h (lhd_comdat_group, LANG_HOOKS_COMDAT_GROUP): Remove.
(LANG_HOOKS_DECLS): Remove LANG_HOOKS_COMDAT_GROUP.
* langhooks.c (lhd_comdat_group): Remove.
@@ -449,8 +757,7 @@
(c_parser_for_statement): Pass location to c_finish_expr_stmt,
and c_process_expr_stmt.
(c_parser_omp_variable_list): Add location argument.
- (c_parser_omp_clause_collapse): Pass location to
- build_omp_clause.
+ (c_parser_omp_clause_collapse): Pass location to build_omp_clause.
(c_parser_omp_clause_default): Same.
(c_parser_omp_clause_if): Same.
(c_parser_omp_clause_num_threads): Same.
@@ -460,8 +767,7 @@
(c_parser_omp_clause_schedule): Pass location to build_omp_clause.
(c_parser_omp_clause_untied): Same.
(c_parser_omp_for_loop): Pass location to c_process_expr_stmt.
- (c_parser_omp_parallel): Pass location to
- c_split_parallel_clauses.
+ (c_parser_omp_parallel): Pass location to c_split_parallel_clauses.
* c-tree.h (check_for_loop_decls, undeclared_variable,
build_component_ref, build_array_ref, build_external_ref,
@@ -618,8 +924,7 @@
2009-06-12 Ian Lance Taylor <iant@google.com>
- * fold-const.c (fold_unary): Rename local variable and to
- and_expr.
+ * fold-const.c (fold_unary): Rename local variable and to and_expr.
* c-opts.c (c_common_handle_option): For -Wc++-compat set
cpp_opts->warn_cxx_operator_names.
@@ -686,11 +991,10 @@
* config/i386/i386.h (TARGET_CRC32): New.
- * config/i386/i386.md (sse4_2_crc32<mode>): Also check
- TARGET_CRC32.
+ * config/i386/i386.md (sse4_2_crc32<mode>): Also check TARGET_CRC32.
(sse4_2_crc32di): Likewise.
- * config/i386/i386.opt (mcrc32: New.
+ * config/i386/i386.opt (mcrc32): New.
* doc/invoke.texi: Document -mcrc32.
@@ -745,8 +1049,7 @@
2009-06-11 Anthony Green <green@moxielogic.com>
- * config/moxie/moxie.md: Define length attribute for all
- instructions.
+ * config/moxie/moxie.md: Define length attribute for all instructions.
(rCC): Define.
(*b<cond:code>): Support limited branch ranges for new PC-relative
branch instructions.
@@ -793,8 +1096,7 @@
(tree_decl_common): Delete decl_flag_1 and user_align fields.
Renumber decl_flag_* fields. Fix comments. Widen
decl_common_unused field.
- (DECL_HAS_VALUE_EXPR_P): Adjust for renumbering of decl_flag_*
- fields.
+ (DECL_HAS_VALUE_EXPR_P): Adjust for renumbering of decl_flag_* fields.
(DECL_EXTERNAL): Likewise.
(DECL_BIT_FIELD): Likewise.
(DECL_NONADDRESSABLE_P): Likewise.
@@ -846,8 +1148,7 @@
(df_insn_refs_collect, df_bb_refs_collect): Likewise.
(df_bb_refs_record, df_record_entry_block_defs): Likewise.
(df_record_exit_block_uses, df_bb_verify): Likewise.
- (df_swap_refs): Change ref_vec parameter to VEC. Change all
- callers.
+ (df_swap_refs): Change ref_vec parameter to VEC. Change all callers.
(df_sort_and_compress_refs): Change ref_vec parameter to VEC.
Remove count parameter. Change return type to void. Change all
callers.
@@ -917,8 +1218,7 @@
(function_types_compatible_p, type_lists_compatible_p): Likewise.
(build_conditional_expr): Add colon_loc parameter. Change all
callers.
- (convert_for_assignment): Add location parameter. Change all
- callers.
+ (convert_for_assignment): Add location parameter. Change all callers.
* c-parser.c (c_parser_conditional_expression): Pass location of
colon to build_conditional_expr.
* c-tree.h (build_conditional_expr): Update declaration.
@@ -941,8 +1241,8 @@
2009-06-09 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/40351
- * tree-sra.c (propagate_subacesses_accross_link): Check that a refrence
- to a potential artifical subaccess can be constructed.
+ * tree-sra.c (propagate_subacesses_accross_link): Check that a
+ refrence to a potential artifical subaccess can be constructed.
2009-06-08 Kaz Kojima <kkojima@gcc.gnu.org>
@@ -970,8 +1270,8 @@
2009-06-08 Jan Hubicka <jh@suse.cz>
PR middle-end/39834
- * cgraphunit.c (save_inline_function_body): Do not copy transform hooks
- for saved inline bodies.
+ * cgraphunit.c (save_inline_function_body): Do not copy transform
+ hooks for saved inline bodies.
* ipa-passes.c (do_per_function): Do not add the hoks multiple times
for given function.
@@ -1057,8 +1357,7 @@
2009-06-07 Ian Lance Taylor <iant@google.com>
- * dwarf2.h (enum dwarf_location_atom): Add
- INTERNAL_DW_OP_tls_addr.
+ * dwarf2.h (enum dwarf_location_atom): Add INTERNAL_DW_OP_tls_addr.
* dwarf2out.c (INTERNAL_DW_OP_tls_addr): Don't #define.
* c-common.c (c_do_switch_warnings): Don't exit early for -Wswitch
@@ -1157,8 +1456,7 @@
(expand_expr_real_1): Remove comment.
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment):
Vectorize misaligned access when the target supports it.
- (vect_supportable_dr_alignment): Check for unaligned access
- support.
+ (vect_supportable_dr_alignment): Check for unaligned access support.
* tree-vect-stmts.c (vectorizable_store): Generate misaligned store
and remove asset.
@@ -1201,8 +1499,7 @@
callers.
* debug.c (do_nothing_debug_hooks): Add additional entry.
(debug_nothing_int_charstar_int): New function.
- * debug.h (struct gcc_debug_hooks): Add parameter to source_line
- hook.
+ * debug.h (struct gcc_debug_hooks): Add parameter to source_line hook.
(debug_nothing_int_charstar_int): New declaration.
* dwarf2out.c (dwarf2out_source_line): Add new parameter. Write
discriminator value in .loc directive.
diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP
index 2a86ce376d7..5a0327d9bc6 100644
--- a/gcc/DATESTAMP
+++ b/gcc/DATESTAMP
@@ -1 +1 @@
-20090616
+20090618
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 0b182008a3a..c1619938b3e 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -2454,7 +2454,7 @@ tree-vect-slp.o: tree-vect-slp.c $(CONFIG_H) $(SYSTEM_H) \
tree-vect-stmts.o: tree-vect-stmts.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) \
- $(EXPR_H) $(RECOG_H) $(OPTABS_H) tree-vectorizer.h langhooks.h
+ $(EXPR_H) $(RECOG_H) $(OPTABS_H) $(TOPLEV_H) tree-vectorizer.h langhooks.h
tree-vect-data-refs.o: tree-vect-data-refs.c $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(TARGET_H) $(BASIC_BLOCK_H) \
$(DIAGNOSTIC_H) $(TREE_FLOW_H) $(TREE_DUMP_H) $(CFGLOOP_H) \
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c22d2a76ca9..d9e6bcbd235 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,16 @@
+2009-06-16 Robert Dewar <dewar@adacore.com>
+ Olivier Hainque <hainque@adacore.com>
+
+ Relax constraints on Machine_Attribute argument types:
+ * sem_prag.adb (Check_Arg_Is_Static_Expression): Allow for
+ missing type.
+ (Analyze_Attribute, case Machine_Attribute): Allow any type for arg 3.
+ * gcc-interface/decl.c (prepend_attributes): Accept static
+ expressions of any type as attribute arguments, not only string
+ literals.
+ * gnat_rm.texi (pragma Machine_Attribute section): Adjust to reflect
+ the relaxation of the restriction on the Info argument type.
+
2009-06-13 Aldy Hernandez <aldyh@redhat.com>
* gcc-interface/utils.c (record_builtin_type): Pass location
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 63ade27c5e9..974f6f0931b 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -5568,6 +5568,8 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list)
{
Node_Id gnat_temp;
+ /* Attributes are stored as Representation Item pragmas. */
+
for (gnat_temp = First_Rep_Item (gnat_entity); Present (gnat_temp);
gnat_temp = Next_Rep_Item (gnat_temp))
if (Nkind (gnat_temp) == N_Pragma)
@@ -5576,24 +5578,8 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list)
Node_Id gnat_assoc = Pragma_Argument_Associations (gnat_temp);
enum attr_type etype;
- if (Present (gnat_assoc) && Present (First (gnat_assoc))
- && Present (Next (First (gnat_assoc)))
- && (Nkind (Expression (Next (First (gnat_assoc))))
- == N_String_Literal))
- {
- gnu_arg0 = get_identifier (TREE_STRING_POINTER
- (gnat_to_gnu
- (Expression (Next
- (First (gnat_assoc))))));
- if (Present (Next (Next (First (gnat_assoc))))
- && (Nkind (Expression (Next (Next (First (gnat_assoc)))))
- == N_String_Literal))
- gnu_arg1 = get_identifier (TREE_STRING_POINTER
- (gnat_to_gnu
- (Expression
- (Next (Next
- (First (gnat_assoc)))))));
- }
+ /* Map the kind of pragma at hand. Skip if this is not one
+ we know how to handle. */
switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_temp))))
{
@@ -5629,6 +5615,35 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list)
continue;
}
+ /* See what arguments we have and turn them into GCC trees for
+ attribute handlers. These expect identifier for strings. We
+ handle at most two arguments, static expressions only. */
+
+ if (Present (gnat_assoc) && Present (First (gnat_assoc)))
+ {
+ Node_Id gnat_arg0 = Next (First (gnat_assoc));
+ Node_Id gnat_arg1 = Empty;
+
+ if (Present (gnat_arg0)
+ && Is_Static_Expression (Expression (gnat_arg0)))
+ {
+ gnu_arg0 = gnat_to_gnu (Expression (gnat_arg0));
+
+ if (TREE_CODE (gnu_arg0) == STRING_CST)
+ gnu_arg0 = get_identifier (TREE_STRING_POINTER (gnu_arg0));
+
+ gnat_arg1 = Next (gnat_arg0);
+ }
+
+ if (Present (gnat_arg1)
+ && Is_Static_Expression (Expression (gnat_arg1)))
+ {
+ gnu_arg1 = gnat_to_gnu (Expression (gnat_arg1));
+
+ if (TREE_CODE (gnu_arg1) == STRING_CST)
+ gnu_arg1 = get_identifier (TREE_STRING_POINTER (gnu_arg1));
+ }
+ }
/* Prepend to the list now. Make a list of the argument we might
have, as GCC expects it. */
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index 2ff9c117680..ba84ee17cb7 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -3243,7 +3243,7 @@ Syntax:
pragma Machine_Attribute (
[Entity =>] LOCAL_NAME,
[Attribute_Name =>] static_string_EXPRESSION
- [, [Info =>] static_string_EXPRESSION] );
+ [, [Info =>] static_EXPRESSION] );
@end smallexample
@noindent
@@ -3252,15 +3252,12 @@ declarations. This pragma is semantically equivalent to
@code{__attribute__((@var{attribute_name}))} (if @var{info} is not
specified) or @code{__attribute__((@var{attribute_name}(@var{info})))}
in GNU C, where @code{@var{attribute_name}} is recognized by the
-target macro @code{TARGET_ATTRIBUTE_TABLE} which is defined for each
-machine. The optional parameter @var{info} is transformed into an
-identifier, which may make this pragma unusable for some attributes
-(parameter of some attributes must be a number or a string).
-@xref{Target Attributes,, Defining target-specific uses of
-@code{__attribute__}, gccint, GNU Compiler Colletion (GCC) Internals},
-further information. It is not possible to specify
-attributes defined by other languages, only attributes defined by the
-machine the code is intended to run on.
+compiler middle-end or the @code{TARGET_ATTRIBUTE_TABLE} machine
+specific macro. A string literal for the optional parameter @var{info}
+is transformed into an identifier, which may make this pragma unusable
+for some attributes. @xref{Target Attributes,, Defining target-specific
+uses of @code{__attribute__}, gccint, GNU Compiler Collection (GCC)
+Internals}, further information.
@node Pragma Main
@unnumberedsec Pragma Main
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 505fbea96fe..f69fcda99eb 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -368,11 +368,12 @@ package body Sem_Prag is
procedure Check_Arg_Is_Static_Expression
(Arg : Node_Id;
- Typ : Entity_Id);
+ Typ : Entity_Id := Empty);
-- Check the specified argument Arg to make sure that it is a static
-- expression of the given type (i.e. it will be analyzed and resolved
-- using this type, which can be any valid argument to Resolve, e.g.
- -- Any_Integer is OK). If not, given error and raise Pragma_Exit.
+ -- Any_Integer is OK). If not, given error and raise Pragma_Exit. If
+ -- Typ is left Empty, then any static expression is allowed.
procedure Check_Arg_Is_String_Literal (Arg : Node_Id);
-- Check the specified argument Arg to make sure that it is a string
@@ -966,12 +967,16 @@ package body Sem_Prag is
procedure Check_Arg_Is_Static_Expression
(Arg : Node_Id;
- Typ : Entity_Id)
+ Typ : Entity_Id := Empty)
is
Argx : constant Node_Id := Get_Pragma_Arg (Arg);
begin
- Analyze_And_Resolve (Argx, Typ);
+ if Present (Typ) then
+ Analyze_And_Resolve (Argx, Typ);
+ else
+ Analyze_And_Resolve (Argx);
+ end if;
if Is_OK_Static_Expression (Argx) then
return;
@@ -8819,7 +8824,7 @@ package body Sem_Prag is
-- pragma Machine_Attribute (
-- [Entity =>] LOCAL_NAME,
-- [Attribute_Name =>] static_string_EXPRESSION
- -- [, [Info =>] static_string_EXPRESSION] );
+ -- [, [Info =>] static_EXPRESSION] );
when Pragma_Machine_Attribute => Machine_Attribute : declare
Def_Id : Entity_Id;
@@ -8830,7 +8835,7 @@ package body Sem_Prag is
if Arg_Count = 3 then
Check_Optional_Identifier (Arg3, Name_Info);
- Check_Arg_Is_Static_Expression (Arg3, Standard_String);
+ Check_Arg_Is_Static_Expression (Arg3);
else
Check_Arg_Count (2);
end if;
diff --git a/gcc/bitmap.c b/gcc/bitmap.c
index 8e0a7241104..61a40ee352d 100644
--- a/gcc/bitmap.c
+++ b/gcc/bitmap.c
@@ -291,7 +291,7 @@ bitmap_elt_clear_from (bitmap head, bitmap_element *elt)
/* Clear a bitmap by freeing the linked list. */
-inline void
+void
bitmap_clear (bitmap head)
{
if (head->first)
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 139a5d2346f..43b2c13daed 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -442,9 +442,9 @@ tree *ridpointers;
tree (*make_fname_decl) (location_t, tree, int);
-/* Nonzero means the expression being parsed will never be evaluated.
- This is a count, since unevaluated expressions can nest. */
-int skip_evaluation;
+/* Nonzero means don't warn about problems that occur when the code is
+ executed. */
+int c_inhibit_evaluation_warnings;
/* Whether lexing has been completed, so subsequent preprocessor
errors should use the compiler's input_location. */
@@ -1507,7 +1507,8 @@ constant_expression_error (tree value)
void
overflow_warning (location_t loc, tree value)
{
- if (skip_evaluation) return;
+ if (c_inhibit_evaluation_warnings != 0)
+ return;
switch (TREE_CODE (value))
{
@@ -2225,7 +2226,9 @@ convert_and_check (tree type, tree expr)
result = convert (type, expr);
- if (!skip_evaluation && !TREE_OVERFLOW_P (expr) && result != error_mark_node)
+ if (c_inhibit_evaluation_warnings == 0
+ && !TREE_OVERFLOW_P (expr)
+ && result != error_mark_node)
warnings_for_convert_and_check (type, expr_for_warning, result);
return result;
@@ -8952,7 +8955,7 @@ warn_for_div_by_zero (location_t loc, tree divisor)
about division by zero. Do not issue a warning if DIVISOR has a
floating-point type, since we consider 0.0/0.0 a valid way of
generating a NaN. */
- if (skip_evaluation == 0
+ if (c_inhibit_evaluation_warnings == 0
&& (integer_zerop (divisor) || fixed_zerop (divisor)))
warning_at (loc, OPT_Wdiv_by_zero, "division by zero");
}
diff --git a/gcc/c-common.h b/gcc/c-common.h
index eecb1895f84..04a194597f7 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -719,10 +719,13 @@ extern int warn_strict_null_sentinel;
extern int max_tinst_depth;
-/* Nonzero means the expression being parsed will never be evaluated.
- This is a count, since unevaluated expressions can nest. */
+/* Nonzero means that we should not issue warnings about problems that
+ occur when the code is executed, because the code being processed
+ is not expected to be executed. This is set during parsing. This
+ is used for cases like sizeof() and "0 ? a : b". This is a count,
+ not a bool, because unexecuted expressions can nest. */
-extern int skip_evaluation;
+extern int c_inhibit_evaluation_warnings;
/* Whether lexing has been completed, so subsequent preprocessor
errors should use the compiler's input_location. */
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index c2c2a890c9d..4e48bac7f54 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -4713,7 +4713,7 @@ grokdeclarator (const struct c_declarator *declarator,
tree name = NULL_TREE;
bool funcdef_flag = false;
bool funcdef_syntax = false;
- int size_varies = 0;
+ bool size_varies = false;
tree decl_attr = declspecs->decl_attr;
int array_ptr_quals = TYPE_UNQUALIFIED;
tree array_ptr_attrs = NULL_TREE;
@@ -4807,7 +4807,7 @@ grokdeclarator (const struct c_declarator *declarator,
type = integer_type_node;
}
- size_varies = C_TYPE_VARIABLE_SIZE (type);
+ size_varies = C_TYPE_VARIABLE_SIZE (type) != 0;
/* Diagnose defaulting to "int". */
@@ -5140,7 +5140,7 @@ grokdeclarator (const struct c_declarator *declarator,
"variably modified %qE at file scope",
name);
else
- this_size_varies = size_varies = 1;
+ this_size_varies = size_varies = true;
warn_variable_length_array (name, size);
}
}
@@ -5155,7 +5155,7 @@ grokdeclarator (const struct c_declarator *declarator,
/* Make sure the array size remains visibly
nonconstant even if it is (eg) a const variable
with known value. */
- this_size_varies = size_varies = 1;
+ this_size_varies = size_varies = true;
warn_variable_length_array (name, size);
}
@@ -5227,7 +5227,7 @@ grokdeclarator (const struct c_declarator *declarator,
the field variably modified, not through being
something other than a declaration with function
prototype scope. */
- size_varies = 1;
+ size_varies = true;
else
{
const struct c_declarator *t = declarator;
@@ -5251,7 +5251,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (array_parm_vla_unspec_p)
{
itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
- size_varies = 1;
+ size_varies = true;
}
}
else if (decl_context == TYPENAME)
@@ -5265,7 +5265,7 @@ grokdeclarator (const struct c_declarator *declarator,
otherwise be modified below. */
itype = build_range_type (sizetype, size_zero_node,
NULL_TREE);
- size_varies = 1;
+ size_varies = true;
}
}
@@ -5349,7 +5349,7 @@ grokdeclarator (const struct c_declarator *declarator,
if (type == error_mark_node)
continue;
- size_varies = 0;
+ size_varies = false;
/* Warn about some types functions can't return. */
if (TREE_CODE (type) == FUNCTION_TYPE)
@@ -5434,7 +5434,7 @@ grokdeclarator (const struct c_declarator *declarator,
"ISO C forbids qualified function types");
if (type_quals)
type = c_build_qualified_type (type, type_quals);
- size_varies = 0;
+ size_varies = false;
/* When the pointed-to type involves components of variable size,
care must be taken to ensure that the size evaluation code is
@@ -5620,7 +5620,7 @@ grokdeclarator (const struct c_declarator *declarator,
warning_at (loc, OPT_Wattributes,
"attributes in parameter array declarator ignored");
- size_varies = 0;
+ size_varies = false;
}
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index 6c7b8308b28..2b78c3042fa 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -2102,18 +2102,18 @@ c_parser_typeof_specifier (c_parser *parser)
ret.expr_const_operands = true;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_TYPEOF));
c_parser_consume_token (parser);
- skip_evaluation++;
+ c_inhibit_evaluation_warnings++;
in_typeof++;
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_typeof--;
return ret;
}
if (c_parser_next_token_starts_typename (parser))
{
struct c_type_name *type = c_parser_type_name (parser);
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_typeof--;
if (type != NULL)
{
@@ -2126,7 +2126,7 @@ c_parser_typeof_specifier (c_parser *parser)
bool was_vm;
location_t here = c_parser_peek_token (parser)->location;
struct c_expr expr = c_parser_expression (parser);
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_typeof--;
if (TREE_CODE (expr.value) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1)))
@@ -4568,23 +4568,24 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
exp1.value = build1 (EXCESS_PRECISION_EXPR, eptype, exp1.value);
exp1.original_type = NULL;
cond.value = c_objc_common_truthvalue_conversion (cond_loc, exp1.value);
- skip_evaluation += cond.value == truthvalue_true_node;
+ c_inhibit_evaluation_warnings += cond.value == truthvalue_true_node;
}
else
{
cond.value
= c_objc_common_truthvalue_conversion
(cond_loc, default_conversion (cond.value));
- skip_evaluation += cond.value == truthvalue_false_node;
+ c_inhibit_evaluation_warnings += cond.value == truthvalue_false_node;
exp1 = c_parser_expression_conv (parser);
- skip_evaluation += ((cond.value == truthvalue_true_node)
- - (cond.value == truthvalue_false_node));
+ c_inhibit_evaluation_warnings +=
+ ((cond.value == truthvalue_true_node)
+ - (cond.value == truthvalue_false_node));
}
colon_loc = c_parser_peek_token (parser)->location;
if (!c_parser_require (parser, CPP_COLON, "expected %<:%>"))
{
- skip_evaluation -= cond.value == truthvalue_true_node;
+ c_inhibit_evaluation_warnings -= cond.value == truthvalue_true_node;
ret.value = error_mark_node;
ret.original_code = ERROR_MARK;
ret.original_type = NULL;
@@ -4595,7 +4596,7 @@ c_parser_conditional_expression (c_parser *parser, struct c_expr *after)
exp2 = c_parser_conditional_expression (parser, NULL);
exp2 = default_function_array_conversion (exp2_loc, exp2);
}
- skip_evaluation -= cond.value == truthvalue_true_node;
+ c_inhibit_evaluation_warnings -= cond.value == truthvalue_true_node;
ret.value = build_conditional_expr (colon_loc, cond.value,
cond.original_code == C_MAYBE_CONST_EXPR,
exp1.value, exp2.value);
@@ -4696,8 +4697,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after)
the stack has lower precedence than the new operator or there is
only one element on the stack; then the top expression is the LHS
of the new operator. In the case of logical AND and OR
- expressions, we also need to adjust skip_evaluation as
- appropriate when the operators are pushed and popped. */
+ expressions, we also need to adjust c_inhibit_evaluation_warnings
+ as appropriate when the operators are pushed and popped. */
/* The precedence levels, where 0 is a dummy lowest level used for
the bottom of the stack. */
@@ -4734,10 +4735,12 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after)
switch (stack[sp].op) \
{ \
case TRUTH_ANDIF_EXPR: \
- skip_evaluation -= stack[sp - 1].expr.value == truthvalue_false_node; \
+ c_inhibit_evaluation_warnings -= (stack[sp - 1].expr.value \
+ == truthvalue_false_node); \
break; \
case TRUTH_ORIF_EXPR: \
- skip_evaluation -= stack[sp - 1].expr.value == truthvalue_true_node; \
+ c_inhibit_evaluation_warnings -= (stack[sp - 1].expr.value \
+ == truthvalue_true_node); \
break; \
default: \
break; \
@@ -4855,7 +4858,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after)
stack[sp].expr);
stack[sp].expr.value = c_objc_common_truthvalue_conversion
(stack[sp].loc, default_conversion (stack[sp].expr.value));
- skip_evaluation += stack[sp].expr.value == truthvalue_false_node;
+ c_inhibit_evaluation_warnings += (stack[sp].expr.value
+ == truthvalue_false_node);
break;
case TRUTH_ORIF_EXPR:
stack[sp].expr
@@ -4863,7 +4867,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after)
stack[sp].expr);
stack[sp].expr.value = c_objc_common_truthvalue_conversion
(stack[sp].loc, default_conversion (stack[sp].expr.value));
- skip_evaluation += stack[sp].expr.value == truthvalue_true_node;
+ c_inhibit_evaluation_warnings += (stack[sp].expr.value
+ == truthvalue_true_node);
break;
default:
break;
@@ -5086,7 +5091,7 @@ c_parser_sizeof_expression (c_parser *parser)
location_t expr_loc;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_SIZEOF));
c_parser_consume_token (parser);
- skip_evaluation++;
+ c_inhibit_evaluation_warnings++;
in_sizeof++;
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)
&& c_token_starts_typename (c_parser_peek_2nd_token (parser)))
@@ -5101,7 +5106,7 @@ c_parser_sizeof_expression (c_parser *parser)
if (type_name == NULL)
{
struct c_expr ret;
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_sizeof--;
ret.value = error_mark_node;
ret.original_code = ERROR_MARK;
@@ -5116,7 +5121,7 @@ c_parser_sizeof_expression (c_parser *parser)
goto sizeof_expr;
}
/* sizeof ( type-name ). */
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_sizeof--;
return c_expr_sizeof_type (expr_loc, type_name);
}
@@ -5125,7 +5130,7 @@ c_parser_sizeof_expression (c_parser *parser)
expr_loc = c_parser_peek_token (parser)->location;
expr = c_parser_unary_expression (parser);
sizeof_expr:
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_sizeof--;
if (TREE_CODE (expr.value) == COMPONENT_REF
&& DECL_C_BIT_FIELD (TREE_OPERAND (expr.value, 1)))
@@ -5143,7 +5148,7 @@ c_parser_alignof_expression (c_parser *parser)
location_t loc = c_parser_peek_token (parser)->location;
gcc_assert (c_parser_next_token_is_keyword (parser, RID_ALIGNOF));
c_parser_consume_token (parser);
- skip_evaluation++;
+ c_inhibit_evaluation_warnings++;
in_alignof++;
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN)
&& c_token_starts_typename (c_parser_peek_2nd_token (parser)))
@@ -5160,7 +5165,7 @@ c_parser_alignof_expression (c_parser *parser)
if (type_name == NULL)
{
struct c_expr ret;
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_alignof--;
ret.value = error_mark_node;
ret.original_code = ERROR_MARK;
@@ -5175,7 +5180,7 @@ c_parser_alignof_expression (c_parser *parser)
goto alignof_expr;
}
/* alignof ( type-name ). */
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_alignof--;
ret.value = c_alignof (loc, groktypename (type_name, NULL, NULL));
ret.original_code = ERROR_MARK;
@@ -5187,7 +5192,7 @@ c_parser_alignof_expression (c_parser *parser)
struct c_expr ret;
expr = c_parser_unary_expression (parser);
alignof_expr:
- skip_evaluation--;
+ c_inhibit_evaluation_warnings--;
in_alignof--;
ret.value = c_alignof_expr (loc, expr.value);
ret.original_code = ERROR_MARK;
diff --git a/gcc/c-pch.c b/gcc/c-pch.c
index b4f70506e40..abdf4ab4677 100644
--- a/gcc/c-pch.c
+++ b/gcc/c-pch.c
@@ -1,5 +1,6 @@
/* Precompiled header implementation for the C languages.
- Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -92,7 +93,7 @@ static const char *
get_ident (void)
{
static char result[IDENT_LENGTH];
- static const char templ[IDENT_LENGTH] = "gpch.013";
+ static const char templ[] = "gpch.013";
static const char c_language_chars[] = "Co+O";
memcpy (result, templ, IDENT_LENGTH);
@@ -112,7 +113,7 @@ pch_init (void)
FILE *f;
struct c_pch_validity v;
void *target_validity;
- static const char partial_pch[IDENT_LENGTH] = "gpcWrite";
+ static const char partial_pch[] = "gpcWrite";
#ifdef ASM_COMMENT_START
if (flag_verbose_asm)
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 0dd97d31983..0a40a888d53 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2079,7 +2079,7 @@ build_indirect_ref (location_t loc, tree ptr, const char *errorstring)
error_at (loc, "dereferencing pointer to incomplete type");
return error_mark_node;
}
- if (VOID_TYPE_P (t) && skip_evaluation == 0)
+ if (VOID_TYPE_P (t) && c_inhibit_evaluation_warnings == 0)
warning_at (loc, 0, "dereferencing %<void *%> pointer");
/* We *must* set TREE_READONLY when dereferencing a pointer to const,
@@ -3864,7 +3864,7 @@ build_conditional_expr (location_t colon_loc, tree ifexp, bool ifexp_bcp,
and later code won't know it used to be different.
Do this check on the original types, so that explicit casts
will be considered, but default promotions won't. */
- if (!skip_evaluation)
+ if (c_inhibit_evaluation_warnings == 0)
{
int unsigned_op1 = TYPE_UNSIGNED (TREE_TYPE (orig_op1));
int unsigned_op2 = TYPE_UNSIGNED (TREE_TYPE (orig_op2));
@@ -5546,16 +5546,26 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype,
TREE_TYPE (inside_init) = type;
if (TYPE_DOMAIN (type) != 0
&& TYPE_SIZE (type) != 0
- && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
+ && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)
+ {
+ unsigned HOST_WIDE_INT len = TREE_STRING_LENGTH (inside_init);
+
/* Subtract the size of a single (possibly wide) character
because it's ok to ignore the terminating null char
that is counted in the length of the constant. */
- && 0 > compare_tree_int (TYPE_SIZE_UNIT (type),
- TREE_STRING_LENGTH (inside_init)
- - (TYPE_PRECISION (typ1)
- / BITS_PER_UNIT)))
- pedwarn_init (init_loc, 0,
- "initializer-string for array of chars is too long");
+ if (0 > compare_tree_int (TYPE_SIZE_UNIT (type),
+ (len
+ - (TYPE_PRECISION (typ1)
+ / BITS_PER_UNIT))))
+ pedwarn_init (init_loc, 0,
+ ("initializer-string for array of chars "
+ "is too long"));
+ else if (warn_cxx_compat
+ && 0 > compare_tree_int (TYPE_SIZE_UNIT (type), len))
+ warning_at (init_loc, OPT_Wc___compat,
+ ("initializer-string for array chars "
+ "is too long for C++"));
+ }
return inside_init;
}
@@ -9074,7 +9084,7 @@ build_binary_op (location_t location, enum tree_code code,
if (tree_int_cst_sgn (op1) < 0)
{
int_const = false;
- if (skip_evaluation == 0)
+ if (c_inhibit_evaluation_warnings == 0)
warning (0, "right shift count is negative");
}
else
@@ -9085,7 +9095,7 @@ build_binary_op (location_t location, enum tree_code code,
if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
{
int_const = false;
- if (skip_evaluation == 0)
+ if (c_inhibit_evaluation_warnings == 0)
warning (0, "right shift count >= width of type");
}
}
@@ -9111,14 +9121,14 @@ build_binary_op (location_t location, enum tree_code code,
if (tree_int_cst_sgn (op1) < 0)
{
int_const = false;
- if (skip_evaluation == 0)
+ if (c_inhibit_evaluation_warnings == 0)
warning (0, "left shift count is negative");
}
else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
{
int_const = false;
- if (skip_evaluation == 0)
+ if (c_inhibit_evaluation_warnings == 0)
warning (0, "left shift count >= width of type");
}
}
@@ -9458,7 +9468,7 @@ build_binary_op (location_t location, enum tree_code code,
converted = 1;
resultcode = xresultcode;
- if (!skip_evaluation)
+ if (c_inhibit_evaluation_warnings == 0)
{
bool op0_maybe_const = true;
bool op1_maybe_const = true;
diff --git a/gcc/collect2.c b/gcc/collect2.c
index efb00871755..57866aac8a1 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1281,7 +1281,8 @@ main (int argc, char **argv)
/* The AIX linker will discard static constructors in object files if
nothing else in the file is referenced, so look at them first. */
{
- const char **export_object_lst = (const char **)object_lst;
+ const char **export_object_lst
+ = CONST_CAST2 (const char **, char **, object_lst);
while (export_object_lst < object)
scan_prog_file (*export_object_lst++, PASS_OBJ);
diff --git a/gcc/config.gcc b/gcc/config.gcc
index ceb911abf63..7b599173371 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -288,7 +288,7 @@ i[34567]86-*-*)
pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
nmmintrin.h bmmintrin.h mmintrin-common.h
wmmintrin.h immintrin.h x86intrin.h avxintrin.h
- cross-stdarg.h"
+ ia32intrin.h cross-stdarg.h"
;;
x86_64-*-*)
cpu_type=i386
@@ -298,7 +298,7 @@ x86_64-*-*)
pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
nmmintrin.h bmmintrin.h mmintrin-common.h
wmmintrin.h immintrin.h x86intrin.h avxintrin.h
- cross-stdarg.h"
+ ia32intrin.h cross-stdarg.h"
need_64bit_hwint=yes
;;
ia64-*-*)
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 2c637631cae..61774cc0fdf 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -20769,6 +20769,16 @@ enum ix86_builtins
IX86_BUILTIN_MFENCE,
IX86_BUILTIN_LFENCE,
+ IX86_BUILTIN_BSRSI,
+ IX86_BUILTIN_BSRDI,
+ IX86_BUILTIN_RDPMC,
+ IX86_BUILTIN_RDTSC,
+ IX86_BUILTIN_RDTSCP,
+ IX86_BUILTIN_ROLQI,
+ IX86_BUILTIN_ROLHI,
+ IX86_BUILTIN_RORQI,
+ IX86_BUILTIN_RORHI,
+
/* SSE3. */
IX86_BUILTIN_ADDSUBPS,
IX86_BUILTIN_HADDPS,
@@ -21471,6 +21481,8 @@ enum ix86_special_builtin_type
{
SPECIAL_FTYPE_UNKNOWN,
VOID_FTYPE_VOID,
+ UINT64_FTYPE_VOID,
+ UINT64_FTYPE_PUNSIGNED,
V32QI_FTYPE_PCCHAR,
V16QI_FTYPE_PCCHAR,
V8SF_FTYPE_PCV4SF,
@@ -21516,6 +21528,9 @@ enum ix86_builtin_type
INT_FTYPE_V4SF_V4SF_PTEST,
INT_FTYPE_V2DI_V2DI_PTEST,
INT_FTYPE_V2DF_V2DF_PTEST,
+ INT_FTYPE_INT,
+ UINT64_FTYPE_INT,
+ INT64_FTYPE_INT64,
INT64_FTYPE_V4SF,
INT64_FTYPE_V2DF,
INT_FTYPE_V16QI,
@@ -21626,6 +21641,8 @@ enum ix86_builtin_type
UINT_FTYPE_UINT_UINT,
UINT_FTYPE_UINT_USHORT,
UINT_FTYPE_UINT_UCHAR,
+ UINT16_FTYPE_UINT16_INT,
+ UINT8_FTYPE_UINT8_INT,
V8HI_FTYPE_V8HI_INT,
V4SI_FTYPE_V4SI_INT,
V4HI_FTYPE_V4HI_INT,
@@ -21664,6 +21681,9 @@ enum ix86_builtin_type
/* Special builtins with variable number of arguments. */
static const struct builtin_description bdesc_special_args[] =
{
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rdtsc, "__builtin_ia32_rdtsc", IX86_BUILTIN_RDTSC, UNKNOWN, (int) UINT64_FTYPE_VOID },
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rdtscp, "__builtin_ia32_rdtscp", IX86_BUILTIN_RDTSCP, UNKNOWN, (int) UINT64_FTYPE_PUNSIGNED },
+
/* MMX */
{ OPTION_MASK_ISA_MMX, CODE_FOR_mmx_emms, "__builtin_ia32_emms", IX86_BUILTIN_EMMS, UNKNOWN, (int) VOID_FTYPE_VOID },
@@ -21744,6 +21764,14 @@ static const struct builtin_description bdesc_special_args[] =
/* Builtins with variable number of arguments. */
static const struct builtin_description bdesc_args[] =
{
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_bsr, "__builtin_ia32_bsrsi", IX86_BUILTIN_BSRSI, UNKNOWN, (int) INT_FTYPE_INT },
+ { OPTION_MASK_ISA_64BIT, CODE_FOR_bsr_rex64, "__builtin_ia32_bsrdi", IX86_BUILTIN_BSRDI, UNKNOWN, (int) INT64_FTYPE_INT64 },
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rdpmc, "__builtin_ia32_rdpmc", IX86_BUILTIN_RDPMC, UNKNOWN, (int) UINT64_FTYPE_INT },
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rotlqi3, "__builtin_ia32_rolqi", IX86_BUILTIN_ROLQI, UNKNOWN, (int) UINT8_FTYPE_UINT8_INT },
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rotlhi3, "__builtin_ia32_rolhi", IX86_BUILTIN_ROLHI, UNKNOWN, (int) UINT16_FTYPE_UINT16_INT },
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rotrqi3, "__builtin_ia32_rorqi", IX86_BUILTIN_RORQI, UNKNOWN, (int) UINT8_FTYPE_UINT8_INT },
+ { ~OPTION_MASK_ISA_64BIT, CODE_FOR_rotrhi3, "__builtin_ia32_rorhi", IX86_BUILTIN_RORHI, UNKNOWN, (int) UINT16_FTYPE_UINT16_INT },
+
/* MMX */
{ OPTION_MASK_ISA_MMX, CODE_FOR_mmx_addv8qi3, "__builtin_ia32_paddb", IX86_BUILTIN_PADDB, UNKNOWN, (int) V8QI_FTYPE_V8QI_V8QI },
{ OPTION_MASK_ISA_MMX, CODE_FOR_mmx_addv4hi3, "__builtin_ia32_paddw", IX86_BUILTIN_PADDW, UNKNOWN, (int) V4HI_FTYPE_V4HI_V4HI },
@@ -23388,6 +23416,35 @@ ix86_init_mmx_sse_builtins (void)
= build_function_type_list (V2DF_type_node,
V2DF_type_node, V2DI_type_node, NULL_TREE);
+ /* Integer intrinsics. */
+ tree uint64_ftype_void
+ = build_function_type (long_long_unsigned_type_node,
+ void_list_node);
+ tree int_ftype_int
+ = build_function_type_list (integer_type_node,
+ integer_type_node, NULL_TREE);
+ tree int64_ftype_int64
+ = build_function_type_list (long_long_integer_type_node,
+ long_long_integer_type_node,
+ NULL_TREE);
+ tree uint64_ftype_int
+ = build_function_type_list (long_long_unsigned_type_node,
+ integer_type_node, NULL_TREE);
+ tree punsigned_type_node = build_pointer_type (unsigned_type_node);
+ tree uint64_ftype_punsigned
+ = build_function_type_list (long_long_unsigned_type_node,
+ punsigned_type_node, NULL_TREE);
+ tree ushort_ftype_ushort_int
+ = build_function_type_list (short_unsigned_type_node,
+ short_unsigned_type_node,
+ integer_type_node,
+ NULL_TREE);
+ tree uchar_ftype_uchar_int
+ = build_function_type_list (unsigned_char_type_node,
+ unsigned_char_type_node,
+ integer_type_node,
+ NULL_TREE);
+
tree ftype;
/* Add all special builtins with variable number of operands. */
@@ -23405,6 +23462,12 @@ ix86_init_mmx_sse_builtins (void)
case VOID_FTYPE_VOID:
type = void_ftype_void;
break;
+ case UINT64_FTYPE_VOID:
+ type = uint64_ftype_void;
+ break;
+ case UINT64_FTYPE_PUNSIGNED:
+ type = uint64_ftype_punsigned;
+ break;
case V32QI_FTYPE_PCCHAR:
type = v32qi_ftype_pcchar;
break;
@@ -23535,6 +23598,15 @@ ix86_init_mmx_sse_builtins (void)
case INT_FTYPE_V2DF_V2DF_PTEST:
type = int_ftype_v2df_v2df;
break;
+ case INT_FTYPE_INT:
+ type = int_ftype_int;
+ break;
+ case UINT64_FTYPE_INT:
+ type = uint64_ftype_int;
+ break;
+ case INT64_FTYPE_INT64:
+ type = int64_ftype_int64;
+ break;
case INT64_FTYPE_V4SF:
type = int64_ftype_v4sf;
break;
@@ -23845,6 +23917,12 @@ ix86_init_mmx_sse_builtins (void)
case UINT_FTYPE_UINT_UCHAR:
type = unsigned_ftype_unsigned_uchar;
break;
+ case UINT16_FTYPE_UINT16_INT:
+ type = ushort_ftype_ushort_int;
+ break;
+ case UINT8_FTYPE_UINT8_INT:
+ type = uchar_ftype_uchar_int;
+ break;
case V8HI_FTYPE_V8HI_INT:
type = v8hi_ftype_v8hi_int;
break;
@@ -24924,6 +25002,9 @@ ix86_expand_args_builtin (const struct builtin_description *d,
return ix86_expand_sse_ptest (d, exp, target);
case FLOAT128_FTYPE_FLOAT128:
case FLOAT_FTYPE_FLOAT:
+ case INT_FTYPE_INT:
+ case UINT64_FTYPE_INT:
+ case INT64_FTYPE_INT64:
case INT64_FTYPE_V4SF:
case INT64_FTYPE_V2DF:
case INT_FTYPE_V16QI:
@@ -25049,6 +25130,8 @@ ix86_expand_args_builtin (const struct builtin_description *d,
case UINT_FTYPE_UINT_UINT:
case UINT_FTYPE_UINT_USHORT:
case UINT_FTYPE_UINT_UCHAR:
+ case UINT16_FTYPE_UINT16_INT:
+ case UINT8_FTYPE_UINT8_INT:
nargs = 2;
break;
case V2DI2TI_FTYPE_V2DI_INT:
@@ -25293,6 +25376,12 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
case VOID_FTYPE_VOID:
emit_insn (GEN_FCN (icode) (target));
return 0;
+ case UINT64_FTYPE_VOID:
+ nargs = 0;
+ klass = load;
+ memory = 0;
+ break;
+ case UINT64_FTYPE_PUNSIGNED:
case V2DI_FTYPE_PV2DI:
case V32QI_FTYPE_PCCHAR:
case V16QI_FTYPE_PCCHAR:
@@ -25415,6 +25504,9 @@ ix86_expand_special_args_builtin (const struct builtin_description *d,
switch (nargs)
{
+ case 0:
+ pat = GEN_FCN (icode) (target);
+ break;
case 1:
pat = GEN_FCN (icode) (target, args[0].op);
break;
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index c21aa9c679e..59d9e829ed0 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -244,6 +244,9 @@
(UNSPECV_CLD 15)
(UNSPECV_VZEROALL 16)
(UNSPECV_VZEROUPPER 17)
+ (UNSPECV_RDTSC 18)
+ (UNSPECV_RDTSCP 19)
+ (UNSPECV_RDPMC 20)
])
;; Constants to represent pcomtrue/pcomfalse variants
@@ -16153,7 +16156,7 @@
(set_attr "type" "bitmanip")
(set_attr "mode" "SI")])
-(define_insn "*bsr"
+(define_insn "bsr"
[(set (match_operand:SI 0 "register_operand" "=r")
(minus:SI (const_int 31)
(clz:SI (match_operand:SI 1 "nonimmediate_operand" "rm"))))
@@ -16338,7 +16341,7 @@
(set_attr "type" "bitmanip")
(set_attr "mode" "DI")])
-(define_insn "*bsr_rex64"
+(define_insn "bsr_rex64"
[(set (match_operand:DI 0 "register_operand" "=r")
(minus:DI (const_int 63)
(clz:DI (match_operand:DI 1 "nonimmediate_operand" "rm"))))
@@ -22670,6 +22673,169 @@
(set_attr "prefix_extra" "1")
(set_attr "mode" "DI")])
+(define_expand "rdpmc"
+ [(match_operand:DI 0 "register_operand" "")
+ (match_operand:SI 1 "register_operand" "")]
+ ""
+{
+ rtx reg = gen_reg_rtx (DImode);
+ rtx si;
+
+ /* Force operand 1 into ECX. */
+ rtx ecx = gen_rtx_REG (SImode, CX_REG);
+ emit_insn (gen_rtx_SET (VOIDmode, ecx, operands[1]));
+ si = gen_rtx_UNSPEC_VOLATILE (DImode, gen_rtvec (1, ecx),
+ UNSPECV_RDPMC);
+
+ if (TARGET_64BIT)
+ {
+ rtvec vec = rtvec_alloc (2);
+ rtx load = gen_rtx_PARALLEL (VOIDmode, vec);
+ rtx upper = gen_reg_rtx (DImode);
+ rtx di = gen_rtx_UNSPEC_VOLATILE (DImode,
+ gen_rtvec (1, const0_rtx),
+ UNSPECV_RDPMC);
+ RTVEC_ELT (vec, 0) = gen_rtx_SET (VOIDmode, reg, si);
+ RTVEC_ELT (vec, 1) = gen_rtx_SET (VOIDmode, upper, di);
+ emit_insn (load);
+ upper = expand_simple_binop (DImode, ASHIFT, upper, GEN_INT (32),
+ NULL, 1, OPTAB_DIRECT);
+ reg = expand_simple_binop (DImode, IOR, reg, upper, reg, 1,
+ OPTAB_DIRECT);
+ }
+ else
+ emit_insn (gen_rtx_SET (VOIDmode, reg, si));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], reg));
+ DONE;
+})
+
+(define_insn "*rdpmc"
+ [(set (match_operand:DI 0 "register_operand" "=A")
+ (unspec_volatile:DI [(match_operand:SI 1 "register_operand" "c")]
+ UNSPECV_RDPMC))]
+ "!TARGET_64BIT"
+ "rdpmc"
+ [(set_attr "type" "other")
+ (set_attr "length" "2")])
+
+(define_insn "*rdpmc_rex64"
+ [(set (match_operand:DI 0 "register_operand" "=a")
+ (unspec_volatile:DI [(match_operand:SI 2 "register_operand" "c")]
+ UNSPECV_RDPMC))
+ (set (match_operand:DI 1 "register_operand" "=d")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDPMC))]
+ "TARGET_64BIT"
+ "rdpmc"
+ [(set_attr "type" "other")
+ (set_attr "length" "2")])
+
+(define_expand "rdtsc"
+ [(set (match_operand:DI 0 "register_operand" "")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC))]
+ ""
+{
+ if (TARGET_64BIT)
+ {
+ rtvec vec = rtvec_alloc (2);
+ rtx load = gen_rtx_PARALLEL (VOIDmode, vec);
+ rtx upper = gen_reg_rtx (DImode);
+ rtx lower = gen_reg_rtx (DImode);
+ rtx src = gen_rtx_UNSPEC_VOLATILE (DImode,
+ gen_rtvec (1, const0_rtx),
+ UNSPECV_RDTSC);
+ RTVEC_ELT (vec, 0) = gen_rtx_SET (VOIDmode, lower, src);
+ RTVEC_ELT (vec, 1) = gen_rtx_SET (VOIDmode, upper, src);
+ emit_insn (load);
+ upper = expand_simple_binop (DImode, ASHIFT, upper, GEN_INT (32),
+ NULL, 1, OPTAB_DIRECT);
+ lower = expand_simple_binop (DImode, IOR, lower, upper, lower, 1,
+ OPTAB_DIRECT);
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], lower));
+ DONE;
+ }
+})
+
+(define_insn "*rdtsc"
+ [(set (match_operand:DI 0 "register_operand" "=A")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC))]
+ "!TARGET_64BIT"
+ "rdtsc"
+ [(set_attr "type" "other")
+ (set_attr "length" "2")])
+
+(define_insn "*rdtsc_rex64"
+ [(set (match_operand:DI 0 "register_operand" "=a")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC))
+ (set (match_operand:DI 1 "register_operand" "=d")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSC))]
+ "TARGET_64BIT"
+ "rdtsc"
+ [(set_attr "type" "other")
+ (set_attr "length" "2")])
+
+(define_expand "rdtscp"
+ [(match_operand:DI 0 "register_operand" "")
+ (match_operand:SI 1 "memory_operand" "")]
+ ""
+{
+ rtx di = gen_rtx_UNSPEC_VOLATILE (DImode,
+ gen_rtvec (1, const0_rtx),
+ UNSPECV_RDTSCP);
+ rtx si = gen_rtx_UNSPEC_VOLATILE (SImode,
+ gen_rtvec (1, const0_rtx),
+ UNSPECV_RDTSCP);
+ rtx reg = gen_reg_rtx (DImode);
+ rtx tmp = gen_reg_rtx (SImode);
+
+ if (TARGET_64BIT)
+ {
+ rtvec vec = rtvec_alloc (3);
+ rtx load = gen_rtx_PARALLEL (VOIDmode, vec);
+ rtx upper = gen_reg_rtx (DImode);
+ RTVEC_ELT (vec, 0) = gen_rtx_SET (VOIDmode, reg, di);
+ RTVEC_ELT (vec, 1) = gen_rtx_SET (VOIDmode, upper, di);
+ RTVEC_ELT (vec, 2) = gen_rtx_SET (VOIDmode, tmp, si);
+ emit_insn (load);
+ upper = expand_simple_binop (DImode, ASHIFT, upper, GEN_INT (32),
+ NULL, 1, OPTAB_DIRECT);
+ reg = expand_simple_binop (DImode, IOR, reg, upper, reg, 1,
+ OPTAB_DIRECT);
+ }
+ else
+ {
+ rtvec vec = rtvec_alloc (2);
+ rtx load = gen_rtx_PARALLEL (VOIDmode, vec);
+ RTVEC_ELT (vec, 0) = gen_rtx_SET (VOIDmode, reg, di);
+ RTVEC_ELT (vec, 1) = gen_rtx_SET (VOIDmode, tmp, si);
+ emit_insn (load);
+ }
+ emit_insn (gen_rtx_SET (VOIDmode, operands[0], reg));
+ emit_insn (gen_rtx_SET (VOIDmode, operands[1], tmp));
+ DONE;
+})
+
+(define_insn "*rdtscp"
+ [(set (match_operand:DI 0 "register_operand" "=A")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSCP))
+ (set (match_operand:SI 1 "register_operand" "=c")
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_RDTSCP))]
+ "!TARGET_64BIT"
+ "rdtscp"
+ [(set_attr "type" "other")
+ (set_attr "length" "3")])
+
+(define_insn "*rdtscp_rex64"
+ [(set (match_operand:DI 0 "register_operand" "=a")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSCP))
+ (set (match_operand:DI 1 "register_operand" "=d")
+ (unspec_volatile:DI [(const_int 0)] UNSPECV_RDTSCP))
+ (set (match_operand:SI 2 "register_operand" "=c")
+ (unspec_volatile:SI [(const_int 0)] UNSPECV_RDTSCP))]
+ "TARGET_64BIT"
+ "rdtscp"
+ [(set_attr "type" "other")
+ (set_attr "length" "3")])
+
(include "mmx.md")
(include "sse.md")
(include "sync.md")
diff --git a/gcc/config/i386/ia32intrin.h b/gcc/config/i386/ia32intrin.h
new file mode 100644
index 00000000000..e701b19e2a8
--- /dev/null
+++ b/gcc/config/i386/ia32intrin.h
@@ -0,0 +1,230 @@
+/* Copyright (C) 2009 Free Software Foundation, Inc.
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ GCC is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ Under Section 7 of GPL version 3, you are granted additional
+ permissions described in the GCC Runtime Library Exception, version
+ 3.1, as published by the Free Software Foundation.
+
+ You should have received a copy of the GNU General Public License and
+ a copy of the GCC Runtime Library Exception along with this program;
+ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _X86INTRIN_H_INCLUDED
+# error "Never use <ia32intrin.h> directly; include <x86intrin.h> instead."
+#endif
+
+/* 32bit bsf */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__bsfd (int __X)
+{
+ return __builtin_ctz (__X);
+}
+
+/* 32bit bsr */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__bsrd (int __X)
+{
+ return __builtin_ia32_bsrsi (__X);
+}
+
+/* 32bit bswap */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__bswapd (int __X)
+{
+ return __builtin_bswap32 (__X);
+}
+
+/* 32bit accumulate CRC32 (polynomial 0x11EDC6F41) value. */
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__crc32b (unsigned int __C, unsigned char __V)
+{
+ return __builtin_ia32_crc32qi (__C, __V);
+}
+
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__crc32w (unsigned int __C, unsigned short __V)
+{
+ return __builtin_ia32_crc32hi (__C, __V);
+}
+
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__crc32d (unsigned int __C, unsigned int __V)
+{
+ return __builtin_ia32_crc32si (__C, __V);
+}
+
+/* 32bit popcnt */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__popcntd (unsigned int __X)
+{
+ return __builtin_popcount (__X);
+}
+
+/* rdpmc */
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rdpmc (int __S)
+{
+ return __builtin_ia32_rdpmc (__S);
+}
+
+/* rdtsc */
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rdtsc (void)
+{
+ return __builtin_ia32_rdtsc ();
+}
+
+/* rdtscp */
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rdtscp (unsigned int *__A)
+{
+ return __builtin_ia32_rdtscp (__A);
+}
+
+/* 8bit rol */
+extern __inline unsigned char
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rolb (unsigned char __X, int __C)
+{
+ return __builtin_ia32_rolqi (__X, __C);
+}
+
+/* 16bit rol */
+extern __inline unsigned short
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rolw (unsigned short __X, int __C)
+{
+ return __builtin_ia32_rolhi (__X, __C);
+}
+
+/* 32bit rol */
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rold (unsigned int __X, int __C)
+{
+ return (__X << __C) | (__X >> (32 - __C));
+}
+
+/* 8bit ror */
+extern __inline unsigned char
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rorb (unsigned char __X, int __C)
+{
+ return __builtin_ia32_rorqi (__X, __C);
+}
+
+/* 16bit ror */
+extern __inline unsigned short
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rorw (unsigned short __X, int __C)
+{
+ return __builtin_ia32_rorhi (__X, __C);
+}
+
+/* 32bit ror */
+extern __inline unsigned int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rord (unsigned int __X, int __C)
+{
+ return (__X >> __C) | (__X << (32 - __C));
+}
+
+#ifdef __x86_64__
+/* 64bit bsf */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__bsfq (long long __X)
+{
+ return __builtin_ctzll (__X);
+}
+
+/* 64bit bsr */
+extern __inline int
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__bsrq (long long __X)
+{
+ return __builtin_ia32_bsrdi (__X);
+}
+
+/* 64bit bswap */
+extern __inline long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__bswapq (long long __X)
+{
+ return __builtin_bswap64 (__X);
+}
+
+/* 64bit accumulate CRC32 (polynomial 0x11EDC6F41) value. */
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__crc32q (unsigned long long __C, unsigned long long __V)
+{
+ return __builtin_ia32_crc32di (__C, __V);
+}
+
+/* 64bit popcnt */
+extern __inline long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__popcntq (unsigned long long __X)
+{
+ return __builtin_popcountll (__X);
+}
+
+/* 64bit rol */
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rolq (unsigned long long __X, int __C)
+{
+ return (__X << __C) | (__X >> (64 - __C));
+}
+
+/* 64bit ror */
+extern __inline unsigned long long
+__attribute__((__gnu_inline__, __always_inline__, __artificial__))
+__rorq (unsigned long long __X, int __C)
+{
+ return (__X >> __C) | (__X << (64 - __C));
+}
+
+#define _bswap64(a) __bswapq(a)
+#define _popcnt64(a) __popcntq(a)
+#define _lrotl(a,b) __rolq((a), (b))
+#define _lrotr(a,b) __rorq((a), (b))
+#else
+#define _lrotl(a,b) __rold((a), (b))
+#define _lrotr(a,b) __rord((a), (b))
+#endif
+
+#define _bit_scan_forward(a) __bsfd(a)
+#define _bit_scan_reverse(a) __bsrd(a)
+#define _bswap(a) __bswapd(a)
+#define _popcnt32(a) __popcntd(a)
+#define _rdpmc(a) __rdpmc(a)
+#define _rdtsc() __rdtsc()
+#define _rdtscp(a) __rdtscp(a)
+#define _rotwl(a,b) __rolw((a), (b))
+#define _rotwr(a,b) __rorw((a), (b))
+#define _rotl(a,b) __rold((a), (b))
+#define _rotr(a,b) __rord((a), (b))
diff --git a/gcc/config/i386/x86intrin.h b/gcc/config/i386/x86intrin.h
index d848811d34c..705300c23eb 100644
--- a/gcc/config/i386/x86intrin.h
+++ b/gcc/config/i386/x86intrin.h
@@ -24,6 +24,8 @@
#ifndef _X86INTRIN_H_INCLUDED
#define _X86INTRIN_H_INCLUDED
+#include <ia32intrin.h>
+
#ifdef __MMX__
#include <mmintrin.h>
#endif
diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h
index b9f1bcadb1a..44015a348b7 100644
--- a/gcc/config/rs6000/aix.h
+++ b/gcc/config/rs6000/aix.h
@@ -148,7 +148,7 @@
%{p:-L%R/lib/profiled -L%R/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc"
/* Static linking with shared libstdc++ requires libsupc++ as well. */
-#define LIBSTDCXX_STATIC "-lstdc++ -lsupc++"
+#define LIBSTDCXX_STATIC "-lsupc++"
/* This now supports a natural alignment mode. */
/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */
diff --git a/gcc/config/rs6000/constraints.md b/gcc/config/rs6000/constraints.md
index 7f551994b7d..e817a664601 100644
--- a/gcc/config/rs6000/constraints.md
+++ b/gcc/config/rs6000/constraints.md
@@ -23,6 +23,10 @@
? FLOAT_REGS : NO_REGS"
"@internal")
+(define_register_constraint "d" "TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
+ ? FLOAT_REGS : NO_REGS"
+ "@internal")
+
(define_register_constraint "b" "BASE_REGS"
"@internal")
diff --git a/gcc/config/rs6000/dfp.md b/gcc/config/rs6000/dfp.md
index 377023b0491..96da57c319c 100644
--- a/gcc/config/rs6000/dfp.md
+++ b/gcc/config/rs6000/dfp.md
@@ -105,7 +105,7 @@
(define_insn "movsd_store"
[(set (match_operand:DD 0 "nonimmediate_operand" "=m")
- (unspec:DD [(match_operand:SD 1 "input_operand" "f")]
+ (unspec:DD [(match_operand:SD 1 "input_operand" "d")]
UNSPEC_MOVSD_STORE))]
"(gpc_reg_operand (operands[0], DDmode)
|| gpc_reg_operand (operands[1], SDmode))
@@ -128,15 +128,15 @@
;; Hardware support for decimal floating point operations.
(define_insn "extendsddd2"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
(float_extend:DD (match_operand:SD 1 "gpc_reg_operand" "f")))]
"TARGET_DFP"
"dctdp %0,%1"
[(set_attr "type" "fp")])
(define_expand "extendsdtd2"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (float_extend:TD (match_operand:SD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (float_extend:TD (match_operand:SD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
{
rtx tmp = gen_reg_rtx (DDmode);
@@ -147,7 +147,7 @@
(define_insn "truncddsd2"
[(set (match_operand:SD 0 "gpc_reg_operand" "=f")
- (float_truncate:SD (match_operand:DD 1 "gpc_reg_operand" "f")))]
+ (float_truncate:SD (match_operand:DD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"drsp %0,%1"
[(set_attr "type" "fp")])
@@ -159,8 +159,8 @@
"")
(define_insn "*negdd2_fpr"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (neg:DD (match_operand:DD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (neg:DD (match_operand:DD 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fneg %0,%1"
[(set_attr "type" "fp")])
@@ -172,15 +172,15 @@
"")
(define_insn "*absdd2_fpr"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (abs:DD (match_operand:DD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (abs:DD (match_operand:DD 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fabs %0,%1"
[(set_attr "type" "fp")])
(define_insn "*nabsdd2_fpr"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (neg:DD (abs:DD (match_operand:DF 1 "gpc_reg_operand" "f"))))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (neg:DD (abs:DD (match_operand:DD 1 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fnabs %0,%1"
[(set_attr "type" "fp")])
@@ -281,8 +281,8 @@
;; The "??" is a kludge until we can figure out a more reasonable way
;; of handling these non-offsettable values.
(define_insn "*movdd_hardfloat32"
- [(set (match_operand:DD 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
- (match_operand:DD 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
+ [(set (match_operand:DD 0 "nonimmediate_operand" "=!r,??r,m,d,d,m,!r,!r,!r")
+ (match_operand:DD 1 "input_operand" "r,m,r,d,m,d,G,H,F"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS
&& (gpc_reg_operand (operands[0], DDmode)
|| gpc_reg_operand (operands[1], DDmode))"
@@ -417,8 +417,8 @@
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*movdd_hardfloat64_mfpgpr"
- [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
- (match_operand:DD 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
+ [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r,r,d")
+ (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F,d,r"))]
"TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
&& (gpc_reg_operand (operands[0], DDmode)
|| gpc_reg_operand (operands[1], DDmode))"
@@ -443,8 +443,8 @@
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*movdd_hardfloat64"
- [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
- (match_operand:DD 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
+ [(set (match_operand:DD 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r")
+ (match_operand:DD 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F"))]
"TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
&& (gpc_reg_operand (operands[0], DDmode)
|| gpc_reg_operand (operands[1], DDmode))"
@@ -490,8 +490,8 @@
"")
(define_insn "*negtd2_fpr"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (neg:TD (match_operand:TD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (neg:TD (match_operand:TD 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fneg %0,%1"
[(set_attr "type" "fp")])
@@ -503,15 +503,15 @@
"")
(define_insn "*abstd2_fpr"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (abs:TD (match_operand:TD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fabs %0,%1"
[(set_attr "type" "fp")])
(define_insn "*nabstd2_fpr"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (neg:TD (abs:TD (match_operand:DF 1 "gpc_reg_operand" "f"))))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (neg:TD (abs:TD (match_operand:TD 1 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS"
"fnabs %0,%1"
[(set_attr "type" "fp")])
@@ -526,8 +526,8 @@
; otherwise reload, given m->f, will try to pick f->f and reload it,
; which doesn't make progress. Likewise r->Y must be before r->r.
(define_insn_and_split "*movtd_internal"
- [(set (match_operand:TD 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
- (match_operand:TD 1 "input_operand" "f,o,f,YGHF,r,r"))]
+ [(set (match_operand:TD 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
+ (match_operand:TD 1 "input_operand" "d,o,d,YGHF,r,r"))]
"TARGET_HARD_FLOAT && TARGET_FPRS
&& (gpc_reg_operand (operands[0], TDmode)
|| gpc_reg_operand (operands[1], TDmode))"
@@ -540,8 +540,8 @@
;; Hardware support for decimal floating point operations.
(define_insn "extendddtd2"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (float_extend:TD (match_operand:DD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (float_extend:TD (match_operand:DD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dctqpq %0,%1"
[(set_attr "type" "fp")])
@@ -552,96 +552,96 @@
;; that the result is the first of the pair receiving the result of drdpq.
(define_insn "trunctddd2"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (float_truncate:DD (match_operand:TD 1 "gpc_reg_operand" "f")))
- (clobber (match_scratch:TD 2 "=f"))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (float_truncate:DD (match_operand:TD 1 "gpc_reg_operand" "d")))
+ (clobber (match_scratch:TD 2 "=d"))]
"TARGET_DFP"
"drdpq %2,%1\;fmr %0,%2"
[(set_attr "type" "fp")])
(define_insn "adddd3"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (plus:DD (match_operand:DD 1 "gpc_reg_operand" "%f")
- (match_operand:DD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (plus:DD (match_operand:DD 1 "gpc_reg_operand" "%d")
+ (match_operand:DD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dadd %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "addtd3"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (plus:TD (match_operand:TD 1 "gpc_reg_operand" "%f")
- (match_operand:TD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (plus:TD (match_operand:TD 1 "gpc_reg_operand" "%d")
+ (match_operand:TD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"daddq %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "subdd3"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (minus:DD (match_operand:DD 1 "gpc_reg_operand" "f")
- (match_operand:DD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (minus:DD (match_operand:DD 1 "gpc_reg_operand" "d")
+ (match_operand:DD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dsub %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "subtd3"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (minus:TD (match_operand:TD 1 "gpc_reg_operand" "f")
- (match_operand:TD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (minus:TD (match_operand:TD 1 "gpc_reg_operand" "d")
+ (match_operand:TD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dsubq %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "muldd3"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (mult:DD (match_operand:DD 1 "gpc_reg_operand" "%f")
- (match_operand:DD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (mult:DD (match_operand:DD 1 "gpc_reg_operand" "%d")
+ (match_operand:DD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dmul %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "multd3"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (mult:TD (match_operand:TD 1 "gpc_reg_operand" "%f")
- (match_operand:TD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (mult:TD (match_operand:TD 1 "gpc_reg_operand" "%d")
+ (match_operand:TD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dmulq %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "divdd3"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (div:DD (match_operand:DD 1 "gpc_reg_operand" "f")
- (match_operand:DD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (div:DD (match_operand:DD 1 "gpc_reg_operand" "d")
+ (match_operand:DD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"ddiv %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "divtd3"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (div:TD (match_operand:TD 1 "gpc_reg_operand" "f")
- (match_operand:TD 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (div:TD (match_operand:TD 1 "gpc_reg_operand" "d")
+ (match_operand:TD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"ddivq %0,%1,%2"
[(set_attr "type" "fp")])
(define_insn "*cmpdd_internal1"
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:DD 1 "gpc_reg_operand" "f")
- (match_operand:DD 2 "gpc_reg_operand" "f")))]
+ (compare:CCFP (match_operand:DD 1 "gpc_reg_operand" "d")
+ (match_operand:DD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dcmpu %0,%1,%2"
[(set_attr "type" "fpcompare")])
(define_insn "*cmptd_internal1"
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:TD 1 "gpc_reg_operand" "f")
- (match_operand:TD 2 "gpc_reg_operand" "f")))]
+ (compare:CCFP (match_operand:TD 1 "gpc_reg_operand" "d")
+ (match_operand:TD 2 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dcmpuq %0,%1,%2"
[(set_attr "type" "fpcompare")])
(define_insn "floatditd2"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (float:TD (match_operand:DI 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (float:TD (match_operand:DI 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dcffixq %0,%1"
[(set_attr "type" "fp")])
@@ -650,8 +650,8 @@
;; This is the first stage of converting it to an integer type.
(define_insn "ftruncdd2"
- [(set (match_operand:DD 0 "gpc_reg_operand" "=f")
- (fix:DD (match_operand:DD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DD 0 "gpc_reg_operand" "=d")
+ (fix:DD (match_operand:DD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"drintn. 0,%0,%1,1"
[(set_attr "type" "fp")])
@@ -660,8 +660,8 @@
;; This is the second stage of converting decimal float to integer type.
(define_insn "fixdddi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
- (fix:DI (match_operand:DD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
+ (fix:DI (match_operand:DD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dctfix %0,%1"
[(set_attr "type" "fp")])
@@ -670,8 +670,8 @@
;; This is the first stage of converting it to an integer type.
(define_insn "ftrunctd2"
- [(set (match_operand:TD 0 "gpc_reg_operand" "=f")
- (fix:TD (match_operand:TD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TD 0 "gpc_reg_operand" "=d")
+ (fix:TD (match_operand:TD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"drintnq. 0,%0,%1,1"
[(set_attr "type" "fp")])
@@ -680,8 +680,8 @@
;; This is the second stage of converting decimal float to integer type.
(define_insn "fixtddi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
- (fix:DI (match_operand:TD 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
+ (fix:DI (match_operand:TD 1 "gpc_reg_operand" "d")))]
"TARGET_DFP"
"dctfixq %0,%1"
[(set_attr "type" "fp")])
diff --git a/gcc/config/rs6000/ppu_intrinsics.h b/gcc/config/rs6000/ppu_intrinsics.h
index 2acb32db963..0950f33aa55 100644
--- a/gcc/config/rs6000/ppu_intrinsics.h
+++ b/gcc/config/rs6000/ppu_intrinsics.h
@@ -385,11 +385,11 @@ typedef int __V4SI __attribute__((vector_size(16)));
#define __mffs() __extension__ \
({double result; \
- __asm__ volatile ("mffs %0" : "=f" (result)); \
+ __asm__ volatile ("mffs %0" : "=d" (result)); \
result; })
#define __mtfsf(mask,value) \
- __asm__ volatile ("mtfsf %0,%1" : : "n" (mask), "f" ((double) (value)))
+ __asm__ volatile ("mtfsf %0,%1" : : "n" (mask), "d" ((double) (value)))
#define __mtfsfi(bits,field) \
__asm__ volatile ("mtfsfi %0,%1" : : "n" (bits), "n" (field))
@@ -400,8 +400,8 @@ typedef int __V4SI __attribute__((vector_size(16)));
#define __setflm(v) __extension__ \
({double result; \
__asm__ volatile ("mffs %0\n\tmtfsf 255,%1" \
- : "=&f" (result) \
- : "f" ((double) (v))); \
+ : "=&d" (result) \
+ : "d" ((double) (v))); \
result; })
/* __builtin_fabs may perform unnecessary rounding. */
@@ -416,7 +416,7 @@ static __inline__ double
__fabs(double x)
{
double r;
- __asm__("fabs %0,%1" : "=f"(r) : "f"(x));
+ __asm__("fabs %0,%1" : "=d"(r) : "d"(x));
return r;
}
@@ -434,7 +434,7 @@ static __inline__ double
__fnabs(double x)
{
double r;
- __asm__("fnabs %0,%1" : "=f"(r) : "f"(x));
+ __asm__("fnabs %0,%1" : "=d"(r) : "d"(x));
return r;
}
@@ -453,7 +453,7 @@ static __inline__ double
__fmadd(double x, double y, double z)
{
double r;
- __asm__("fmadd %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ __asm__("fmadd %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z));
return r;
}
@@ -463,7 +463,7 @@ static __inline__ double
__fmsub(double x, double y, double z)
{
double r;
- __asm__("fmsub %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ __asm__("fmsub %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z));
return r;
}
@@ -473,7 +473,7 @@ static __inline__ double
__fnmadd(double x, double y, double z)
{
double r;
- __asm__("fnmadd %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ __asm__("fnmadd %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z));
return r;
}
@@ -483,7 +483,7 @@ static __inline__ double
__fnmsub(double x, double y, double z)
{
double r;
- __asm__("fnmsub %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ __asm__("fnmsub %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z));
return r;
}
@@ -533,7 +533,7 @@ static __inline__ double
__fsel(double x, double y, double z)
{
double r;
- __asm__("fsel %0,%1,%2,%3" : "=f"(r) : "f"(x),"f"(y),"f"(z));
+ __asm__("fsel %0,%1,%2,%3" : "=d"(r) : "d"(x),"d"(y),"d"(z));
return r;
}
@@ -552,7 +552,7 @@ static __inline__ double
__frsqrte(double x)
{
double r;
- __asm__("frsqrte %0,%1" : "=f" (r) : "f" (x));
+ __asm__("frsqrte %0,%1" : "=d" (r) : "d" (x));
return r;
}
@@ -570,7 +570,7 @@ static __inline__ double
__fsqrt(double x)
{
double r;
- __asm__("fsqrt %0,%1" : "=f"(r) : "f"(x));
+ __asm__("fsqrt %0,%1" : "=d"(r) : "d"(x));
return r;
}
@@ -588,7 +588,7 @@ static __inline__ double
__fmul(double a, double b)
{
double d;
- __asm__ ("fmul %0,%1,%2" : "=f" (d) : "f" (a), "f" (b));
+ __asm__ ("fmul %0,%1,%2" : "=d" (d) : "d" (a), "d" (b));
return d;
}
@@ -597,7 +597,7 @@ static __inline__ float
__fmuls (float a, float b)
{
float d;
- __asm__ ("fmuls %0,%1,%2" : "=f" (d) : "f" (a), "f" (b));
+ __asm__ ("fmuls %0,%1,%2" : "=d" (d) : "f" (a), "f" (b));
return d;
}
@@ -606,7 +606,7 @@ static __inline__ float
__frsp (float a)
{
float d;
- __asm__ ("frsp %0,%1" : "=f" (d) : "f" (a));
+ __asm__ ("frsp %0,%1" : "=d" (d) : "f" (a));
return d;
}
@@ -615,7 +615,7 @@ static __inline__ double
__fcfid (long long a)
{
double d;
- __asm__ ("fcfid %0,%1" : "=f" (d) : "f" (a));
+ __asm__ ("fcfid %0,%1" : "=d" (d) : "d" (a));
return d;
}
@@ -624,7 +624,7 @@ static __inline__ long long
__fctid (double a)
{
long long d;
- __asm__ ("fctid %0,%1" : "=f" (d) : "f" (a));
+ __asm__ ("fctid %0,%1" : "=d" (d) : "d" (a));
return d;
}
@@ -633,7 +633,7 @@ static __inline__ long long
__fctidz (double a)
{
long long d;
- __asm__ ("fctidz %0,%1" : "=f" (d) : "f" (a));
+ __asm__ ("fctidz %0,%1" : "=d" (d) : "d" (a));
return d;
}
@@ -642,7 +642,7 @@ static __inline__ int
__fctiw (double a)
{
unsigned long long d;
- __asm__ ("fctiw %0,%1" : "=f" (d) : "f" (a));
+ __asm__ ("fctiw %0,%1" : "=d" (d) : "d" (a));
return (int) d;
}
@@ -651,7 +651,7 @@ static __inline__ int
__fctiwz (double a)
{
long long d;
- __asm__ ("fctiwz %0,%1" : "=f" (d) : "f" (a));
+ __asm__ ("fctiwz %0,%1" : "=d" (d) : "d" (a));
return (int) d;
}
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 7e923fbcc15..592d8dd4fb1 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -5204,14 +5204,6 @@ rs6000_emit_move (rtx dest, rtx source, enum machine_mode mode)
&& ! legitimate_constant_pool_address_p (operands[1])
&& ! toc_relative_expr_p (operands[1]))
{
- /* Emit a USE operation so that the constant isn't deleted if
- expensive optimizations are turned on because nobody
- references it. This should only be done for operands that
- contain SYMBOL_REFs with CONSTANT_POOL_ADDRESS_P set.
- This should not be done for operands that contain LABEL_REFs.
- For now, we just handle the obvious case. */
- if (GET_CODE (operands[1]) != LABEL_REF)
- emit_use (operands[1]);
#if TARGET_MACHO
/* Darwin uses a special PIC legitimizer. */
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 9d4a96051b7..cc6478ec847 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -5119,7 +5119,7 @@
"")
(define_insn_and_split "*extendsfdf2_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f,f")
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d,d")
(float_extend:DF (match_operand:SF 1 "reg_or_mem_operand" "0,f,m")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"@
@@ -5142,7 +5142,7 @@
(define_insn "*truncdfsf2_fpr"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "f")))]
+ (float_truncate:SF (match_operand:DF 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"frsp %0,%1"
[(set_attr "type" "fp")])
@@ -5616,7 +5616,7 @@
(define_insn "*fseldfsf4"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
+ (if_then_else:SF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
(match_operand:DF 4 "zero_fp_constant" "F"))
(match_operand:SF 2 "gpc_reg_operand" "f")
(match_operand:SF 3 "gpc_reg_operand" "f")))]
@@ -5631,8 +5631,8 @@
"")
(define_insn "*negdf2_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"fneg %0,%1"
[(set_attr "type" "fp")])
@@ -5644,15 +5644,15 @@
"")
(define_insn "*absdf2_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"fabs %0,%1"
[(set_attr "type" "fp")])
(define_insn "*nabsdf2_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "f"))))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (neg:DF (abs:DF (match_operand:DF 1 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"fnabs %0,%1"
[(set_attr "type" "fp")])
@@ -5665,9 +5665,9 @@
"")
(define_insn "*adddf3_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (plus:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"{fa|fadd} %0,%1,%2"
[(set_attr "type" "fp")
@@ -5681,9 +5681,9 @@
"")
(define_insn "*subdf3_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (minus:DF (match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (minus:DF (match_operand:DF 1 "gpc_reg_operand" "d")
+ (match_operand:DF 2 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"{fs|fsub} %0,%1,%2"
[(set_attr "type" "fp")
@@ -5697,9 +5697,9 @@
"")
(define_insn "*muldf3_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"{fm|fmul} %0,%1,%2"
[(set_attr "type" "dmul")
@@ -5715,17 +5715,17 @@
"")
(define_insn "*divdf3_fpr"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (div:DF (match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (div:DF (match_operand:DF 1 "gpc_reg_operand" "d")
+ (match_operand:DF 2 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && !TARGET_SIMPLE_FPU"
"{fd|fdiv} %0,%1,%2"
[(set_attr "type" "ddiv")])
(define_expand "recipdf3"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")
+ (match_operand:DF 2 "gpc_reg_operand" "d")]
UNSPEC_FRES))]
"TARGET_RECIP && TARGET_HARD_FLOAT && TARGET_POPCNTB && !optimize_size
&& flag_finite_math_only && !flag_trapping_math"
@@ -5735,37 +5735,37 @@
})
(define_insn "fred"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRES))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRES))]
"TARGET_POPCNTB && flag_finite_math_only"
"fre %0,%1"
[(set_attr "type" "fp")])
(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d"))
+ (match_operand:DF 3 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
"{fma|fmadd} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d"))
+ (match_operand:DF 3 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT"
"{fms|fmsub} %0,%1,%2,%3"
[(set_attr "type" "dmul")
(set_attr "fp_type" "fp_maddsub_d")])
(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f"))))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (neg:DF (plus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d"))
+ (match_operand:DF 3 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
&& HONOR_SIGNED_ZEROS (DFmode)"
"{fnma|fnmadd} %0,%1,%2,%3"
@@ -5773,10 +5773,10 @@
(set_attr "fp_type" "fp_maddsub_d")])
(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "f"))
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (minus:DF (mult:DF (neg:DF (match_operand:DF 1 "gpc_reg_operand" "d"))
+ (match_operand:DF 2 "gpc_reg_operand" "d"))
+ (match_operand:DF 3 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
&& ! HONOR_SIGNED_ZEROS (DFmode)"
"{fnma|fnmadd} %0,%1,%2,%3"
@@ -5784,10 +5784,10 @@
(set_attr "fp_type" "fp_maddsub_d")])
(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))
- (match_operand:DF 3 "gpc_reg_operand" "f"))))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (neg:DF (minus:DF (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d"))
+ (match_operand:DF 3 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
&& HONOR_SIGNED_ZEROS (DFmode)"
"{fnms|fnmsub} %0,%1,%2,%3"
@@ -5795,10 +5795,10 @@
(set_attr "fp_type" "fp_maddsub_d")])
(define_insn ""
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (minus:DF (match_operand:DF 3 "gpc_reg_operand" "f")
- (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%f")
- (match_operand:DF 2 "gpc_reg_operand" "f"))))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (minus:DF (match_operand:DF 3 "gpc_reg_operand" "d")
+ (mult:DF (match_operand:DF 1 "gpc_reg_operand" "%d")
+ (match_operand:DF 2 "gpc_reg_operand" "d"))))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_FUSED_MADD && TARGET_DOUBLE_FLOAT
&& ! HONOR_SIGNED_ZEROS (DFmode)"
"{fnms|fnmsub} %0,%1,%2,%3"
@@ -5806,8 +5806,8 @@
(set_attr "fp_type" "fp_maddsub_d")])
(define_insn "sqrtdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (sqrt:DF (match_operand:DF 1 "gpc_reg_operand" "d")))]
"(TARGET_PPC_GPOPT || TARGET_POWER2) && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT"
"fsqrt %0,%1"
@@ -5865,21 +5865,21 @@
}")
(define_insn "*fseldfdf4"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "f")
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (if_then_else:DF (ge (match_operand:DF 1 "gpc_reg_operand" "d")
(match_operand:DF 4 "zero_fp_constant" "F"))
- (match_operand:DF 2 "gpc_reg_operand" "f")
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
+ (match_operand:DF 2 "gpc_reg_operand" "d")
+ (match_operand:DF 3 "gpc_reg_operand" "d")))]
"TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"fsel %0,%1,%2,%3"
[(set_attr "type" "fp")])
(define_insn "*fselsfdf4"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
(if_then_else:DF (ge (match_operand:SF 1 "gpc_reg_operand" "f")
(match_operand:SF 4 "zero_fp_constant" "F"))
- (match_operand:DF 2 "gpc_reg_operand" "f")
- (match_operand:DF 3 "gpc_reg_operand" "f")))]
+ (match_operand:DF 2 "gpc_reg_operand" "d")
+ (match_operand:DF 3 "gpc_reg_operand" "d")))]
"TARGET_PPC_GFXOPT && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_SINGLE_FLOAT"
"fsel %0,%1,%2,%3"
[(set_attr "type" "fp")])
@@ -5935,12 +5935,12 @@
}")
(define_insn_and_split "*floatsidf2_internal"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
(float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
(use (match_operand:SI 2 "gpc_reg_operand" "r"))
- (use (match_operand:DF 3 "gpc_reg_operand" "f"))
+ (use (match_operand:DF 3 "gpc_reg_operand" "d"))
(clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
- (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))
+ (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))
(clobber (match_operand:SI 6 "gpc_reg_operand" "=&r"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"#"
@@ -6003,12 +6003,12 @@
}")
(define_insn_and_split "*floatunssidf2_internal"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=&f")
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=&d")
(unsigned_float:DF (match_operand:SI 1 "gpc_reg_operand" "r")))
(use (match_operand:SI 2 "gpc_reg_operand" "r"))
- (use (match_operand:DF 3 "gpc_reg_operand" "f"))
+ (use (match_operand:DF 3 "gpc_reg_operand" "d"))
(clobber (match_operand:DF 4 "offsettable_mem_operand" "=o"))
- (clobber (match_operand:DF 5 "gpc_reg_operand" "=&f"))]
+ (clobber (match_operand:DF 5 "gpc_reg_operand" "=&d"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"#"
"&& (can_create_pseudo_p () || offsettable_nonstrict_memref_p (operands[4]))"
@@ -6072,8 +6072,8 @@
(define_insn_and_split "*fix_truncdfsi2_internal"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
- (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
+ (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
+ (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
(clobber (match_operand:DI 3 "offsettable_mem_operand" "=o"))]
"(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT"
@@ -6095,8 +6095,8 @@
(define_insn_and_split "fix_truncdfsi2_internal_gfxopt"
[(set (match_operand:SI 0 "memory_operand" "=Z")
- (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
- (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))]
+ (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
+ (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))]
"(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT
&& TARGET_PPC_GFXOPT"
@@ -6113,8 +6113,8 @@
(define_insn_and_split "fix_truncdfsi2_mfpgpr"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (fix:SI (match_operand:DF 1 "gpc_reg_operand" "f")))
- (clobber (match_operand:DI 2 "gpc_reg_operand" "=f"))
+ (fix:SI (match_operand:DF 1 "gpc_reg_operand" "d")))
+ (clobber (match_operand:DI 2 "gpc_reg_operand" "=d"))
(clobber (match_operand:DI 3 "gpc_reg_operand" "=r"))]
"TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT"
@@ -6131,8 +6131,8 @@
; because the first makes it clear that operand 0 is not live
; before the instruction.
(define_insn "fctiwz"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=f")
- (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "f"))]
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=d")
+ (unspec:DI [(fix:SI (match_operand:DF 1 "gpc_reg_operand" "d"))]
UNSPEC_FCTIWZ))]
"(TARGET_POWER2 || TARGET_POWERPC) && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT"
@@ -6140,8 +6140,8 @@
[(set_attr "type" "fp")])
(define_insn "btruncdf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIZ))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIZ))]
"TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"friz %0,%1"
[(set_attr "type" "fp")])
@@ -6154,8 +6154,8 @@
[(set_attr "type" "fp")])
(define_insn "ceildf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIP))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIP))]
"TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"frip %0,%1"
[(set_attr "type" "fp")])
@@ -6168,8 +6168,8 @@
[(set_attr "type" "fp")])
(define_insn "floordf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIM))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIM))]
"TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"frim %0,%1"
[(set_attr "type" "fp")])
@@ -6182,8 +6182,8 @@
[(set_attr "type" "fp")])
(define_insn "rounddf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "f")] UNSPEC_FRIN))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:DF 1 "gpc_reg_operand" "d")] UNSPEC_FRIN))]
"TARGET_FPRND && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"frin %0,%1"
[(set_attr "type" "fp")])
@@ -6198,7 +6198,7 @@
; An UNSPEC is used so we don't have to support SImode in FP registers.
(define_insn "stfiwx"
[(set (match_operand:SI 0 "memory_operand" "=Z")
- (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "f")]
+ (unspec:SI [(match_operand:DI 1 "gpc_reg_operand" "d")]
UNSPEC_STFIWX))]
"TARGET_PPC_GFXOPT"
"stfiwx %1,%y0"
@@ -6211,15 +6211,15 @@
"")
(define_insn "floatdidf2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (float:DF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (float:DF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))]
"(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
"fcfid %0,%1"
[(set_attr "type" "fp")])
(define_insn "fix_truncdfdi2"
- [(set (match_operand:DI 0 "gpc_reg_operand" "=!f#r")
- (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DI 0 "gpc_reg_operand" "=!d#r")
+ (fix:DI (match_operand:DF 1 "gpc_reg_operand" "d")))]
"(TARGET_POWERPC64 || TARGET_XILINX_FPU) && TARGET_HARD_FLOAT && TARGET_DOUBLE_FLOAT && TARGET_FPRS"
"fctidz %0,%1"
[(set_attr "type" "fp")])
@@ -6247,8 +6247,8 @@
;; from double rounding.
(define_insn_and_split "floatdisf2_internal1"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (float:SF (match_operand:DI 1 "gpc_reg_operand" "!f#r")))
- (clobber (match_scratch:DF 2 "=f"))]
+ (float:SF (match_operand:DI 1 "gpc_reg_operand" "!d#r")))
+ (clobber (match_scratch:DF 2 "=d"))]
"TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT"
"#"
"&& reload_completed"
@@ -8497,8 +8497,8 @@
;; The "??" is a kludge until we can figure out a more reasonable way
;; of handling these non-offsettable values.
(define_insn "*movdf_hardfloat32"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,f,f,m,!r,!r,!r")
- (match_operand:DF 1 "input_operand" "r,m,r,f,m,f,G,H,F"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=!r,??r,m,d,d,m,!r,!r,!r")
+ (match_operand:DF 1 "input_operand" "r,m,r,d,m,d,G,H,F"))]
"! TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], DFmode)
|| gpc_reg_operand (operands[1], DFmode))"
@@ -8637,8 +8637,8 @@
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*movdf_hardfloat64_mfpgpr"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r,r,f")
- (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F,f,r"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r,r,d")
+ (match_operand:DF 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F,d,r"))]
"TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], DFmode)
@@ -8664,8 +8664,8 @@
; ld/std require word-aligned displacements -> 'Y' constraint.
; List Y->r and r->Y before r->r for reload.
(define_insn "*movdf_hardfloat64"
- [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,*c*l,!r,*h,!r,!r,!r")
- (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))]
+ [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,d,d,m,*c*l,!r,*h,!r,!r,!r")
+ (match_operand:DF 1 "input_operand" "r,Y,r,d,m,d,r,h,0,G,H,F"))]
"TARGET_POWERPC64 && !TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
&& TARGET_DOUBLE_FLOAT
&& (gpc_reg_operand (operands[0], DFmode)
@@ -8715,8 +8715,8 @@
; otherwise reload, given m->f, will try to pick f->f and reload it,
; which doesn't make progress. Likewise r->Y must be before r->r.
(define_insn_and_split "*movtf_internal"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,f,r,Y,r")
- (match_operand:TF 1 "input_operand" "f,o,f,YGHF,r,r"))]
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,d,r,Y,r")
+ (match_operand:TF 1 "input_operand" "d,o,d,YGHF,r,r"))]
"!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128
&& (gpc_reg_operand (operands[0], TFmode)
@@ -8770,9 +8770,9 @@
})
(define_insn_and_split "*extenddftf2_internal"
- [(set (match_operand:TF 0 "nonimmediate_operand" "=o,f,&f,r")
- (float_extend:TF (match_operand:DF 1 "input_operand" "fr,mf,mf,rmGHF")))
- (use (match_operand:DF 2 "zero_reg_mem_operand" "rf,m,f,n"))]
+ [(set (match_operand:TF 0 "nonimmediate_operand" "=o,d,&d,r")
+ (float_extend:TF (match_operand:DF 1 "input_operand" "dr,md,md,rmGHF")))
+ (use (match_operand:DF 2 "zero_reg_mem_operand" "rd,m,d,n"))]
"!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& TARGET_LONG_DOUBLE_128"
@@ -8813,8 +8813,8 @@
"")
(define_insn_and_split "trunctfdf2_internal1"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f,?f")
- (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d,?d")
+ (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "0,d")))]
"!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
"@
@@ -8829,8 +8829,8 @@
[(set_attr "type" "fp")])
(define_insn "trunctfdf2_internal2"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (float_truncate:DF (match_operand:TF 1 "gpc_reg_operand" "d")))]
"!TARGET_IEEEQUAD && TARGET_XL_COMPAT
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT
&& TARGET_LONG_DOUBLE_128"
@@ -8855,8 +8855,8 @@
(define_insn_and_split "trunctfsf2_fprs"
[(set (match_operand:SF 0 "gpc_reg_operand" "=f")
- (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "f")))
- (clobber (match_scratch:DF 2 "=f"))]
+ (float_truncate:SF (match_operand:TF 1 "gpc_reg_operand" "d")))
+ (clobber (match_scratch:DF 2 "=d"))]
"!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_SINGLE_FLOAT
&& TARGET_LONG_DOUBLE_128"
@@ -8885,10 +8885,10 @@
; fadd, but rounding towards zero.
; This is probably not the optimal code sequence.
(define_insn "fix_trunc_helper"
- [(set (match_operand:DF 0 "gpc_reg_operand" "=f")
- (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "f")]
+ [(set (match_operand:DF 0 "gpc_reg_operand" "=d")
+ (unspec:DF [(match_operand:TF 1 "gpc_reg_operand" "d")]
UNSPEC_FIX_TRUNC_TF))
- (clobber (match_operand:DF 2 "gpc_reg_operand" "=&f"))]
+ (clobber (match_operand:DF 2 "gpc_reg_operand" "=&d"))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"mffs %2\n\tmtfsb1 31\n\tmtfsb0 30\n\tfadd %0,%1,%L1\n\tmtfsf 1,%2"
[(set_attr "type" "fp")
@@ -8929,10 +8929,10 @@
(define_insn_and_split "*fix_trunctfsi2_internal"
[(set (match_operand:SI 0 "gpc_reg_operand" "=r")
- (fix:SI (match_operand:TF 1 "gpc_reg_operand" "f")))
- (clobber (match_operand:DF 2 "gpc_reg_operand" "=f"))
- (clobber (match_operand:DF 3 "gpc_reg_operand" "=&f"))
- (clobber (match_operand:DI 4 "gpc_reg_operand" "=f"))
+ (fix:SI (match_operand:TF 1 "gpc_reg_operand" "d")))
+ (clobber (match_operand:DF 2 "gpc_reg_operand" "=d"))
+ (clobber (match_operand:DF 3 "gpc_reg_operand" "=&d"))
+ (clobber (match_operand:DI 4 "gpc_reg_operand" "=d"))
(clobber (match_operand:DI 5 "offsettable_mem_operand" "=o"))]
"!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
@@ -8962,8 +8962,8 @@
"")
(define_insn "negtf2_internal"
- [(set (match_operand:TF 0 "gpc_reg_operand" "=f")
- (neg:TF (match_operand:TF 1 "gpc_reg_operand" "f")))]
+ [(set (match_operand:TF 0 "gpc_reg_operand" "=d")
+ (neg:TF (match_operand:TF 1 "gpc_reg_operand" "d")))]
"!TARGET_IEEEQUAD
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_LONG_DOUBLE_128"
"*
@@ -9028,8 +9028,8 @@
; List r->r after r->"o<>", otherwise reload will try to reload a
; non-offsettable address by using r->r which won't make progress.
(define_insn "*movdi_internal32"
- [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*f,*f,m,r")
- (match_operand:DI 1 "input_operand" "r,r,m,f,m,f,IJKnGHF"))]
+ [(set (match_operand:DI 0 "rs6000_nonimmediate_operand" "=o<>,r,r,*d,*d,m,r")
+ (match_operand:DI 1 "input_operand" "r,r,m,d,m,d,IJKnGHF"))]
"! TARGET_POWERPC64
&& (gpc_reg_operand (operands[0], DImode)
|| gpc_reg_operand (operands[1], DImode))"
@@ -9073,8 +9073,8 @@
{ rs6000_split_multireg_move (operands[0], operands[1]); DONE; })
(define_insn "*movdi_mfpgpr"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h,r,*f")
- (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0,*f,r"))]
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h,r,*d")
+ (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0,*d,r"))]
"TARGET_POWERPC64 && TARGET_MFPGPR && TARGET_HARD_FLOAT && TARGET_FPRS
&& (gpc_reg_operand (operands[0], DImode)
|| gpc_reg_operand (operands[1], DImode))"
@@ -9098,8 +9098,8 @@
(set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4,4,4")])
(define_insn "*movdi_internal64"
- [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*f,*f,m,r,*h,*h")
- (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,f,m,f,*h,r,0"))]
+ [(set (match_operand:DI 0 "nonimmediate_operand" "=r,r,m,r,r,r,r,*d,*d,m,r,*h,*h")
+ (match_operand:DI 1 "input_operand" "r,m,r,I,L,nF,R,d,m,d,*h,r,0"))]
"TARGET_POWERPC64 && (!TARGET_MFPGPR || !TARGET_HARD_FLOAT || !TARGET_FPRS)
&& (gpc_reg_operand (operands[0], DImode)
|| gpc_reg_operand (operands[1], DImode))"
@@ -10293,7 +10293,7 @@
[(set_attr "type" "store_ux,store_u")])
(define_insn "*movdf_update1"
- [(set (match_operand:DF 3 "gpc_reg_operand" "=f,f")
+ [(set (match_operand:DF 3 "gpc_reg_operand" "=d,d")
(mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
(match_operand:SI 2 "reg_or_short_operand" "r,I"))))
(set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
@@ -10309,7 +10309,7 @@
(define_insn "*movdf_update2"
[(set (mem:DF (plus:SI (match_operand:SI 1 "gpc_reg_operand" "0,0")
(match_operand:SI 2 "reg_or_short_operand" "r,I")))
- (match_operand:DF 3 "gpc_reg_operand" "f,f"))
+ (match_operand:DF 3 "gpc_reg_operand" "d,d"))
(set (match_operand:SI 0 "gpc_reg_operand" "=b,b")
(plus:SI (match_dup 1) (match_dup 2)))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_UPDATE
@@ -12186,8 +12186,8 @@
(define_insn "*cmpdf_internal1"
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "f")
- (match_operand:DF 2 "gpc_reg_operand" "f")))]
+ (compare:CCFP (match_operand:DF 1 "gpc_reg_operand" "d")
+ (match_operand:DF 2 "gpc_reg_operand" "d")))]
"TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT"
"fcmpu %0,%1,%2"
[(set_attr "type" "fpcompare")])
@@ -12195,8 +12195,8 @@
;; Only need to compare second words if first words equal
(define_insn "*cmptf_internal1"
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
- (match_operand:TF 2 "gpc_reg_operand" "f")))]
+ (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
+ (match_operand:TF 2 "gpc_reg_operand" "d")))]
"!TARGET_IEEEQUAD && !TARGET_XL_COMPAT
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
"fcmpu %0,%1,%2\;bne %0,$+8\;fcmpu %0,%L1,%L2"
@@ -12205,16 +12205,16 @@
(define_insn_and_split "*cmptf_internal2"
[(set (match_operand:CCFP 0 "cc_reg_operand" "=y")
- (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "f")
- (match_operand:TF 2 "gpc_reg_operand" "f")))
- (clobber (match_scratch:DF 3 "=f"))
- (clobber (match_scratch:DF 4 "=f"))
- (clobber (match_scratch:DF 5 "=f"))
- (clobber (match_scratch:DF 6 "=f"))
- (clobber (match_scratch:DF 7 "=f"))
- (clobber (match_scratch:DF 8 "=f"))
- (clobber (match_scratch:DF 9 "=f"))
- (clobber (match_scratch:DF 10 "=f"))]
+ (compare:CCFP (match_operand:TF 1 "gpc_reg_operand" "d")
+ (match_operand:TF 2 "gpc_reg_operand" "d")))
+ (clobber (match_scratch:DF 3 "=d"))
+ (clobber (match_scratch:DF 4 "=d"))
+ (clobber (match_scratch:DF 5 "=d"))
+ (clobber (match_scratch:DF 6 "=d"))
+ (clobber (match_scratch:DF 7 "=d"))
+ (clobber (match_scratch:DF 8 "=d"))
+ (clobber (match_scratch:DF 9 "=d"))
+ (clobber (match_scratch:DF 10 "=d"))]
"!TARGET_IEEEQUAD && TARGET_XL_COMPAT
&& TARGET_HARD_FLOAT && TARGET_FPRS && TARGET_DOUBLE_FLOAT && TARGET_LONG_DOUBLE_128"
"#"
@@ -14689,7 +14689,7 @@
(use (match_operand:P 1 "symbol_ref_operand" "s"))
(use (match_operand:P 2 "gpc_reg_operand" "r"))
(set (match_operand:DF 3 "memory_operand" "=m")
- (match_operand:DF 4 "gpc_reg_operand" "f"))])]
+ (match_operand:DF 4 "gpc_reg_operand" "d"))])]
""
"bl %z1"
[(set_attr "type" "branch")
@@ -14809,7 +14809,7 @@
(clobber (match_operand:P 1 "register_operand" "=l"))
(use (match_operand:P 2 "symbol_ref_operand" "s"))
(use (match_operand:P 3 "gpc_reg_operand" "r"))
- (set (match_operand:DF 4 "gpc_reg_operand" "=f")
+ (set (match_operand:DF 4 "gpc_reg_operand" "=d")
(match_operand:DF 5 "memory_operand" "m"))])]
""
"b %z2"
diff --git a/gcc/convert.c b/gcc/convert.c
index b6a9d3dc531..8245e1647fb 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -482,6 +482,37 @@ convert_to_integer (tree type, tree expr)
}
}
+ /* Convert (int)logb(d) -> ilogb(d). */
+ if (optimize
+ && flag_unsafe_math_optimizations
+ && !flag_trapping_math && !flag_errno_math && flag_finite_math_only
+ && integer_type_node
+ && (outprec > TYPE_PRECISION (integer_type_node)
+ || (outprec == TYPE_PRECISION (integer_type_node)
+ && !TYPE_UNSIGNED (type))))
+ {
+ tree s_expr = strip_float_extensions (expr);
+ tree s_intype = TREE_TYPE (s_expr);
+ const enum built_in_function fcode = builtin_mathfn_code (s_expr);
+ tree fn = 0;
+
+ switch (fcode)
+ {
+ CASE_FLT_FN (BUILT_IN_LOGB):
+ fn = mathfn_built_in (s_intype, BUILT_IN_ILOGB);
+ break;
+
+ default:
+ break;
+ }
+
+ if (fn)
+ {
+ tree newexpr = build_call_expr (fn, 1, CALL_EXPR_ARG (s_expr, 0));
+ return convert_to_integer (type, newexpr);
+ }
+ }
+
switch (TREE_CODE (intype))
{
case POINTER_TYPE:
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 911081ae5ac..62f93a98526 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,58 @@
+2009-06-16 David Edelsohn <edelsohn@gnu.org>
+
+ * g++-spec.c (LIBSTDCXX_STATIC): Default to NULL.
+ (lang_specific_driver): Always allocate extra argument.
+ Add LIBSTDCXX_STATIC to arglist if defined and linking
+ statically.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * Make-lang.in (cp/class.o): Depend upon gt-cp-class.h.
+ (cp/semantics.o): Depend upon gt-cp-semantics.h.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * parser.c (cp_unevaluated_operand): Define global variable.
+ (cp_parser_question_colon_clause): Increment
+ c_inhibit_evaluation_warnings when evaluating an expression which
+ will never be executed.
+ (cp_parser_decltype): Increment cp_unevaluated_operand and
+ c_inhibit_evaluation_warnings, not skip_evaluation.
+ (cp_parser_sizeof_operand): Likewise.
+ (cp_parser_enclosed_template_argument_list): Save
+ cp_unevaluated_operand and c_inhibit_evaluation_warnings, not
+ skip_evaluation.
+ * cp-tree.h (struct saved_scope): Remove skip_evaluation field.
+ Add unevaluated_operand and inhibit_evaluation_warnings fields.
+ (cp_unevaluated_operand): Declare.
+ * name-lookup.c (push_to_top_level): Save cp_unevaluated_operand
+ and c_inhibit_evaluation_warnings rather than skip_evaluation.
+ (pop_from_top_level): Restore cp_unevaluated_operand and
+ c_inhibit_evaluation_warnings rather than skip_evaluation.
+ * class.c (build_base_path): Check cp_unevaluated_operand rather
+ than skip_evaluation.
+ * typeck.c (build_class_member_access_expr): Likewise.
+ (cp_build_binary_op): Don't warn about bad shift counts if
+ c_inhibit_evaluation_warnings is non-zero.
+ * pt.c (coerce_template_parms): Save state of
+ cp_unevaluated_operand and c_inhibit_evaluation_warnings, not
+ skip_evaluation.
+ (tsubst_aggr_type): Likewise.
+ (tsubst_pack_expansion): Check cp_unevaluated_operand rather than
+ skip_evaluation.
+ (tsubst_copy): Likewise.
+ (tsubst): Set cp_unevaluated_operand and
+ c_inhibit_evaluation_warnings, not skip_evaluation.
+ (tsubst_copy_and_build): Likewise.
+ * call.c (convert_arg_to_ellipsis): Check cp_unevaluated_operand
+ rather than skip_evaluation.
+ * decl2.c (mark_used): Likewise.
+ * semantics.c (finish_non_static_data_member): Likewise.
+ * cvt.c (cp_convert_and_check): Check
+ c_inhibit_evaluation_warnings rather than skip_evaluation.
+ * mangle.c (write_type): Set cp_unevaluated_operand rather than
+ skip_evaluation.
+
2009-06-15 Ian Lance Taylor <iant@google.com>
* parser.c (cp_parser_direct_declarator): Add braces around
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index 4c25122d65a..2c562f873f6 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -253,7 +253,7 @@ cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h output.h \
cp/typeck.o: cp/typeck.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(RTL_H) $(EXPR_H) \
toplev.h $(DIAGNOSTIC_H) convert.h $(C_COMMON_H) $(TARGET_H)
cp/class.o: cp/class.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \
- $(TARGET_H) convert.h $(CGRAPH_H) $(TREE_DUMP_H)
+ $(TARGET_H) convert.h $(CGRAPH_H) $(TREE_DUMP_H) gt-cp-class.h
cp/call.o: cp/call.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \
$(EXPR_H) $(DIAGNOSTIC_H) intl.h gt-cp-call.h convert.h $(TARGET_H) langhooks.h
cp/friend.o: cp/friend.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) $(RTL_H) toplev.h \
@@ -284,7 +284,8 @@ cp/repo.o: cp/repo.c $(CXX_TREE_H) $(TM_H) toplev.h $(DIAGNOSTIC_H) \
gt-cp-repo.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) $(TM_H) except.h toplev.h \
$(FLAGS_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \
- $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H)
+ $(TREE_INLINE_H) $(CGRAPH_H) $(TARGET_H) $(C_COMMON_H) $(GIMPLE_H) \
+ gt-cp-semantics.h
cp/dump.o: cp/dump.c $(CXX_TREE_H) $(TM_H) $(TREE_DUMP_H)
cp/optimize.o: cp/optimize.c $(CXX_TREE_H) $(TM_H) rtl.h $(INTEGRATE_H) \
insn-config.h input.h $(PARAMS_H) debug.h $(TREE_INLINE_H) $(GIMPLE_H) \
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f33d64573dd..e89d5857edc 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5064,7 +5064,7 @@ convert_arg_to_ellipsis (tree arg)
If the call appears in the context of a sizeof expression,
there is no need to emit a warning, since the expression won't be
evaluated. We keep the builtin_trap just as a safety check. */
- if (!skip_evaluation)
+ if (cp_unevaluated_operand == 0)
warning (0, "cannot pass objects of non-POD type %q#T through %<...%>; "
"call will abort at runtime", TREE_TYPE (arg));
arg = call_builtin_trap ();
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 94b75ca6153..b762019cf83 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -295,7 +295,7 @@ build_base_path (enum tree_code code,
/* Don't bother with the calculations inside sizeof; they'll ICE if the
source type is incomplete and the pointer value doesn't matter. */
- if (skip_evaluation)
+ if (cp_unevaluated_operand != 0)
{
expr = build_nop (build_pointer_type (target_type), expr);
if (!want_pointer)
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 4cb34f53700..8c45b8a3a68 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -755,7 +755,9 @@ struct GTY(()) saved_scope {
int x_processing_specialization;
BOOL_BITFIELD x_processing_explicit_instantiation : 1;
BOOL_BITFIELD need_pop_function_context : 1;
- BOOL_BITFIELD skip_evaluation : 1;
+
+ int unevaluated_operand;
+ int inhibit_evaluation_warnings;
struct stmt_tree_s x_stmt_tree;
@@ -3621,6 +3623,14 @@ extern GTY(()) tree integer_three_node;
function, two inside the body of a function in a local class, etc.) */
extern int function_depth;
+/* In parser.c. */
+
+/* Nonzero if we are parsing an unevaluated operand: an operand to
+ sizeof, typeof, or alignof. This is a count since operands to
+ sizeof can be nested. */
+
+extern int cp_unevaluated_operand;
+
/* in pt.c */
/* These values are used for the `STRICT' parameter to type_unification and
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 596e81c9cce..dfd0ea81e75 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -565,7 +565,9 @@ cp_convert_and_check (tree type, tree expr)
result = cp_convert (type, expr);
- if (!skip_evaluation && !TREE_OVERFLOW_P (expr) && result != error_mark_node)
+ if (c_inhibit_evaluation_warnings == 0
+ && !TREE_OVERFLOW_P (expr)
+ && result != error_mark_node)
warnings_for_convert_and_check (type, expr, result);
return result;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 495c8e7a089..308f767cc09 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3815,7 +3815,7 @@ mark_used (tree decl)
return;
}
/* If we don't need a value, then we don't need to synthesize DECL. */
- if (skip_evaluation)
+ if (cp_unevaluated_operand != 0)
return;
/* If within finish_function, defer the rest until that function
diff --git a/gcc/cp/g++spec.c b/gcc/cp/g++spec.c
index 8828573ef54..f49d699c832 100644
--- a/gcc/cp/g++spec.c
+++ b/gcc/cp/g++spec.c
@@ -45,7 +45,7 @@ along with GCC; see the file COPYING3. If not see
#define LIBSTDCXX_PROFILE LIBSTDCXX
#endif
#ifndef LIBSTDCXX_STATIC
-#define LIBSTDCXX_STATIC LIBSTDCXX
+#define LIBSTDCXX_STATIC NULL
#endif
void
@@ -259,8 +259,9 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
shared_libgcc = 0;
#endif
- /* Make sure to have room for the trailing NULL argument. */
- num_args = argc + added + need_math + shared_libgcc + (library > 0) + 1;
+ /* Make sure to have room for the trailing NULL argument.
+ Add one for shared_libgcc or extra static library. */
+ num_args = argc + added + need_math + (library > 0) + 2;
arglist = XNEWVEC (const char *, num_args);
i = 0;
@@ -318,8 +319,15 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
/* Add `-lstdc++' if we haven't already done so. */
if (library > 0)
{
- arglist[j] = shared_libgcc == 0 ? LIBSTDCXX_STATIC
- : saw_profile_flag ? LIBSTDCXX_PROFILE : LIBSTDCXX;
+ arglist[j] = saw_profile_flag ? LIBSTDCXX_PROFILE : LIBSTDCXX;
+ if (arglist[j][0] != '-' || arglist[j][1] == 'l')
+ added_libraries++;
+ j++;
+ }
+ /* Add target-dependent static library, if necessary. */
+ if (shared_libgcc == 0 && LIBSTDCXX_STATIC != NULL)
+ {
+ arglist[j] = LIBSTDCXX_STATIC;
if (arglist[j][0] != '-' || arglist[j][1] == 'l')
added_libraries++;
j++;
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index c905304eac6..f7d9d416988 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1684,9 +1684,9 @@ write_type (tree type)
write_char ('t');
else
write_char ('T');
- ++skip_evaluation;
+ ++cp_unevaluated_operand;
write_expression (DECLTYPE_TYPE_EXPR (type));
- --skip_evaluation;
+ --cp_unevaluated_operand;
write_char ('E');
break;
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index f6b22bb6793..143fcf31568 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5319,7 +5319,8 @@ push_to_top_level (void)
s->bindings = b;
s->need_pop_function_context = need_pop;
s->function_decl = current_function_decl;
- s->skip_evaluation = skip_evaluation;
+ s->unevaluated_operand = cp_unevaluated_operand;
+ s->inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
scope_chain = s;
current_function_decl = NULL_TREE;
@@ -5327,7 +5328,8 @@ push_to_top_level (void)
current_lang_name = lang_name_cplusplus;
current_namespace = global_namespace;
push_class_stack ();
- skip_evaluation = 0;
+ cp_unevaluated_operand = 0;
+ c_inhibit_evaluation_warnings = 0;
timevar_pop (TV_NAME_LOOKUP);
}
@@ -5360,7 +5362,8 @@ pop_from_top_level (void)
if (s->need_pop_function_context)
pop_function_context ();
current_function_decl = s->function_decl;
- skip_evaluation = s->skip_evaluation;
+ cp_unevaluated_operand = s->unevaluated_operand;
+ c_inhibit_evaluation_warnings = s->inhibit_evaluation_warnings;
timevar_pop (TV_NAME_LOOKUP);
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 0314bb32ea2..bdf305827f0 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -247,6 +247,10 @@ static void cp_parser_initial_pragma
static FILE *cp_lexer_debug_stream;
#endif /* ENABLE_CHECKING */
+/* Nonzero if we are parsing an unevaluated operand: an operand to
+ sizeof, typeof, or alignof. */
+int cp_unevaluated_operand;
+
/* Create a new main C++ lexer, the lexer that gets tokens from the
preprocessor. */
@@ -6385,16 +6389,26 @@ cp_parser_question_colon_clause (cp_parser* parser, tree logical_or_expr)
cp_lexer_consume_token (parser->lexer);
if (cp_parser_allow_gnu_extensions_p (parser)
&& cp_lexer_next_token_is (parser->lexer, CPP_COLON))
- /* Implicit true clause. */
- expr = NULL_TREE;
+ {
+ /* Implicit true clause. */
+ expr = NULL_TREE;
+ c_inhibit_evaluation_warnings += logical_or_expr == truthvalue_true_node;
+ }
else
- /* Parse the expression. */
- expr = cp_parser_expression (parser, /*cast_p=*/false, NULL);
+ {
+ /* Parse the expression. */
+ c_inhibit_evaluation_warnings += logical_or_expr == truthvalue_false_node;
+ expr = cp_parser_expression (parser, /*cast_p=*/false, NULL);
+ c_inhibit_evaluation_warnings +=
+ ((logical_or_expr == truthvalue_true_node)
+ - (logical_or_expr == truthvalue_false_node));
+ }
/* The next token should be a `:'. */
cp_parser_require (parser, CPP_COLON, "%<:%>");
/* Parse the assignment-expression. */
assignment_expr = cp_parser_assignment_expression (parser, /*cast_p=*/false, NULL);
+ c_inhibit_evaluation_warnings -= logical_or_expr == truthvalue_true_node;
/* Build the conditional-expression. */
return build_x_conditional_expr (logical_or_expr,
@@ -8857,7 +8871,10 @@ cp_parser_decltype (cp_parser *parser)
parser->integral_constant_expression_p = false;
/* Do not actually evaluate the expression. */
- ++skip_evaluation;
+ ++cp_unevaluated_operand;
+
+ /* Do not warn about problems with the expression. */
+ ++c_inhibit_evaluation_warnings;
/* Parse the opening `('. */
if (!cp_parser_require (parser, CPP_OPEN_PAREN, "%<(%>"))
@@ -8961,7 +8978,8 @@ cp_parser_decltype (cp_parser *parser)
}
/* Go back to evaluating expressions. */
- --skip_evaluation;
+ --cp_unevaluated_operand;
+ --c_inhibit_evaluation_warnings;
/* Restore the old message and the integral constant expression
flags. */
@@ -18188,7 +18206,8 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
tree saved_qualifying_scope;
tree saved_object_scope;
bool saved_greater_than_is_operator_p;
- bool saved_skip_evaluation;
+ int saved_unevaluated_operand;
+ int saved_inhibit_evaluation_warnings;
/* [temp.names]
@@ -18205,8 +18224,10 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
saved_object_scope = parser->object_scope;
/* We need to evaluate the template arguments, even though this
template-id may be nested within a "sizeof". */
- saved_skip_evaluation = skip_evaluation;
- skip_evaluation = false;
+ saved_unevaluated_operand = cp_unevaluated_operand;
+ cp_unevaluated_operand = 0;
+ saved_inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
+ c_inhibit_evaluation_warnings = 0;
/* Parse the template-argument-list itself. */
if (cp_lexer_next_token_is (parser->lexer, CPP_GREATER)
|| cp_lexer_next_token_is (parser->lexer, CPP_RSHIFT))
@@ -18273,7 +18294,8 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser)
parser->scope = saved_scope;
parser->qualifying_scope = saved_qualifying_scope;
parser->object_scope = saved_object_scope;
- skip_evaluation = saved_skip_evaluation;
+ cp_unevaluated_operand = saved_unevaluated_operand;
+ c_inhibit_evaluation_warnings = saved_inhibit_evaluation_warnings;
return arguments;
}
@@ -18507,7 +18529,8 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
}
/* Do not actually evaluate the expression. */
- ++skip_evaluation;
+ ++cp_unevaluated_operand;
+ ++c_inhibit_evaluation_warnings;
/* If it's a `(', then we might be looking at the type-id
construction. */
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN))
@@ -18556,7 +18579,8 @@ cp_parser_sizeof_operand (cp_parser* parser, enum rid keyword)
expr = make_pack_expansion (expr);
/* Go back to evaluating expressions. */
- --skip_evaluation;
+ --cp_unevaluated_operand;
+ --c_inhibit_evaluation_warnings;
/* Free the message we created. */
free (tmp);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 7fe40122566..5645b23e27f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5264,7 +5264,8 @@ coerce_template_parms (tree parms,
tree inner_args;
tree new_args;
tree new_inner_args;
- bool saved_skip_evaluation;
+ int saved_unevaluated_operand;
+ int saved_inhibit_evaluation_warnings;
/* When used as a boolean value, indicates whether this is a
variadic template parameter list. Since it's an int, we can also
@@ -5322,8 +5323,10 @@ coerce_template_parms (tree parms,
/* We need to evaluate the template arguments, even though this
template-id may be nested within a "sizeof". */
- saved_skip_evaluation = skip_evaluation;
- skip_evaluation = false;
+ saved_unevaluated_operand = cp_unevaluated_operand;
+ cp_unevaluated_operand = 0;
+ saved_inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
+ c_inhibit_evaluation_warnings = 0;
new_inner_args = make_tree_vec (nparms);
new_args = add_outermost_template_args (args, new_inner_args);
for (parm_idx = 0, arg_idx = 0; parm_idx < nparms; parm_idx++, arg_idx++)
@@ -5416,7 +5419,8 @@ coerce_template_parms (tree parms,
lost++;
TREE_VEC_ELT (new_inner_args, arg_idx) = arg;
}
- skip_evaluation = saved_skip_evaluation;
+ cp_unevaluated_operand = saved_unevaluated_operand;
+ c_inhibit_evaluation_warnings = saved_inhibit_evaluation_warnings;
if (lost)
return error_mark_node;
@@ -7553,7 +7557,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
/* This can happen for a parameter name used later in a function
declaration (such as in a late-specified return type). Just
make a dummy decl, since it's only used for its type. */
- gcc_assert (skip_evaluation);
+ gcc_assert (cp_unevaluated_operand != 0);
arg_pack = tsubst_decl (parm_pack, args, complain);
arg_pack = make_fnparm_pack (arg_pack);
}
@@ -7944,11 +7948,14 @@ tsubst_aggr_type (tree t,
tree argvec;
tree context;
tree r;
- bool saved_skip_evaluation;
+ int saved_unevaluated_operand;
+ int saved_inhibit_evaluation_warnings;
/* In "sizeof(X<I>)" we need to evaluate "I". */
- saved_skip_evaluation = skip_evaluation;
- skip_evaluation = false;
+ saved_unevaluated_operand = cp_unevaluated_operand;
+ cp_unevaluated_operand = 0;
+ saved_inhibit_evaluation_warnings = c_inhibit_evaluation_warnings;
+ c_inhibit_evaluation_warnings = 0;
/* First, determine the context for the type we are looking
up. */
@@ -7983,7 +7990,8 @@ tsubst_aggr_type (tree t,
r = cp_build_qualified_type_real (r, TYPE_QUALS (t), complain);
}
- skip_evaluation = saved_skip_evaluation;
+ cp_unevaluated_operand = saved_unevaluated_operand;
+ c_inhibit_evaluation_warnings = saved_inhibit_evaluation_warnings;
return r;
}
@@ -9782,13 +9790,15 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
tree type;
- ++skip_evaluation;
+ ++cp_unevaluated_operand;
+ ++c_inhibit_evaluation_warnings;
type = tsubst_expr (DECLTYPE_TYPE_EXPR (t), args,
complain, in_decl,
/*integral_constant_expression_p=*/false);
- --skip_evaluation;
+ --cp_unevaluated_operand;
+ --c_inhibit_evaluation_warnings;
type =
finish_decltype_type (type,
@@ -10047,7 +10057,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
/* This can happen for a parameter name used later in a function
declaration (such as in a late-specified return type). Just
make a dummy decl, since it's only used for its type. */
- gcc_assert (skip_evaluation);
+ gcc_assert (cp_unevaluated_operand != 0);
/* We copy T because want to tsubst the PARM_DECL only,
not the following PARM_DECLs that are chained to T. */
c = copy_node (t);
@@ -11407,11 +11417,13 @@ tsubst_copy_and_build (tree t,
}
else
{
- ++skip_evaluation;
+ ++cp_unevaluated_operand;
+ ++c_inhibit_evaluation_warnings;
op1 = tsubst_copy_and_build (op1, args, complain, in_decl,
/*function_p=*/false,
/*integral_constant_expression_p=*/false);
- --skip_evaluation;
+ --cp_unevaluated_operand;
+ --c_inhibit_evaluation_warnings;
}
if (TYPE_P (op1))
return cxx_sizeof_or_alignof_type (op1, TREE_CODE (t),
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index bacb09a1262..9a43863c6bb 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1423,7 +1423,7 @@ finish_non_static_data_member (tree decl, tree object, tree qualifying_scope)
{
gcc_assert (TREE_CODE (decl) == FIELD_DECL);
- if (!object && skip_evaluation)
+ if (!object && cp_unevaluated_operand != 0)
{
/* DR 613: Can use non-static data members without an associated
object in sizeof/decltype/alignof. */
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 1ad75065d6e..e3ed871f718 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2019,7 +2019,7 @@ build_class_member_access_expr (tree object, tree member,
if (null_object_p && warn_invalid_offsetof
&& CLASSTYPE_NON_POD_P (object_type)
&& !DECL_FIELD_IS_BASE (member)
- && !skip_evaluation
+ && cp_unevaluated_operand == 0
&& (complain & tf_warning))
{
warning (OPT_Winvalid_offsetof,
@@ -3559,13 +3559,15 @@ cp_build_binary_op (location_t location,
{
if (tree_int_cst_lt (op1, integer_zero_node))
{
- if (complain & tf_warning)
+ if ((complain & tf_warning)
+ && c_inhibit_evaluation_warnings == 0)
warning (0, "right shift count is negative");
}
else
{
if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0
- && (complain & tf_warning))
+ && (complain & tf_warning)
+ && c_inhibit_evaluation_warnings == 0)
warning (0, "right shift count >= width of type");
}
}
@@ -3586,12 +3588,14 @@ cp_build_binary_op (location_t location,
{
if (tree_int_cst_lt (op1, integer_zero_node))
{
- if (complain & tf_warning)
+ if ((complain & tf_warning)
+ && c_inhibit_evaluation_warnings == 0)
warning (0, "left shift count is negative");
}
else if (compare_tree_int (op1, TYPE_PRECISION (type0)) >= 0)
{
- if (complain & tf_warning)
+ if ((complain & tf_warning)
+ && c_inhibit_evaluation_warnings == 0)
warning (0, "left shift count >= width of type");
}
}
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 17fdf6efed1..ffb2ac2ef7b 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -333,7 +333,7 @@ static void dbxout_handle_pch (unsigned);
/* The debug hooks structure. */
#if defined (DBX_DEBUGGING_INFO)
-static void dbxout_source_line (unsigned int, const char *, int);
+static void dbxout_source_line (unsigned int, const char *, int, bool);
static void dbxout_begin_prologue (unsigned int, const char *);
static void dbxout_source_file (const char *);
static void dbxout_function_end (tree);
@@ -1265,7 +1265,7 @@ dbxout_begin_prologue (unsigned int lineno, const char *filename)
/* pre-increment the scope counter */
scope_labelno++;
- dbxout_source_line (lineno, filename, 0);
+ dbxout_source_line (lineno, filename, 0, true);
/* Output function begin block at function scope, referenced
by dbxout_block, dbxout_source_line and dbxout_function_end. */
emit_pending_bincls_if_required ();
@@ -1277,7 +1277,8 @@ dbxout_begin_prologue (unsigned int lineno, const char *filename)
static void
dbxout_source_line (unsigned int lineno, const char *filename,
- int discriminator ATTRIBUTE_UNUSED)
+ int discriminator ATTRIBUTE_UNUSED,
+ bool is_stmt ATTRIBUTE_UNUSED)
{
dbxout_source_file (filename);
diff --git a/gcc/debug.c b/gcc/debug.c
index c8e80a841c1..df69fd5eb82 100644
--- a/gcc/debug.c
+++ b/gcc/debug.c
@@ -34,7 +34,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_int_int, /* begin_block */
debug_nothing_int_int, /* end_block */
debug_true_const_tree, /* ignore_block */
- debug_nothing_int_charstar_int, /* source_line */
+ debug_nothing_int_charstar_int_bool, /* source_line */
debug_nothing_int_charstar, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
debug_nothing_int_charstar, /* end_epilogue */
@@ -104,9 +104,10 @@ debug_nothing_int_charstar (unsigned int line ATTRIBUTE_UNUSED,
}
void
-debug_nothing_int_charstar_int (unsigned int line ATTRIBUTE_UNUSED,
- const char *text ATTRIBUTE_UNUSED,
- int discriminator ATTRIBUTE_UNUSED)
+debug_nothing_int_charstar_int_bool (unsigned int line ATTRIBUTE_UNUSED,
+ const char *text ATTRIBUTE_UNUSED,
+ int discriminator ATTRIBUTE_UNUSED,
+ bool is_stmt ATTRIBUTE_UNUSED)
{
}
diff --git a/gcc/debug.h b/gcc/debug.h
index 8f76aff04a4..de525fec2cd 100644
--- a/gcc/debug.h
+++ b/gcc/debug.h
@@ -61,11 +61,10 @@ struct gcc_debug_hooks
/* Record a source file location at (FILE, LINE, DISCRIMINATOR). */
void (* source_line) (unsigned int line, const char *file,
- int discriminator);
+ int discriminator, bool is_stmt);
/* Called at start of prologue code. LINE is the first line in the
- function. This has been given the same prototype as source_line,
- so that the source_line hook can be substituted if appropriate. */
+ function. */
void (* begin_prologue) (unsigned int line, const char *file);
/* Called at end of prologue code. LINE is the first line in the
@@ -142,7 +141,8 @@ extern const struct gcc_debug_hooks *debug_hooks;
extern void debug_nothing_void (void);
extern void debug_nothing_charstar (const char *);
extern void debug_nothing_int_charstar (unsigned int, const char *);
-extern void debug_nothing_int_charstar_int (unsigned int, const char *, int);
+extern void debug_nothing_int_charstar_int_bool (unsigned int, const char *,
+ int, bool);
extern void debug_nothing_int (unsigned int);
extern void debug_nothing_int_int (unsigned int, unsigned int);
extern void debug_nothing_tree (tree);
diff --git a/gcc/defaults.h b/gcc/defaults.h
index b41f60366d5..a4b870ef45f 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -255,6 +255,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#endif
#endif
+/* This determines whether or not we support the discriminator
+ attribute in the .loc directive. */
+#ifndef SUPPORTS_DISCRIMINATOR
+#ifdef HAVE_GAS_DISCRIMINATOR
+#define SUPPORTS_DISCRIMINATOR 1
+#else
+#define SUPPORTS_DISCRIMINATOR 0
+#endif
+#endif
+
/* This determines whether or not we support link-once semantics. */
#ifndef SUPPORTS_ONE_ONLY
#ifdef MAKE_DECL_ONE_ONLY
diff --git a/gcc/df-problems.c b/gcc/df-problems.c
index 1d1dc9c9621..84dc42a1361 100644
--- a/gcc/df-problems.c
+++ b/gcc/df-problems.c
@@ -2509,8 +2509,8 @@ df_byte_lr_alloc (bitmap all_blocks ATTRIBUTE_UNUSED)
unsigned int regno;
unsigned int index = 0;
unsigned int max_reg = max_reg_num();
- struct df_byte_lr_problem_data *problem_data
- = problem_data = XNEW (struct df_byte_lr_problem_data);
+ struct df_byte_lr_problem_data *problem_data
+ = XNEW (struct df_byte_lr_problem_data);
df_byte_lr->problem_data = problem_data;
diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi
index 0804ae3201f..3a0806d0008 100644
--- a/gcc/doc/install.texi
+++ b/gcc/doc/install.texi
@@ -3397,6 +3397,20 @@ Support for AIX version 4.2 and older was discontinued in GCC 4.5.
process resource limits (ulimit). Hard limits are configured in the
@file{/etc/security/limits} system configuration file.
+GCC can bootstrap with recent versions of IBM XLC, but bootstrapping
+with an earlier release of GCC is recommended. Bootstrapping with XLC
+requires a larger data segment, which can be enabled through the
+@var{LDR_CNTRL} environment variable, e.g.,
+
+@smallexample
+ % LDR_CNTRL=MAXDATA=0x50000000
+ % export LDR_CNTRL
+@end smallexample
+
+One can start with a pre-compiled version of GCC to build from
+sources. One may delete GCC's ``fixed'' header files when starting
+with a version of GCC built for an earlier release of AIX.
+
To speed up the configuration phases of bootstrapping and installing GCC,
one may use GNU Bash instead of AIX @command{/bin/sh}, e.g.,
@@ -3426,11 +3440,9 @@ If this error occurs during stage2 or later, then the problem most likely
is the version of Make (see above).
The native @command{as} and @command{ld} are recommended for bootstrapping
-on AIX 4 and required for bootstrapping on AIX 5L@. The GNU Assembler
-reports that it supports WEAK symbols on AIX 4, which causes GCC to try to
-utilize weak symbol functionality although it is not supported. The GNU
-Assembler and Linker do not support AIX 5L sufficiently to bootstrap GCC@.
-The native AIX tools do interoperate with GCC@.
+on AIX@. The GNU Assembler, GNU Linker, and GNU Binutils version 2.20
+is required to bootstrap on AIX 5@. The native AIX tools do
+interoperate with GCC@.
Building @file{libstdc++.a} requires a fix for an AIX Assembler bug
APAR IY26685 (AIX 4.3) or APAR IY25528 (AIX 5.1). It also requires a
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index 065529fdf03..5c6790009ec 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -1909,8 +1909,11 @@ Any constant whose absolute value is no greater than 4-bits.
@item b
Address base register
+@item d
+Floating point register (containing 64-bit value)
+
@item f
-Floating point register
+Floating point register (containing 32-bit value)
@item v
Vector register
diff --git a/gcc/doc/plugins.texi b/gcc/doc/plugins.texi
index f02f931b102..9ae0a185f69 100644
--- a/gcc/doc/plugins.texi
+++ b/gcc/doc/plugins.texi
@@ -262,3 +262,37 @@ register_attributes (void *event_data, void *data)
@}
@end smallexample
+
+
+@section Building GCC plugins
+
+If plugins are enabled, GCC installs the headers needed to build a
+plugin (somehwere in the installation tree, e.g. under
+@file{/usr/local}). In particular a @file{plugin/include} directory
+is installed, containing all the header files needed to build plugins.
+
+On most systems, you can query this @code{plugin} directory by
+invoking @command{gcc -print-file-name=plugin} (replace if needed
+@command{gcc} with the appropriate program path).
+
+The following GNU Makefile excerpt shows how to build a simple plugin:
+
+@smallexample
+GCC=gcc
+PLUGIN_SOURCE_FILES= plugin1.c plugin2.c
+PLUGIN_OBJECT_FILES= $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES))
+GCCPLUGINS_DIR:= $(shell $(GCC) -print-file-name=plugin)
+CFLAGS+= -I$(GCCPLUGINS_DIR)/include -fPIC -O2
+
+plugin.so: $(PLUGIN_OBJECT_FILES)
+ $(GCC) -shared $^ -o $@
+@end smallexample
+
+A single source file plugin may be built with @code{gcc -I`gcc
+-print-file-name=plugin`/include -fPIC -shared -O2 plugin.c -o
+plugin.so}, using backquote shell syntax to query the @file{plugin}
+directory.
+
+Plugins needing to use @command{gengtype} require a GCC build
+directory for the same version of GCC that they will be linked
+against.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 367bda86a7e..81be71845e4 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -91,7 +91,7 @@ along with GCC; see the file COPYING3. If not see
#include "input.h"
#ifdef DWARF2_DEBUGGING_INFO
-static void dwarf2out_source_line (unsigned int, const char *, int);
+static void dwarf2out_source_line (unsigned int, const char *, int, bool);
static rtx last_var_location_insn;
#endif
@@ -3637,7 +3637,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
prologue case, not the eh frame case. */
#ifdef DWARF2_DEBUGGING_INFO
if (file)
- dwarf2out_source_line (line, file, 0);
+ dwarf2out_source_line (line, file, 0, true);
#endif
if (dwarf2out_do_cfi_asm ())
@@ -16283,8 +16283,10 @@ dwarf2out_begin_function (tree fun)
static void
dwarf2out_source_line (unsigned int line, const char *filename,
- int discriminator ATTRIBUTE_UNUSED)
+ int discriminator, bool is_stmt)
{
+ static bool last_is_stmt = true;
+
if (debug_info_level >= DINFO_LEVEL_NORMAL
&& line != 0)
{
@@ -16301,10 +16303,13 @@ dwarf2out_source_line (unsigned int line, const char *filename,
{
/* Emit the .loc directive understood by GNU as. */
fprintf (asm_out_file, "\t.loc %d %d 0", file_num, line);
-#ifdef HAVE_GAS_DISCRIMINATOR
- if (discriminator != 0)
+ if (is_stmt != last_is_stmt)
+ {
+ fprintf (asm_out_file, " is_stmt %d", is_stmt ? 1 : 0);
+ last_is_stmt = is_stmt;
+ }
+ if (SUPPORTS_DISCRIMINATOR && discriminator != 0)
fprintf (asm_out_file, " discriminator %d", discriminator);
-#endif /* HAVE_GAS_DISCRIMINATOR */
fputc ('\n', asm_out_file);
/* Indicate that line number info exists. */
diff --git a/gcc/expr.c b/gcc/expr.c
index ec1800e63a2..32cb9bb755e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -91,7 +91,7 @@ int cse_not_expected;
/* This structure is used by move_by_pieces to describe the move to
be performed. */
-struct move_by_pieces
+struct move_by_pieces_d
{
rtx to;
rtx to_addr;
@@ -109,7 +109,7 @@ struct move_by_pieces
/* This structure is used by store_by_pieces to describe the clear to
be performed. */
-struct store_by_pieces
+struct store_by_pieces_d
{
rtx to;
rtx to_addr;
@@ -126,16 +126,16 @@ static unsigned HOST_WIDE_INT move_by_pieces_ninsns (unsigned HOST_WIDE_INT,
unsigned int,
unsigned int);
static void move_by_pieces_1 (rtx (*) (rtx, ...), enum machine_mode,
- struct move_by_pieces *);
+ struct move_by_pieces_d *);
static bool block_move_libcall_safe_for_call_parm (void);
static bool emit_block_move_via_movmem (rtx, rtx, rtx, unsigned, unsigned, HOST_WIDE_INT);
static tree emit_block_move_libcall_fn (int);
static void emit_block_move_via_loop (rtx, rtx, rtx, unsigned);
static rtx clear_by_pieces_1 (void *, HOST_WIDE_INT, enum machine_mode);
static void clear_by_pieces (rtx, unsigned HOST_WIDE_INT, unsigned int);
-static void store_by_pieces_1 (struct store_by_pieces *, unsigned int);
+static void store_by_pieces_1 (struct store_by_pieces_d *, unsigned int);
static void store_by_pieces_2 (rtx (*) (rtx, ...), enum machine_mode,
- struct store_by_pieces *);
+ struct store_by_pieces_d *);
static tree clear_storage_libcall_fn (int);
static rtx compress_float_constant (rtx, rtx);
static rtx get_subtarget (rtx);
@@ -876,7 +876,7 @@ rtx
move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len,
unsigned int align, int endp)
{
- struct move_by_pieces data;
+ struct move_by_pieces_d data;
rtx to_addr, from_addr = XEXP (from, 0);
unsigned int max_size = MOVE_MAX_PIECES + 1;
enum machine_mode mode = VOIDmode, tmode;
@@ -1088,7 +1088,7 @@ move_by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align,
static void
move_by_pieces_1 (rtx (*genfun) (rtx, ...), enum machine_mode mode,
- struct move_by_pieces *data)
+ struct move_by_pieces_d *data)
{
unsigned int size = GET_MODE_SIZE (mode);
rtx to1 = NULL_RTX, from1;
@@ -2382,7 +2382,7 @@ store_by_pieces (rtx to, unsigned HOST_WIDE_INT len,
rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
void *constfundata, unsigned int align, bool memsetp, int endp)
{
- struct store_by_pieces data;
+ struct store_by_pieces_d data;
if (len == 0)
{
@@ -2434,7 +2434,7 @@ store_by_pieces (rtx to, unsigned HOST_WIDE_INT len,
static void
clear_by_pieces (rtx to, unsigned HOST_WIDE_INT len, unsigned int align)
{
- struct store_by_pieces data;
+ struct store_by_pieces_d data;
if (len == 0)
return;
@@ -2462,7 +2462,7 @@ clear_by_pieces_1 (void *data ATTRIBUTE_UNUSED,
rtx with BLKmode). ALIGN is maximum alignment we can assume. */
static void
-store_by_pieces_1 (struct store_by_pieces *data ATTRIBUTE_UNUSED,
+store_by_pieces_1 (struct store_by_pieces_d *data ATTRIBUTE_UNUSED,
unsigned int align ATTRIBUTE_UNUSED)
{
rtx to_addr = XEXP (data->to, 0);
@@ -2560,7 +2560,7 @@ store_by_pieces_1 (struct store_by_pieces *data ATTRIBUTE_UNUSED,
static void
store_by_pieces_2 (rtx (*genfun) (rtx, ...), enum machine_mode mode,
- struct store_by_pieces *data)
+ struct store_by_pieces_d *data)
{
unsigned int size = GET_MODE_SIZE (mode);
rtx to1, cst;
@@ -4250,7 +4250,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
/* Handle expand_expr of a complex value returning a CONCAT. */
if (GET_CODE (to_rtx) == CONCAT)
{
- if (TREE_CODE (TREE_TYPE (from)) == COMPLEX_TYPE)
+ if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from))))
{
gcc_assert (bitpos == 0);
result = store_expr (from, to_rtx, false, nontemporal);
@@ -8321,7 +8321,8 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
/* If neither mode is BLKmode, and both modes are the same size
then we can use gen_lowpart. */
else if (mode != BLKmode && GET_MODE (op0) != BLKmode
- && GET_MODE_SIZE (mode) == GET_MODE_SIZE (GET_MODE (op0)))
+ && GET_MODE_SIZE (mode) == GET_MODE_SIZE (GET_MODE (op0))
+ && !COMPLEX_MODE_P (GET_MODE (op0)))
{
if (GET_CODE (op0) == SUBREG)
op0 = force_reg (GET_MODE (op0), op0);
diff --git a/gcc/final.c b/gcc/final.c
index b113bc90a39..3de72811401 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -213,7 +213,7 @@ static int asm_insn_count (rtx);
#endif
static void profile_function (FILE *);
static void profile_after_prologue (FILE *);
-static bool notice_source_line (rtx);
+static bool notice_source_line (rtx, bool *);
static rtx walk_alter_subreg (rtx *, bool *);
static void output_asm_name (void);
static void output_alternate_entry_point (FILE *, rtx);
@@ -2089,6 +2089,7 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
rtx body = PATTERN (insn);
int insn_code_number;
const char *templ;
+ bool is_stmt;
#ifdef HAVE_conditional_execution
/* Reset this early so it is correct for ASM statements. */
@@ -2190,11 +2191,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
}
/* Output this line note if it is the first or the last line
note in a row. */
- if (notice_source_line (insn))
+ if (notice_source_line (insn, &is_stmt))
{
(*debug_hooks->source_line) (last_linenum,
last_filename,
- last_discriminator);
+ last_discriminator,
+ is_stmt);
}
if (GET_CODE (body) == ASM_INPUT)
@@ -2698,10 +2700,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED,
return NEXT_INSN (insn);
}
-/* Return whether a source line note needs to be emitted before INSN. */
+/* Return whether a source line note needs to be emitted before INSN.
+ Sets IS_STMT to TRUE if the line should be marked as a possible
+ breakpoint location. */
static bool
-notice_source_line (rtx insn)
+notice_source_line (rtx insn, bool *is_stmt)
{
const char *filename;
int linenum;
@@ -2717,20 +2721,33 @@ notice_source_line (rtx insn)
linenum = insn_line (insn);
}
- if (filename
- && (force_source_line
- || filename != last_filename
- || last_linenum != linenum
- || last_discriminator != discriminator))
+ if (filename == NULL)
+ return false;
+
+ if (force_source_line
+ || filename != last_filename
+ || last_linenum != linenum)
{
force_source_line = false;
last_filename = filename;
last_linenum = linenum;
last_discriminator = discriminator;
+ *is_stmt = true;
high_block_linenum = MAX (last_linenum, high_block_linenum);
high_function_linenum = MAX (last_linenum, high_function_linenum);
return true;
}
+
+ if (SUPPORTS_DISCRIMINATOR && last_discriminator != discriminator)
+ {
+ /* If the discriminator changed, but the line number did not,
+ output the line table entry with is_stmt false so the
+ debugger does not treat this as a breakpoint location. */
+ last_discriminator = discriminator;
+ *is_stmt = false;
+ return true;
+ }
+
return false;
}
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 12aa9dce0f5..d6a608285b9 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,14 @@
+2009-06-18 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40451
+ * resolve.c (resolve_contained_fntype): Prevent implicit typing for
+ procedures with explicit interface.
+ * symbol.c (gfc_check_function_type): Ditto.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * decl.c (build_struct): Rewrite loop over constructor elements.
+
2009-06-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/36947
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 1a4ca3616dc..021392d427c 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -1435,28 +1435,26 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init,
bool has_ts;
gfc_constructor *ctor = c->initializer->value.constructor;
- bool first = true;
- int first_len;
-
has_ts = (c->initializer->ts.cl
&& c->initializer->ts.cl->length_from_typespec);
- for (; ctor; ctor = ctor->next)
+ if (ctor)
{
- /* Remember the length of the first element for checking that
- all elements *in the constructor* have the same length. This
- need not be the length of the LHS! */
- if (first)
+ int first_len;
+
+ /* Remember the length of the first element for checking
+ that all elements *in the constructor* have the same
+ length. This need not be the length of the LHS! */
+ gcc_assert (ctor->expr->expr_type == EXPR_CONSTANT);
+ gcc_assert (ctor->expr->ts.type == BT_CHARACTER);
+ first_len = ctor->expr->value.character.length;
+
+ for (; ctor; ctor = ctor->next)
{
- gcc_assert (ctor->expr->expr_type == EXPR_CONSTANT);
- gcc_assert (ctor->expr->ts.type == BT_CHARACTER);
- first_len = ctor->expr->value.character.length;
- first = false;
+ if (ctor->expr->expr_type == EXPR_CONSTANT)
+ gfc_set_constant_character_len (len, ctor->expr,
+ has_ts ? -1 : first_len);
}
-
- if (ctor->expr->expr_type == EXPR_CONSTANT)
- gfc_set_constant_character_len (len, ctor->expr,
- has_ts ? -1 : first_len);
}
}
}
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 3a670423d7f..4117d80f994 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -347,7 +347,7 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns)
return;
/* Try to find out of what the return type is. */
- if (sym->result->ts.type == BT_UNKNOWN)
+ if (sym->result->ts.type == BT_UNKNOWN && sym->result->ts.interface == NULL)
{
t = gfc_set_default_type (sym->result, 0, ns);
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 326d73e3ebf..71062fb08ca 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -317,7 +317,7 @@ gfc_check_function_type (gfc_namespace *ns)
if (!proc->attr.contained || proc->result->attr.implicit_type)
return;
- if (proc->result->ts.type == BT_UNKNOWN)
+ if (proc->result->ts.type == BT_UNKNOWN && proc->result->ts.interface == NULL)
{
if (gfc_set_default_type (proc->result, 0, gfc_current_ns)
== SUCCESS)
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 24727bc8873..4f18b78aee6 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -448,7 +448,7 @@ gimple_build_assign_with_ops_stat (enum tree_code subcode, tree lhs, tree op1,
This function returns the newly created GIMPLE_ASSIGN tuple. */
-inline gimple
+gimple
gimplify_assign (tree dst, tree src, gimple_seq *seq_p)
{
tree t = build2 (MODIFY_EXPR, TREE_TYPE (dst), dst, src);
@@ -3267,7 +3267,7 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
if (visit_addr
&& gimple_call_return_slot_opt_p (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE
- && TREE_ADDRESSABLE (gimple_call_lhs (stmt)))
+ && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
ret |= visit_addr (stmt, gimple_call_lhs (stmt), data);
}
else if (gimple_code (stmt) == GIMPLE_ASM)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index b16fb545028..2010109bc4e 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -997,6 +997,7 @@ extern bool validate_gimple_arglist (const_gimple, ...);
/* In tree-ssa.c */
extern bool tree_ssa_useless_type_conversion (tree);
+extern tree tree_ssa_strip_useless_type_conversions (tree);
extern bool useless_type_conversion_p (tree, tree);
extern bool types_compatible_p (tree, tree);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index f876b458d2d..eff10c87628 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -601,7 +601,7 @@ static rtx last_scheduled_insn;
/* Compute cost of executing INSN.
This is the number of cycles between instruction issue and
instruction results. */
-HAIFA_INLINE int
+int
insn_cost (rtx insn)
{
int cost;
@@ -4721,8 +4721,6 @@ check_cfg (rtx head, rtx tail)
#endif /* ENABLE_CHECKING */
-const struct sched_scan_info_def *sched_scan_info;
-
/* Extend per basic block data structures. */
static void
extend_bb (void)
diff --git a/gcc/ira-build.c b/gcc/ira-build.c
index 9662c4ab7da..4af927a041f 100644
--- a/gcc/ira-build.c
+++ b/gcc/ira-build.c
@@ -2394,7 +2394,8 @@ static ira_allocno_t *regno_top_level_allocno_map;
static bool
copy_info_to_removed_store_destinations (int regno)
{
- ira_allocno_t a, parent_a;
+ ira_allocno_t a;
+ ira_allocno_t parent_a = NULL;
ira_loop_tree_node_t parent;
allocno_live_range_t r;
bool merged_p;
diff --git a/gcc/jump.c b/gcc/jump.c
index 350de16f07c..7fe34f18661 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -113,6 +113,8 @@ cleanup_barriers (void)
if (BARRIER_P (insn))
{
prev = prev_nonnote_insn (insn);
+ if (!prev)
+ continue;
if (BARRIER_P (prev))
delete_insn (insn);
else if (prev != PREV_INSN (insn))
diff --git a/gcc/plugin.c b/gcc/plugin.c
index 0b5515e4907..93151f8a8a7 100644
--- a/gcc/plugin.c
+++ b/gcc/plugin.c
@@ -336,6 +336,11 @@ position_pass (struct plugin_pass *plugin_pass_info,
case PASS_POS_INSERT_AFTER:
new_pass->next = pass->next;
pass->next = new_pass;
+
+ /* Skip newly inserted pass to avoid repeated
+ insertions in the case where the new pass and the
+ existing one have the same name. */
+ pass = new_pass;
break;
case PASS_POS_INSERT_BEFORE:
new_pass->next = pass;
diff --git a/gcc/profile.c b/gcc/profile.c
index c4c7276ffe0..0cc65521729 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1,6 +1,6 @@
/* Calculate branch probabilities, and basic block execution counts.
Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by James E. Wilson, UC Berkeley/Cygnus Support;
based on some ideas from Dain Samples of UC Berkeley.
@@ -100,7 +100,6 @@ static int total_num_blocks_created;
static int total_num_passes;
static int total_num_times_called;
static int total_hist_br_prob[20];
-static int total_num_never_executed;
static int total_num_branches;
/* Forward declarations. */
@@ -447,7 +446,6 @@ compute_branch_probabilities (void)
int changes;
int passes;
int hist_br_prob[20];
- int num_never_executed;
int num_branches;
gcov_type *exec_counts = get_exec_counts ();
int inconsistent = 0;
@@ -647,7 +645,6 @@ compute_branch_probabilities (void)
for (i = 0; i < 20; i++)
hist_br_prob[i] = 0;
- num_never_executed = 0;
num_branches = 0;
FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR, NULL, next_bb)
@@ -741,7 +738,7 @@ compute_branch_probabilities (void)
if (bb->index >= NUM_FIXED_BLOCKS
&& block_ends_with_condjump_p (bb)
&& EDGE_COUNT (bb->succs) >= 2)
- num_branches++, num_never_executed;
+ num_branches++;
}
}
counts_to_freqs ();
@@ -750,8 +747,6 @@ compute_branch_probabilities (void)
if (dump_file)
{
fprintf (dump_file, "%d branches\n", num_branches);
- fprintf (dump_file, "%d branches never executed\n",
- num_never_executed);
if (num_branches)
for (i = 0; i < 10; i++)
fprintf (dump_file, "%d%% branches in range %d-%d%%\n",
@@ -759,7 +754,6 @@ compute_branch_probabilities (void)
5 * i, 5 * i + 5);
total_num_branches += num_branches;
- total_num_never_executed += num_never_executed;
for (i = 0; i < 20; i++)
total_hist_br_prob[i] += hist_br_prob[i];
@@ -1333,7 +1327,6 @@ init_branch_prob (void)
total_num_passes = 0;
total_num_times_called = 0;
total_num_branches = 0;
- total_num_never_executed = 0;
for (i = 0; i < 20; i++)
total_hist_br_prob[i] = 0;
}
@@ -1364,8 +1357,6 @@ end_branch_prob (void)
/ total_num_times_called);
fprintf (dump_file, "Total number of branches: %d\n",
total_num_branches);
- fprintf (dump_file, "Total number of branches never executed: %d\n",
- total_num_never_executed);
if (total_num_branches)
{
int i;
diff --git a/gcc/reorg.c b/gcc/reorg.c
index 059bf755e79..74e84eb8116 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -173,8 +173,8 @@ static int max_uid;
static int stop_search_p (rtx, int);
static int resource_conflicts_p (struct resources *, struct resources *);
-static int insn_references_resource_p (rtx, struct resources *, int);
-static int insn_sets_resource_p (rtx, struct resources *, int);
+static int insn_references_resource_p (rtx, struct resources *, bool);
+static int insn_sets_resource_p (rtx, struct resources *, bool);
static rtx find_end_label (void);
static rtx emit_delay_sequence (rtx, rtx, int);
static rtx add_to_delay_list (rtx, rtx);
@@ -297,7 +297,7 @@ resource_conflicts_p (struct resources *res1, struct resources *res2)
static int
insn_references_resource_p (rtx insn, struct resources *res,
- int include_delayed_effects)
+ bool include_delayed_effects)
{
struct resources insn_res;
@@ -313,7 +313,7 @@ insn_references_resource_p (rtx insn, struct resources *res,
static int
insn_sets_resource_p (rtx insn, struct resources *res,
- int include_delayed_effects)
+ bool include_delayed_effects)
{
struct resources insn_sets;
@@ -1246,7 +1246,7 @@ steal_delay_list_from_target (rtx insn, rtx condition, rtx seq,
rtx trial = XEXP (temp, 0);
mark_set_resources (trial, &cc_set, 0, MARK_SRC_DEST_CALL);
- if (insn_references_resource_p (XVECEXP (seq , 0, 0), &cc_set, 0))
+ if (insn_references_resource_p (XVECEXP (seq , 0, 0), &cc_set, false))
return delay_list;
}
@@ -1268,9 +1268,9 @@ steal_delay_list_from_target (rtx insn, rtx condition, rtx seq,
rtx trial = XVECEXP (seq, 0, i);
int flags;
- if (insn_references_resource_p (trial, sets, 0)
- || insn_sets_resource_p (trial, needed, 0)
- || insn_sets_resource_p (trial, sets, 0)
+ if (insn_references_resource_p (trial, sets, false)
+ || insn_sets_resource_p (trial, needed, false)
+ || insn_sets_resource_p (trial, sets, false)
#ifdef HAVE_cc0
/* If TRIAL sets CC0, we can't copy it, so we can't steal this
delay list. */
@@ -1293,7 +1293,7 @@ steal_delay_list_from_target (rtx insn, rtx condition, rtx seq,
if (! must_annul
&& ((condition == const_true_rtx
- || (! insn_sets_resource_p (trial, other_needed, 0)
+ || (! insn_sets_resource_p (trial, other_needed, false)
&& ! may_trap_or_fault_p (PATTERN (trial)))))
? eligible_for_delay (insn, total_slots_filled, trial, flags)
: (must_annul || (delay_list == NULL && new_delay_list == NULL))
@@ -1368,9 +1368,9 @@ steal_delay_list_from_fallthrough (rtx insn, rtx condition, rtx seq,
/* If TRIAL sets CC0, stealing it will move it too far from the use
of CC0. */
- if (insn_references_resource_p (trial, sets, 0)
- || insn_sets_resource_p (trial, needed, 0)
- || insn_sets_resource_p (trial, sets, 0)
+ if (insn_references_resource_p (trial, sets, false)
+ || insn_sets_resource_p (trial, needed, false)
+ || insn_sets_resource_p (trial, sets, false)
#ifdef HAVE_cc0
|| sets_cc0_p (PATTERN (trial))
#endif
@@ -1387,7 +1387,7 @@ steal_delay_list_from_fallthrough (rtx insn, rtx condition, rtx seq,
if (! must_annul
&& ((condition == const_true_rtx
- || (! insn_sets_resource_p (trial, other_needed, 0)
+ || (! insn_sets_resource_p (trial, other_needed, false)
&& ! may_trap_or_fault_p (PATTERN (trial)))))
? eligible_for_delay (insn, *pslots_filled, trial, flags)
: (must_annul || delay_list == NULL) && (must_annul = 1,
@@ -1448,7 +1448,8 @@ try_merge_delay_insns (rtx insn, rtx thread)
if (! annul_p)
for (i = 1 ; i < num_slots; i++)
if (XVECEXP (PATTERN (insn), 0, i))
- mark_referenced_resources (XVECEXP (PATTERN (insn), 0, i), &needed, 1);
+ mark_referenced_resources (XVECEXP (PATTERN (insn), 0, i), &needed,
+ true);
for (trial = thread; !stop_search_p (trial, 1); trial = next_trial)
{
@@ -1467,9 +1468,9 @@ try_merge_delay_insns (rtx insn, rtx thread)
/* We can't share an insn that sets cc0. */
&& ! sets_cc0_p (pat)
#endif
- && ! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
+ && ! insn_references_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &needed, true)
&& (trial = try_split (pat, trial, 0)) != 0
/* Update next_trial, in case try_split succeeded. */
&& (next_trial = next_nonnote_insn (trial))
@@ -1500,7 +1501,7 @@ try_merge_delay_insns (rtx insn, rtx thread)
}
mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (trial, &needed, 1);
+ mark_referenced_resources (trial, &needed, true);
}
/* See if we stopped on a filled insn. If we did, try to see if its
@@ -1515,15 +1516,15 @@ try_merge_delay_insns (rtx insn, rtx thread)
/* Account for resources set/needed by the filled insn. */
mark_set_resources (filled_insn, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (filled_insn, &needed, 1);
+ mark_referenced_resources (filled_insn, &needed, true);
for (i = 1; i < XVECLEN (pat, 0); i++)
{
rtx dtrial = XVECEXP (pat, 0, i);
- if (! insn_references_resource_p (dtrial, &set, 1)
- && ! insn_sets_resource_p (dtrial, &set, 1)
- && ! insn_sets_resource_p (dtrial, &needed, 1)
+ if (! insn_references_resource_p (dtrial, &set, true)
+ && ! insn_sets_resource_p (dtrial, &set, true)
+ && ! insn_sets_resource_p (dtrial, &needed, true)
#ifdef HAVE_cc0
&& ! sets_cc0_p (PATTERN (dtrial))
#endif
@@ -1554,7 +1555,7 @@ try_merge_delay_insns (rtx insn, rtx thread)
/* Keep track of the set/referenced resources for the delay
slots of any trial insns we encounter. */
mark_set_resources (dtrial, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (dtrial, &needed, 1);
+ mark_referenced_resources (dtrial, &needed, true);
}
}
}
@@ -1690,7 +1691,7 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
CLEAR_RESOURCE (&needed);
CLEAR_RESOURCE (&set);
mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (insn, &needed, 1);
+ mark_referenced_resources (insn, &needed, true);
/* If TARGET is a SEQUENCE, get the main insn. */
if (NONJUMP_INSN_P (target) && GET_CODE (PATTERN (target)) == SEQUENCE)
@@ -1702,8 +1703,8 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
#endif
/* The insn requiring the delay may not set anything needed or set by
INSN. */
- || insn_sets_resource_p (target_main, &needed, 1)
- || insn_sets_resource_p (target_main, &set, 1))
+ || insn_sets_resource_p (target_main, &needed, true)
+ || insn_sets_resource_p (target_main, &set, true))
return 0;
/* Insns we pass may not set either NEEDED or SET, so merge them for
@@ -1717,14 +1718,15 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
while (delay_list)
{
- if (insn_sets_resource_p (XEXP (delay_list, 0), &needed, 1))
+ if (insn_sets_resource_p (XEXP (delay_list, 0), &needed, true))
return 0;
delay_list = XEXP (delay_list, 1);
}
if (NONJUMP_INSN_P (target) && GET_CODE (PATTERN (target)) == SEQUENCE)
for (i = 1; i < XVECLEN (PATTERN (target), 0); i++)
- if (insn_sets_resource_p (XVECEXP (PATTERN (target), 0, i), &needed, 1))
+ if (insn_sets_resource_p (XVECEXP (PATTERN (target), 0, i), &needed,
+ true))
return 0;
/* Scan backwards until we reach a label or an insn that uses something
@@ -1783,13 +1785,13 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
we must stop if it sets anything needed or set by INSN. */
if ((! INSN_ANNULLED_BRANCH_P (XVECEXP (pat, 0, 0))
|| ! INSN_FROM_TARGET_P (candidate))
- && insn_sets_resource_p (candidate, &needed, 1))
+ && insn_sets_resource_p (candidate, &needed, true))
return 0;
}
/* If the insn requiring the delay slot conflicts with INSN, we
must stop. */
- if (insn_sets_resource_p (XVECEXP (pat, 0, 0), &needed, 1))
+ if (insn_sets_resource_p (XVECEXP (pat, 0, 0), &needed, true))
return 0;
}
else
@@ -1800,7 +1802,7 @@ redundant_insn (rtx insn, rtx target, rtx delay_list)
return trial;
/* Can't go any further if TRIAL conflicts with INSN. */
- if (insn_sets_resource_p (trial, &needed, 1))
+ if (insn_sets_resource_p (trial, &needed, true))
return 0;
}
}
@@ -2138,7 +2140,7 @@ fill_simple_delay_slots (int non_jumps_p)
CLEAR_RESOURCE (&needed);
CLEAR_RESOURCE (&set);
mark_set_resources (insn, &set, 0, MARK_SRC_DEST);
- mark_referenced_resources (insn, &needed, 0);
+ mark_referenced_resources (insn, &needed, false);
for (trial = prev_nonnote_insn (insn); ! stop_search_p (trial, 1);
trial = next_trial)
@@ -2154,9 +2156,9 @@ fill_simple_delay_slots (int non_jumps_p)
/* Check for resource conflict first, to avoid unnecessary
splitting. */
- if (! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
+ if (! insn_references_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &needed, true)
#ifdef HAVE_cc0
/* Can't separate set of cc0 from its use. */
&& ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
@@ -2184,7 +2186,7 @@ fill_simple_delay_slots (int non_jumps_p)
}
mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (trial, &needed, 1);
+ mark_referenced_resources (trial, &needed, true);
}
}
@@ -2255,13 +2257,13 @@ fill_simple_delay_slots (int non_jumps_p)
if (CALL_P (insn))
{
mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (insn, &needed, 1);
+ mark_referenced_resources (insn, &needed, true);
maybe_never = 1;
}
else
{
mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (insn, &needed, 1);
+ mark_referenced_resources (insn, &needed, true);
if (JUMP_P (insn))
target = JUMP_LABEL (insn);
}
@@ -2296,9 +2298,9 @@ fill_simple_delay_slots (int non_jumps_p)
/* See if we have a resource problem before we try to
split. */
if (GET_CODE (pat) != SEQUENCE
- && ! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
+ && ! insn_references_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &needed, true)
#ifdef HAVE_cc0
&& ! (reg_mentioned_p (cc0_rtx, pat) && ! sets_cc0_p (pat))
#endif
@@ -2322,7 +2324,7 @@ fill_simple_delay_slots (int non_jumps_p)
}
mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (trial, &needed, 1);
+ mark_referenced_resources (trial, &needed, true);
/* Ensure we don't put insns between the setting of cc and the
comparison by moving a setting of cc into an earlier delay
@@ -2349,9 +2351,9 @@ fill_simple_delay_slots (int non_jumps_p)
&& ! (NONJUMP_INSN_P (next_trial)
&& GET_CODE (PATTERN (next_trial)) == SEQUENCE)
&& !JUMP_P (next_trial)
- && ! insn_references_resource_p (next_trial, &set, 1)
- && ! insn_sets_resource_p (next_trial, &set, 1)
- && ! insn_sets_resource_p (next_trial, &needed, 1)
+ && ! insn_references_resource_p (next_trial, &set, true)
+ && ! insn_sets_resource_p (next_trial, &set, true)
+ && ! insn_sets_resource_p (next_trial, &needed, true)
#ifdef HAVE_cc0
&& ! reg_mentioned_p (cc0_rtx, PATTERN (next_trial))
#endif
@@ -2458,9 +2460,9 @@ fill_simple_delay_slots (int non_jumps_p)
if (GET_CODE (pat) == USE || GET_CODE (pat) == CLOBBER)
continue;
- if (! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
+ if (! insn_references_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &needed, true)
+ && ! insn_sets_resource_p (trial, &set, true)
#ifdef HAVE_cc0
/* Don't want to mess with cc0 here. */
&& ! reg_mentioned_p (cc0_rtx, pat)
@@ -2476,7 +2478,7 @@ fill_simple_delay_slots (int non_jumps_p)
crtl->epilogue_delay_list
= gen_rtx_INSN_LIST (VOIDmode, trial,
crtl->epilogue_delay_list);
- mark_end_of_function_resources (trial, 1);
+ mark_end_of_function_resources (trial, true);
update_block (trial, trial);
delete_related_insns (trial);
@@ -2490,7 +2492,7 @@ fill_simple_delay_slots (int non_jumps_p)
}
mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (trial, &needed, 1);
+ mark_referenced_resources (trial, &needed, true);
}
note_delay_statistics (slots_filled, 0);
@@ -2635,9 +2637,9 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
/* If TRIAL conflicts with the insns ahead of it, we lose. Also,
don't separate or copy insns that set and use CC0. */
- if (! insn_references_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &set, 1)
- && ! insn_sets_resource_p (trial, &needed, 1)
+ if (! insn_references_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &set, true)
+ && ! insn_sets_resource_p (trial, &needed, true)
#ifdef HAVE_cc0
&& ! (reg_mentioned_p (cc0_rtx, pat)
&& (! own_thread || ! sets_cc0_p (pat)))
@@ -2678,7 +2680,7 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
go into an annulled delay slot. */
if (!must_annul
&& (condition == const_true_rtx
- || (! insn_sets_resource_p (trial, &opposite_needed, 1)
+ || (! insn_sets_resource_p (trial, &opposite_needed, true)
&& ! may_trap_or_fault_p (pat))))
{
old_trial = trial;
@@ -2793,10 +2795,11 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
may be branching to a location that has a
redundant insn. Skip any if so. */
while (new_thread && ! own_thread
- && ! insn_sets_resource_p (new_thread, &set, 1)
- && ! insn_sets_resource_p (new_thread, &needed, 1)
+ && ! insn_sets_resource_p (new_thread, &set, true)
+ && ! insn_sets_resource_p (new_thread, &needed,
+ true)
&& ! insn_references_resource_p (new_thread,
- &set, 1)
+ &set, true)
&& (prior_insn
= redundant_insn (new_thread, insn,
delay_list)))
@@ -2818,7 +2821,7 @@ fill_slots_from_thread (rtx insn, rtx condition, rtx thread,
/* This insn can't go into a delay slot. */
lose = 1;
mark_set_resources (trial, &set, 0, MARK_SRC_DEST_CALL);
- mark_referenced_resources (trial, &needed, 1);
+ mark_referenced_resources (trial, &needed, true);
/* Ensure we don't put insns between the setting of cc and the comparison
by moving a setting of cc into an earlier delay slot since these insns
diff --git a/gcc/resource.c b/gcc/resource.c
index 91b86c9573b..846f8ef2b41 100644
--- a/gcc/resource.c
+++ b/gcc/resource.c
@@ -1,6 +1,6 @@
/* Definitions for computing resource usage of specific insns.
- Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+ 2009 Free Software Foundation, Inc.
This file is part of GCC.
@@ -203,7 +203,7 @@ next_insn_no_annul (rtx insn)
void
mark_referenced_resources (rtx x, struct resources *res,
- int include_delayed_effects)
+ bool include_delayed_effects)
{
enum rtx_code code = GET_CODE (x);
int i, j;
@@ -226,7 +226,7 @@ mark_referenced_resources (rtx x, struct resources *res,
case SUBREG:
if (!REG_P (SUBREG_REG (x)))
- mark_referenced_resources (SUBREG_REG (x), res, 0);
+ mark_referenced_resources (SUBREG_REG (x), res, false);
else
{
unsigned int regno = subreg_regno (x);
@@ -253,7 +253,7 @@ mark_referenced_resources (rtx x, struct resources *res,
res->volatil |= MEM_VOLATILE_P (x);
/* Mark registers used to access memory. */
- mark_referenced_resources (XEXP (x, 0), res, 0);
+ mark_referenced_resources (XEXP (x, 0), res, false);
return;
case CC0:
@@ -276,14 +276,14 @@ mark_referenced_resources (rtx x, struct resources *res,
traditional asms unlike their normal usage. */
for (i = 0; i < ASM_OPERANDS_INPUT_LENGTH (x); i++)
- mark_referenced_resources (ASM_OPERANDS_INPUT (x, i), res, 0);
+ mark_referenced_resources (ASM_OPERANDS_INPUT (x, i), res, false);
return;
case CALL:
/* The first operand will be a (MEM (xxx)) but doesn't really reference
memory. The second operand may be referenced, though. */
- mark_referenced_resources (XEXP (XEXP (x, 0), 0), res, 0);
- mark_referenced_resources (XEXP (x, 1), res, 0);
+ mark_referenced_resources (XEXP (XEXP (x, 0), 0), res, false);
+ mark_referenced_resources (XEXP (x, 1), res, false);
return;
case SET:
@@ -291,16 +291,16 @@ mark_referenced_resources (rtx x, struct resources *res,
registers used to access memory are referenced. SET_DEST is
also referenced if it is a ZERO_EXTRACT. */
- mark_referenced_resources (SET_SRC (x), res, 0);
+ mark_referenced_resources (SET_SRC (x), res, false);
x = SET_DEST (x);
if (GET_CODE (x) == ZERO_EXTRACT
|| GET_CODE (x) == STRICT_LOW_PART)
- mark_referenced_resources (x, res, 0);
+ mark_referenced_resources (x, res, false);
else if (GET_CODE (x) == SUBREG)
x = SUBREG_REG (x);
if (MEM_P (x))
- mark_referenced_resources (XEXP (x, 0), res, 0);
+ mark_referenced_resources (XEXP (x, 0), res, false);
return;
case CLOBBER:
@@ -372,7 +372,7 @@ mark_referenced_resources (rtx x, struct resources *res,
}
if (i >= seq_size)
mark_referenced_resources (XEXP (XEXP (link, 0), 0),
- res, 0);
+ res, false);
}
}
}
@@ -519,7 +519,7 @@ find_dead_or_set_registers (rtx target, struct resources *res,
if (jump_count >= 10)
break;
- mark_referenced_resources (insn, &needed, 1);
+ mark_referenced_resources (insn, &needed, true);
/* For an annulled branch, mark_set_resources ignores slots
filled by instructions from the target. This is correct
@@ -585,7 +585,7 @@ find_dead_or_set_registers (rtx target, struct resources *res,
}
}
- mark_referenced_resources (insn, &needed, 1);
+ mark_referenced_resources (insn, &needed, true);
mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL);
COPY_HARD_REG_SET (scratch, set.regs);
@@ -888,7 +888,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
else if (return_insn_p (target))
{
*res = end_of_function_needs;
- mark_referenced_resources (target, res, 0);
+ mark_referenced_resources (target, res, false);
return;
}
@@ -1101,7 +1101,7 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
/* Include JUMP_INSN in the needed registers. */
for (insn = target; insn != stop_insn; insn = next_active_insn (insn))
{
- mark_referenced_resources (insn, &needed, 1);
+ mark_referenced_resources (insn, &needed, true);
COPY_HARD_REG_SET (scratch, needed.regs);
AND_COMPL_HARD_REG_SET (scratch, set.regs);
@@ -1155,7 +1155,7 @@ init_resource_info (rtx epilogue_insn)
if (crtl->return_rtx != 0)
mark_referenced_resources (crtl->return_rtx,
- &end_of_function_needs, 1);
+ &end_of_function_needs, true);
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (global_regs[i]
@@ -1274,7 +1274,7 @@ incr_ticks_for_insn (rtx insn)
/* Add TRIAL to the set of resources used at the end of the current
function. */
void
-mark_end_of_function_resources (rtx trial, int include_delayed_effects)
+mark_end_of_function_resources (rtx trial, bool include_delayed_effects)
{
mark_referenced_resources (trial, &end_of_function_needs,
include_delayed_effects);
diff --git a/gcc/resource.h b/gcc/resource.h
index 26cd294946b..b13782f1ab0 100644
--- a/gcc/resource.h
+++ b/gcc/resource.h
@@ -1,5 +1,6 @@
/* Definitions for computing resource usage of specific insns.
- Copyright (C) 1999, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2004, 2006, 2007, 2009
+ Free Software Foundation, Inc.
This file is part of GCC.
@@ -48,10 +49,10 @@ enum mark_resource_type
extern void mark_target_live_regs (rtx, rtx, struct resources *);
extern void mark_set_resources (rtx, struct resources *, int,
enum mark_resource_type);
-extern void mark_referenced_resources (rtx, struct resources *, int);
+extern void mark_referenced_resources (rtx, struct resources *, bool);
extern void clear_hashed_info_for_insn (rtx);
extern void incr_ticks_for_insn (rtx);
-extern void mark_end_of_function_resources (rtx, int);
+extern void mark_end_of_function_resources (rtx, bool);
extern void init_resource_info (rtx);
extern void free_resource_info (void);
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index cc8687419ff..0e1cf18dfb2 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -117,7 +117,7 @@ static void sdbout_start_source_file (unsigned int, const char *);
static void sdbout_end_source_file (unsigned int);
static void sdbout_begin_block (unsigned int, unsigned int);
static void sdbout_end_block (unsigned int, unsigned int);
-static void sdbout_source_line (unsigned int, const char *, int);
+static void sdbout_source_line (unsigned int, const char *, int, bool);
static void sdbout_end_epilogue (unsigned int, const char *);
static void sdbout_global_decl (tree);
#ifndef MIPS_DEBUGGING_INFO
@@ -1542,7 +1542,8 @@ sdbout_end_block (unsigned int line, unsigned int n ATTRIBUTE_UNUSED)
static void
sdbout_source_line (unsigned int line, const char *filename ATTRIBUTE_UNUSED,
- int discriminator ATTRIBUTE_UNUSED)
+ int discriminator ATTRIBUTE_UNUSED,
+ bool is_stmt ATTRIBUTE_UNUSED)
{
/* COFF relative line numbers must be positive. */
if ((int) line > sdb_begin_function_line)
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index a7dedc5ef2d..7ec31f18c3f 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -448,7 +448,7 @@ struct code_motion_path_driver_info_def *code_motion_path_driver_info;
/* Set of hooks for performing move_op and find_used_regs routines with
code_motion_path_driver. */
-struct code_motion_path_driver_info_def move_op_hooks, fur_hooks;
+extern struct code_motion_path_driver_info_def move_op_hooks, fur_hooks;
/* True if/when we want to emulate Haifa scheduler in the common code.
This is used in sched_rgn_local_init and in various places in
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 02f87d058ed..e0d1f6f421c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,64 @@
+2009-06-18 Uros Bizjak <ubizjak@gmail.com>
+
+ * gcc.dg/builtins-65.c: New test.
+
+2009-06-18 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/40451
+ * gfortran.dg/proc_ptr_result_4.f90: New.
+
+2009-06-17 Adam Nemet <anemet@caviumnetworks.com>
+
+ * gcc.c-torture/execute/bitfld-5.c: New test.
+
+2009-06-17 David Daney <ddaney@caviumnetworks.com>
+
+ * gcc.dg/builtin-unreachable-3.c: New test.
+
+2009-06-17 David Daney <ddaney@caviumnetworks.com>
+
+ * gcc.target/i386/builtin-unreachable.c: New test.
+
+2009-06-17 Ian Lance Taylor <iant@google.com>
+
+ * gcc.dg/Wcxx-compat-14.c: New testcase.
+
+2009-06-17 Aldy Hernandez <aldyh@redhat.com>
+
+ * gcc.dg/func-ptr-conv-1.c: Update column info.
+
+2009-06-17 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40404
+ * gcc.c-torture/execute/pr40404.c: New testcase.
+
+2009-06-17 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/40460
+ * g++.dg/torture/pr40460.C: New testcase.
+
+2009-06-05 Olatunji Ruwase <tjruwase@google.com>
+
+ * gcc.dg/plugin/one_time_plugin.c: New test.
+ * gcc.dg/plugin/one_time-test-1.c: New test.
+ * gcc.dg/plugin/plugin.exp: Added one_time_plugin.c test.
+
+2009-06-16 Ian Lance Taylor <iant@google.com>
+
+ * g++.dg/warn/skip-1.C: New testcase.
+
+2009-06-16 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/40446
+ * g++.dg/other/pr40446.C: New test.
+
+2009-06-16 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/pta-escape-1.c: New testcase.
+ * gcc.dg/tree-ssa/pta-escape-2.c: Likewise.
+ * gcc.dg/tree-ssa/pta-escape-3.c: Likewise.
+ * gcc.dg/tree-ssa/ssa-fre-27.c: Likewise.
+
2009-06-16 Martin Jambor <mjambor@suse.cz>
* testsuite/gcc.c-torture/compile/pr40432.c: New file.
@@ -24,15 +85,15 @@
2009-06-16 Ira Rosen <irar@il.ibm.com>
- * gcc.dg/vect/vect-outer-4g.c: Don't look for pattern not allowed
+ * gcc.dg/vect/vect-outer-4g.c: Don't look for pattern not allowed
printing.
* gcc.dg/vect/vect-outer-4k.c, gcc.dg/vect/vect-outer-4l.c,
gcc.dg/vect/vect-outer-4f.c: Likewise.
* gcc.dg/vect/vect-nest-cycle-1.c: New test.
- * gcc.dg/vect/vect-nest-cycle-2.c, gcc.dg/vect/vect-nest-cycle-3.c:
+ * gcc.dg/vect/vect-nest-cycle-2.c, gcc.dg/vect/vect-nest-cycle-3.c:
Likewise.
- * gcc.dg/vect/vect-outer-1a.c: Fail because of strided access in outer
- loop.
+ * gcc.dg/vect/vect-outer-1a.c: Fail because of strided access in
+ outer loop.
2009-06-16 Tobias Burnus <burnus@net-b.de>
@@ -46,15 +107,13 @@
* gcc.dg/c99-vla-jump-5.c: Adjust expected error messages.
Recognize new notes.
* gcc.dg/stmt-expr-label-2.c: Likewise.
- * gcc.dg/c99-vla-jump-1.c: Recognize new notes. Fix column
- numbers.
+ * gcc.dg/c99-vla-jump-1.c: Recognize new notes. Fix column numbers.
* gcc.dg/c99-vla-jump-2.c: Recognize new notes.
* gcc.dg/c99-vla-jump-3.c: Recognize new notes.
* gcc.dg/c99-vla-jump-4.c: Likewise.
* gcc.dg/stmt-expr-label-1.c: Likewise.
* gcc.dg/stmt-expr-label-3.c: Likewise.
- * gcc.dg/vla-8.c: Likewise. Move error message to different
- line.
+ * gcc.dg/vla-8.c: Likewise. Move error message to different line.
2009-06-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
@@ -160,7 +219,8 @@
2009-06-12 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/40384
- * gcc.dg/tree-ssa/prefetch-5.c: Add --param min-insn-to-prefetch-ratio=5.
+ * gcc.dg/tree-ssa/prefetch-5.c: Add --param
+ min-insn-to-prefetch-ratio=5.
2009-06-12 Joey Ye <joey.ye@intel.com>
H.J. Lu <hongjiu.lu@intel.com>
@@ -307,8 +367,10 @@
2009-06-07 Daniel Franke <franke.daniel@gmail.com>
PR fortran/36874
- * gfortran.dg/intrinsic_argument_conformance_2.f90: Adjusted error message.
- * gfortran.dg/zero_sized_1.f90: Removed checks with incompatible shapes.
+ * gfortran.dg/intrinsic_argument_conformance_2.f90: Adjusted error
+ message.
+ * gfortran.dg/zero_sized_1.f90: Removed checks with incompatible
+ shapes.
* gfortran.dg/zero_sized_5.f90: Likewise.
2009-06-07 H.J. Lu <hongjiu.lu@intel.com>
@@ -354,8 +416,8 @@
2009-06-05 Revital Eres <eres@il.ibm.com>
- * lib/target-supports.exp:
- (check_effective_target_vect_hw_misalign): New procedure.
+ * lib/target-supports.exp (check_effective_target_vect_hw_misalign):
+ New procedure.
* gcc.dg/vect/vect-50.c: Change checks to use vect_hw_misalign.
* gcc.dg/vect/vect-33.c: Likewise.
* gcc.dg/vect/vect-92.c: Likewise.
@@ -516,8 +578,8 @@
2009-05-31 Basile Starynkevitch <basile@starynkevitch.net>
- * gcc.dg/plugin/ggcplug.c: moved comment.
- (plugin_init): fixed typo, declared i, returned 0 at end.
+ * gcc.dg/plugin/ggcplug.c: Moved comment.
+ (plugin_init): Fixed typo, declared i, returned 0 at end.
2009-05-31 Ira Rosen <irar@il.ibm.com>
@@ -591,7 +653,7 @@
2009-05-28 Kai Tietz <kai.tietz@onevision.com>
- * g++.dg/ext/packed6.C (size_t): Use __extension__ and __SIZE_TYPE__.
+ * g++.dg/ext/packed6.C (size_t): Use __extension__ and __SIZE_TYPE__.
* g++.dg/opt/memcpy1.C (size_t): Likewise.
* g++.dg/pr37742.C (size_t): Likewise.
* g++.dg/torture/pr34850.C (size_t): Likewise.
@@ -602,23 +664,23 @@
(size_t): Use __extension__ and __SIZE_TYPE__.
* gcc.c-torture/compile/20000211-1.c (size_t): Typedef size_t via
__SIZE_TYPE__.
- * gcc.c-torture/compile/20010328-1.c (size_t): Likewise,
- * gcc.c-torture/compile/20030320-1.c (size_t): Likewise,
- * gcc.c-torture/compile/20030405-1.c (size_t): Likewise,
- * gcc.c-torture/compile/20030902-1.c (size_t): Likewise,
- * gcc.c-torture/compile/20060202-1.c (size_t): Likewise,
- * gcc.c-torture/compile/20080613-1.c (size_t): Likewise,
- * gcc.c-torture/compile/920428-2.c (size_t): Likewise,
- * gcc.c-torture/compile/980329-1.c (size_t): Likewise,
- * gcc.c-torture/compile/980816-1.c (size_t): Likewise,
- * gcc.c-torture/compile/pr32584.c (size_t): Likewise,
- * (__ssize_t): Likewise.
- * gcc.c-torture/compile/pr33173.c (size_t): Likewise,
- * gcc.c-torture/compile/pr33382.c (size_t): Likewise,
- * gcc.c-torture/compile/pr34334.c (size_t): Likewise,
- * gcc.c-torture/compile/pr34688.c (size_t): Likewise,
- * gcc.c-torture/compile/pr35043.c (size_t): Likewise,
- * gcc.c-torture/compile/pr37669.c (size_t): Likewise,
+ * gcc.c-torture/compile/20010328-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/20030320-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/20030405-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/20030902-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/20060202-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/20080613-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/920428-2.c (size_t): Likewise.
+ * gcc.c-torture/compile/980329-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/980816-1.c (size_t): Likewise.
+ * gcc.c-torture/compile/pr32584.c (size_t): Likewise.
+ (__ssize_t): Likewise.
+ * gcc.c-torture/compile/pr33173.c (size_t): Likewise.
+ * gcc.c-torture/compile/pr33382.c (size_t): Likewise.
+ * gcc.c-torture/compile/pr34334.c (size_t): Likewise.
+ * gcc.c-torture/compile/pr34688.c (size_t): Likewise.
+ * gcc.c-torture/compile/pr35043.c (size_t): Likewise.
+ * gcc.c-torture/compile/pr37669.c (size_t): Likewise.
* gcc.dg/20050629-1.c (size_t): Typedef size_t via __SIZE_TYPE__.
* gcc.dg/pr33667.c (size_t): Likewise.
* gcc.dg/prefetch-loop-arrays-1.c (size_t): Likewise.
@@ -1164,8 +1226,7 @@
* gcc.dg/Wcxx-compat-7.c: New testcase.
* gcc.dg/Wcxx-compat-8.c: New testcase.
- * gcc.dg/c99-tag-1.c: Recognize new "originally defined here"
- notes
+ * gcc.dg/c99-tag-1.c: Recognize new "originally defined here" notes.
* gcc.dg/pr17188-1.c: Likewise.
* gcc.dg/pr39084.c: Likewise.
diff --git a/gcc/testsuite/g++.dg/other/pr40446.C b/gcc/testsuite/g++.dg/other/pr40446.C
new file mode 100644
index 00000000000..33dbcec7159
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr40446.C
@@ -0,0 +1,46 @@
+// PR middle-end/40446
+// { dg-do run { target i?86-*-* x86_64-*-* } }
+// { dg-options "-O1 -msse2" }
+
+#include <emmintrin.h>
+#include "cpuid.h"
+
+extern "C" void abort ();
+
+struct S
+{
+ S (double r, double i) { __real__ s = r; __imag__ s = i; }
+ __complex__ double s;
+};
+
+__m128d
+foo ()
+{
+ S c (0, 1);
+ return _mm_load_pd ((double *) &c);
+}
+
+static void
+__attribute__((noinline))
+sse2_test ()
+{
+ union { __m128d vec; double val[2]; } u;
+ u.vec = foo ();
+ if (u.val[0] != 0 || u.val[1] != 1)
+ abort ();
+}
+
+int
+main ()
+{
+ unsigned int eax, ebx, ecx, edx;
+
+ if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
+ return 0;
+
+ /* Run SSE2 test only if host has SSE2 support. */
+ if (edx & bit_SSE2)
+ sse2_test ();
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/torture/pr40460.C b/gcc/testsuite/g++.dg/torture/pr40460.C
new file mode 100644
index 00000000000..1d54df72b57
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr40460.C
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+void bar(int);
+void foo(void)
+{
+ for (int i = 0; i<1; ++i)
+ bar (i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i*i);
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/skip-1.C b/gcc/testsuite/g++.dg/warn/skip-1.C
new file mode 100644
index 00000000000..027c405d462
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/skip-1.C
@@ -0,0 +1,17 @@
+// { dg-do compile }
+// { dg-options "-Wall" }
+
+// Check that we don't warn about code that will not be executed.
+extern int f2(int);
+void
+f1(int i)
+{
+ f2(1 == 1 ? 0 : f2(i >> -10));
+ f2(1 == 1 ? 0 : f2(i >> 128));
+ f2(1 == 1 ? 0 : f2(i << -10));
+ f2(1 == 1 ? 0 : f2(1 << 128));
+ f2(1 != 1 ? f2(i >> -10) : 0);
+ f2(1 != 1 ? f2(i >> 128) : 0);
+ f2(1 != 1 ? f2(i << -10) : 0);
+ f2(1 != 1 ? f2(1 << 128) : 0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/bitfld-5.c b/gcc/testsuite/gcc.c-torture/execute/bitfld-5.c
new file mode 100644
index 00000000000..ca88d92214e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/bitfld-5.c
@@ -0,0 +1,35 @@
+/* See http://gcc.gnu.org/ml/gcc/2009-06/msg00072.html. */
+
+extern void abort (void);
+
+struct s
+{
+ unsigned long long a:2;
+ unsigned long long b:40;
+ unsigned long long c:22;
+};
+
+__attribute__ ((noinline)) void
+g (unsigned long long a, unsigned long long b)
+{
+ asm ("");
+ if (a != b)
+ abort ();
+}
+
+__attribute__ ((noinline)) void
+f (struct s s, unsigned long long b)
+{
+ asm ("");
+ g (((unsigned long long) (s.b-8)) + 8, b);
+}
+
+int
+main ()
+{
+ struct s s = {1, 10, 3};
+ struct s t = {1, 2, 3};
+ f (s, 10);
+ f (t, 0x10000000002);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr40404.c b/gcc/testsuite/gcc.c-torture/execute/pr40404.c
new file mode 100644
index 00000000000..a759a3f5c7d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr40404.c
@@ -0,0 +1,12 @@
+extern void abort (void);
+struct S {
+ unsigned int ui17 : 17;
+} s;
+int main()
+{
+ s.ui17 = 0x1ffff;
+ if (s.ui17 >= 0xfffffffeu)
+ abort ();
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-14.c b/gcc/testsuite/gcc.dg/Wcxx-compat-14.c
new file mode 100644
index 00000000000..23783711be6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wcxx-compat-14.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-Wc++-compat" } */
+
+char a1[] = "a";
+char a2[1] = "a"; /* { dg-warning "C\[+\]\[+\]" } */
+char a3[2] = "a";
diff --git a/gcc/testsuite/gcc.dg/builtin-unreachable-3.c b/gcc/testsuite/gcc.dg/builtin-unreachable-3.c
new file mode 100644
index 00000000000..6ad69261e1d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtin-unreachable-3.c
@@ -0,0 +1,9 @@
+/* Check that a function containing only __builtin_unreachable()
+ doesn't ICE. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+const char *
+f (void)
+{
+ __builtin_unreachable ();
+}
diff --git a/gcc/testsuite/gcc.dg/builtins-65.c b/gcc/testsuite/gcc.dg/builtins-65.c
new file mode 100644
index 00000000000..7c6aa20bd84
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/builtins-65.c
@@ -0,0 +1,39 @@
+/* { dg-do link } */
+/* { dg-options "-O2 -ffast-math" } */
+
+extern int ilogbf (float);
+extern float logbf (float);
+extern int ilogb (double);
+extern double logb (double);
+extern int ilogbl (long double);
+extern long double logbl (long double);
+
+extern void link_error(void);
+
+void testf(float x)
+{
+ if ((int) logbf (x) != ilogbf (x))
+ link_error ();
+}
+
+void test(double x)
+{
+ if ((int) logb (x) != ilogb (x))
+ link_error ();
+}
+
+void testl(long double x)
+{
+ if ((int) logbl (x) != ilogbl (x))
+ link_error ();
+}
+
+int main()
+{
+ testf (2.0f);
+ test (2.0);
+ testl (2.0l);
+
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/func-ptr-conv-1.c b/gcc/testsuite/gcc.dg/func-ptr-conv-1.c
index c331fbc88fc..5c8a101343e 100644
--- a/gcc/testsuite/gcc.dg/func-ptr-conv-1.c
+++ b/gcc/testsuite/gcc.dg/func-ptr-conv-1.c
@@ -37,8 +37,8 @@ g(void)
fp = c5; /* { dg-warning "6:pointer" "bad conversion" } */
fp = (void (*)(void))v5; /* { dg-warning "8:pointer" "bad conversion" } */
fp = (void (*)(void))c5; /* { dg-warning "8:pointer" "bad conversion" } */
- (a ? f : v3); /* { dg-warning "6:pointer" "bad conversion" } */
- (a ? v2 : fp); /* { dg-warning "6:pointer" "bad conversion" } */
+ (a ? f : v3); /* { dg-warning "10:pointer" "bad conversion" } */
+ (a ? v2 : fp); /* { dg-warning "11:pointer" "bad conversion" } */
/* The following are OK. */
fp = 0;
fp = (void *)0;
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time-test-1.c b/gcc/testsuite/gcc.dg/plugin/one_time-test-1.c
new file mode 100644
index 00000000000..a49ecb4affe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/one_time-test-1.c
@@ -0,0 +1,8 @@
+/* Test that pass is inserted and invoked once. */
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int main (int argc, char **argv)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
new file mode 100644
index 00000000000..8ae327a68f9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c
@@ -0,0 +1,60 @@
+/* Plugin that prints message if it inserted (and invoked) more than once. */
+#include "config.h"
+#include "gcc-plugin.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "toplev.h"
+#include "gimple.h"
+#include "tree-pass.h"
+#include "intl.h"
+
+static bool one_pass_gate (void)
+{
+ return true;
+}
+
+static unsigned int one_pass_exec (void)
+{
+ static int counter = 0;
+
+ if (counter > 0) {
+ printf ("Executed more than once \n");
+ }
+ counter++;
+}
+
+struct gimple_opt_pass one_pass =
+{
+ {
+ GIMPLE_PASS,
+ "useless", /* name */
+ one_pass_gate, /* gate */
+ one_pass_exec, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_gimple_any, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func /* todo_flags_finish */
+ }
+};
+
+
+int plugin_init (struct plugin_name_args *plugin_info,
+ struct plugin_gcc_version *version)
+{
+ struct plugin_pass p;
+
+ p.pass = &one_pass.pass;
+ p.reference_pass_name = "useless";
+ p.ref_pass_instance_number = 1;
+ p.pos_op = PASS_POS_INSERT_AFTER;
+
+ register_callback ("one_pass", PLUGIN_PASS_MANAGER_SETUP, NULL, &p);
+
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp
index 63ee74427f6..be6d7ab1243 100644
--- a/gcc/testsuite/gcc.dg/plugin/plugin.exp
+++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp
@@ -49,6 +49,7 @@ load_lib plugin-support.exp
set plugin_test_list [list \
{ selfassign.c self-assign-test-1.c self-assign-test-2.c } \
{ ggcplug.c ggcplug-test-1.c } \
+ { one_time_plugin.c one_time-test-1.c } \
]
foreach plugin_test $plugin_test_list {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c
new file mode 100644
index 00000000000..ee8a84bd06f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c
@@ -0,0 +1,37 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-alias-details" } */
+
+int *i;
+void __attribute__((noinline))
+foo (void)
+{
+ *i = 1;
+}
+int __attribute__((noinline))
+bar(int local_p)
+{
+ int x = 0;
+ int *j;
+ int **p;
+ if (local_p)
+ p = &j;
+ else
+ p = &i;
+ *p = &x; /* This makes x escape. */
+ foo ();
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ int k = 2;
+ i = &k;
+ if (bar (1) != 0 || k != 1)
+ abort ();
+ if (bar (0) != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "ESCAPED, points-to vars: { x }" "alias" } } */
+/* { dg-final { cleanup-tree-dump "alias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c
new file mode 100644
index 00000000000..ad5ed2e50de
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c
@@ -0,0 +1,38 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-alias-details" } */
+
+int *i;
+void __attribute__((noinline))
+foo (void)
+{
+ *i = 1;
+}
+int __attribute__((noinline))
+bar(int local_p, int **q)
+{
+ int x = 0;
+ int *j;
+ int **p;
+ if (local_p)
+ p = &j;
+ else
+ p = q;
+ *p = &x; /* This makes x escape. */
+ foo ();
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ int k = 2;
+ int **q = &i;
+ i = &k;
+ if (bar (1, q) != 0 || k != 1)
+ abort ();
+ if (bar (0, q) != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "ESCAPED, points-to vars: { x }" "alias" } } */
+/* { dg-final { cleanup-tree-dump "alias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c
new file mode 100644
index 00000000000..ea11c8a3d7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c
@@ -0,0 +1,42 @@
+/* { dg-do run } */
+/* { dg-options "-O -fdump-tree-alias-details" } */
+
+int *i;
+void __attribute__((noinline))
+foo (void)
+{
+ *i = 1;
+}
+int **__attribute__((noinline,const))
+foobar (void)
+{
+ return &i;
+}
+int __attribute__((noinline))
+bar(int local_p)
+{
+ int x = 0;
+ int *j;
+ int **p;
+ if (local_p)
+ p = &j;
+ else
+ p = foobar();
+ *p = &x; /* This makes x escape. */
+ foo ();
+ return x;
+}
+extern void abort (void);
+int main()
+{
+ int k = 2;
+ i = &k;
+ if (bar (1) != 0 || k != 1)
+ abort ();
+ if (bar (0) != 1)
+ abort ();
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump "ESCAPED, points-to vars: { x }" "alias" } } */
+/* { dg-final { cleanup-tree-dump "alias" } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-27.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-27.c
new file mode 100644
index 00000000000..39368707ce9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-27.c
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-fre-details" } */
+
+int *q;
+void __attribute__((noinline))
+bar (void)
+{
+ *q = 1;
+}
+int foo(int which_p)
+{
+ int x = 0;
+ int *i,*j;
+ int **p;
+ if (which_p)
+ p = &i;
+ else
+ p = &j;
+ *p = &x;
+ bar ();
+ return x;
+}
+
+/* { dg-final { scan-tree-dump "Replaced x with 0" "fre" } } */
+/* { dg-final { cleanup-tree-dump "fre" } } */
diff --git a/gcc/testsuite/gcc.target/i386/builtin-unreachable.c b/gcc/testsuite/gcc.target/i386/builtin-unreachable.c
new file mode 100644
index 00000000000..802cf16d39a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/builtin-unreachable.c
@@ -0,0 +1,13 @@
+/* This should return 1 without setting up a stack frame or
+ jumping. */
+/* { dg-do compile } */
+/* { dg-require-effective-target ilp32 } */
+/* { dg-options "-O2 -fomit-frame-pointer" } */
+int h (char *p)
+{
+ if (*p)
+ __builtin_unreachable ();
+ return p ? 1 : 0;
+}
+/* { dg-final { scan-assembler-not "%e\[bs\]p" } } */
+/* { dg-final { scan-assembler-not "\[\\t \]+j" } } */
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_result_4.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_result_4.f90
new file mode 100644
index 00000000000..97e67e558ef
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/proc_ptr_result_4.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+!
+! PR 40451: [F03] procedure pointer assignment rejected
+!
+! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
+
+contains
+
+ function f()
+ intrinsic :: sin
+ procedure(sin), pointer :: f
+ f => sin
+ end function f
+
+end
+
diff --git a/gcc/toplev.c b/gcc/toplev.c
index ce6f7a95812..7a6c2656f2f 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -547,11 +547,11 @@ read_integral_parameter (const char *p, const char *pname, const int defval)
return atoi (p);
}
-/* When compiling with a recent enough GCC, we use the GNU C "extern inline"
- for floor_log2 and exact_log2; see toplev.h. That construct, however,
- conflicts with the ISO C++ One Definition Rule. */
+#if GCC_VERSION < 3004
-#if GCC_VERSION < 3004 || !defined (__cplusplus)
+/* The functions floor_log2 and exact_log2 are defined as inline
+ functions in toplev.h if GCC_VERSION >= 3004. The definitions here
+ are used for older versions of gcc. */
/* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
If X is 0, return -1. */
@@ -564,9 +564,6 @@ floor_log2 (unsigned HOST_WIDE_INT x)
if (x == 0)
return -1;
-#ifdef CLZ_HWI
- t = HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x);
-#else
if (HOST_BITS_PER_WIDE_INT > 64)
if (x >= (unsigned HOST_WIDE_INT) 1 << (t + 64))
t += 64;
@@ -583,7 +580,6 @@ floor_log2 (unsigned HOST_WIDE_INT x)
t += 2;
if (x >= ((unsigned HOST_WIDE_INT) 1) << (t + 1))
t += 1;
-#endif
return t;
}
@@ -596,14 +592,10 @@ exact_log2 (unsigned HOST_WIDE_INT x)
{
if (x != (x & -x))
return -1;
-#ifdef CTZ_HWI
- return x ? CTZ_HWI (x) : -1;
-#else
return floor_log2 (x);
-#endif
}
-#endif /* GCC_VERSION < 3004 || !defined (__cplusplus) */
+#endif /* GCC_VERSION < 3004 */
/* Handler for fatal signals, such as SIGSEGV. These are transformed
into ICE messages, which is much more user friendly. In case the
diff --git a/gcc/toplev.h b/gcc/toplev.h
index e62aa727606..cca68675f87 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -169,14 +169,17 @@ extern void decode_d_option (const char *);
extern bool fast_math_flags_set_p (void);
extern bool fast_math_flags_struct_set_p (struct cl_optimization *);
+/* Inline versions of the above for speed. */
+#if GCC_VERSION < 3004
+
/* Return log2, or -1 if not exact. */
extern int exact_log2 (unsigned HOST_WIDE_INT);
/* Return floor of log2, with -1 for zero. */
extern int floor_log2 (unsigned HOST_WIDE_INT);
-/* Inline versions of the above for speed. */
-#if GCC_VERSION >= 3004
+#else /* GCC_VERSION >= 3004 */
+
# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
# define CLZ_HWI __builtin_clzl
# define CTZ_HWI __builtin_ctzl
@@ -188,17 +191,18 @@ extern int floor_log2 (unsigned HOST_WIDE_INT);
# define CTZ_HWI __builtin_ctz
# endif
-extern inline int
+static inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
}
-extern inline int
+static inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? (int) CTZ_HWI (x) : -1;
}
+
#endif /* GCC_VERSION >= 3004 */
/* Functions used to get and set GCC's notion of in what directory
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index 495f95a8be7..997ce893593 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -220,16 +220,16 @@ chrec_fold_multiply_poly_poly (tree type,
/* "a*c". */
t0 = chrec_fold_multiply (type, CHREC_LEFT (poly0), CHREC_LEFT (poly1));
- /* "a*d + b*c + b*d". */
+ /* "a*d + b*c". */
t1 = chrec_fold_multiply (type, CHREC_LEFT (poly0), CHREC_RIGHT (poly1));
t1 = chrec_fold_plus (type, t1, chrec_fold_multiply (type,
CHREC_RIGHT (poly0),
CHREC_LEFT (poly1)));
- t1 = chrec_fold_plus (type, t1, chrec_fold_multiply (type,
- CHREC_RIGHT (poly0),
- CHREC_RIGHT (poly1)));
- /* "2*b*d". */
+ /* "b*d". */
t2 = chrec_fold_multiply (type, CHREC_RIGHT (poly0), CHREC_RIGHT (poly1));
+ /* "a*d + b*c + b*d". */
+ t1 = chrec_fold_plus (type, t1, t2);
+ /* "2*b*d". */
t2 = chrec_fold_multiply (type, SCALAR_FLOAT_TYPE_P (type)
? build_real (type, dconst2)
: build_int_cst (type, 2), t2);
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index 76c24b3b5cc..db45eedc595 100644
--- a/gcc/tree-chrec.h
+++ b/gcc/tree-chrec.h
@@ -132,7 +132,8 @@ build_polynomial_chrec (unsigned loop_num,
|| right == chrec_dont_know)
return chrec_dont_know;
- if (no_evolution_in_loop_p (left, loop_num, &val) && !val)
+ if (!no_evolution_in_loop_p (left, loop_num, &val)
+ || !val)
return chrec_dont_know;
/* Pointer types should occur only on the left hand side, i.e. in
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 7c155742fab..2361c254eac 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -50,11 +50,6 @@ static void do_niy (pretty_printer *, const_tree);
#define NIY do_niy(buffer,node)
-#define PRINT_FUNCTION_NAME(NODE) pp_printf \
- (buffer, "%s", TREE_CODE (NODE) == NOP_EXPR ? \
- lang_hooks.decl_printable_name (TREE_OPERAND (NODE, 0), 1) : \
- lang_hooks.decl_printable_name (NODE, 1))
-
static pretty_printer buffer;
static int initialized = 0;
@@ -160,6 +155,32 @@ print_generic_expr (FILE *file, tree t, int flags)
dump_generic_node (&buffer, t, 0, flags, false);
}
+/* Dump the assembly name of a decl node if it's sufficiently different
+ from the decl name. */
+
+static void
+maybe_dump_asm_name (pretty_printer *buffer, tree node, int flags)
+{
+ tree n, a;
+
+ if (flags & TDF_SLIM)
+ return;
+ if (DECL_NAME (node) == NULL || !DECL_ASSEMBLER_NAME_SET_P (node))
+ return;
+
+ n = DECL_NAME (node);
+ a = DECL_ASSEMBLER_NAME (node);
+ if (n == a)
+ return;
+ if (strncmp (IDENTIFIER_POINTER (n), "__builtin_", 10) == 0)
+ return;
+
+ pp_space (buffer);
+ pp_character (buffer, '[');
+ pp_tree_identifier (buffer, a);
+ pp_character (buffer, ']');
+}
+
/* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
in FLAGS. */
@@ -182,6 +203,8 @@ dump_decl_name (pretty_printer *buffer, tree node, int flags)
pp_printf (buffer, "%c.%u", c, DECL_UID (t));
}
}
+
+ maybe_dump_asm_name (buffer, node, flags);
}
/* Like the above, but used for pretty printing function calls. */
@@ -190,7 +213,12 @@ static void
dump_function_name (pretty_printer *buffer, tree node)
{
if (DECL_NAME (node))
- PRINT_FUNCTION_NAME (node);
+ {
+ if (TREE_CODE (node) == NOP_EXPR)
+ node = TREE_OPERAND (node, 0);
+ pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
+ maybe_dump_asm_name (buffer, node, 0);
+ }
else
dump_decl_name (buffer, node, 0);
}
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 0b8c2515fee..6cbec5de2bf 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -232,82 +232,6 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
return pt_solutions_intersect (&pi1->pt, &pi2->pt);
}
-/* Return true if STMT is an "escape" site from the current function. Escape
- sites those statements which might expose the address of a variable
- outside the current function. STMT is an escape site iff:
-
- 1- STMT is a function call, or
- 2- STMT is an __asm__ expression, or
- 3- STMT is an assignment to a non-local variable, or
- 4- STMT is a return statement.
-
- Return the type of escape site found, if we found one, or NO_ESCAPE
- if none. */
-
-enum escape_type
-is_escape_site (gimple stmt)
-{
- if (is_gimple_call (stmt))
- {
- if (gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST))
- return ESCAPE_TO_PURE_CONST;
-
- return ESCAPE_TO_CALL;
- }
- else if (gimple_code (stmt) == GIMPLE_ASM)
- return ESCAPE_TO_ASM;
- else if (is_gimple_assign (stmt))
- {
- tree lhs = gimple_assign_lhs (stmt);
-
- /* Get to the base of _REF nodes. */
- if (TREE_CODE (lhs) != SSA_NAME)
- lhs = get_base_address (lhs);
-
- /* If we couldn't recognize the LHS of the assignment, assume that it
- is a non-local store. */
- if (lhs == NULL_TREE)
- return ESCAPE_UNKNOWN;
-
- if (gimple_assign_cast_p (stmt))
- {
- tree from = TREE_TYPE (gimple_assign_rhs1 (stmt));
- tree to = TREE_TYPE (lhs);
-
- /* If the RHS is a conversion between a pointer and an integer, the
- pointer escapes since we can't track the integer. */
- if (POINTER_TYPE_P (from) && !POINTER_TYPE_P (to))
- return ESCAPE_BAD_CAST;
- }
-
- /* If the LHS is an SSA name, it can't possibly represent a non-local
- memory store. */
- if (TREE_CODE (lhs) == SSA_NAME)
- return NO_ESCAPE;
-
- /* If the LHS is a non-global decl, it isn't a non-local memory store.
- If the LHS escapes, the RHS escape is dealt with in the PTA solver. */
- if (DECL_P (lhs)
- && !is_global_var (lhs))
- return NO_ESCAPE;
-
- /* FIXME: LHS is not an SSA_NAME. Even if it's an assignment to a
- local variables we cannot be sure if it will escape, because we
- don't have information about objects not in SSA form. Need to
- implement something along the lines of
-
- J.-D. Choi, M. Gupta, M. J. Serrano, V. C. Sreedhar, and S. P.
- Midkiff, ``Escape analysis for java,'' in Proceedings of the
- Conference on Object-Oriented Programming Systems, Languages, and
- Applications (OOPSLA), pp. 1-19, 1999. */
- return ESCAPE_STORED_IN_GLOBAL;
- }
- else if (gimple_code (stmt) == GIMPLE_RETURN)
- return ESCAPE_TO_RETURN;
-
- return NO_ESCAPE;
-}
-
/* Dump alias information on FILE. */
diff --git a/gcc/tree-ssa-alias.h b/gcc/tree-ssa-alias.h
index 115d3935512..9115e61c22c 100644
--- a/gcc/tree-ssa-alias.h
+++ b/gcc/tree-ssa-alias.h
@@ -24,26 +24,6 @@
#include "coretypes.h"
-/* The reasons a variable may escape a function. */
-enum escape_type
-{
- NO_ESCAPE = 0, /* Doesn't escape. */
- ESCAPE_STORED_IN_GLOBAL = 1 << 0,
- ESCAPE_TO_ASM = 1 << 1, /* Passed by address to an assembly
- statement. */
- ESCAPE_TO_CALL = 1 << 2, /* Escapes to a function call. */
- ESCAPE_BAD_CAST = 1 << 3, /* Cast from pointer to integer */
- ESCAPE_TO_RETURN = 1 << 4, /* Returned from function. */
- ESCAPE_TO_PURE_CONST = 1 << 5, /* Escapes to a pure or constant
- function call. */
- ESCAPE_IS_GLOBAL = 1 << 6, /* Is a global variable. */
- ESCAPE_IS_PARM = 1 << 7, /* Is an incoming function argument. */
- ESCAPE_UNKNOWN = 1 << 8 /* We believe it escapes for
- some reason not enumerated
- above. */
-};
-
-
/* The points-to solution.
The points-to solution is a union of pt_vars and the abstract
@@ -107,7 +87,6 @@ typedef struct ao_ref_s
extern void ao_ref_init (ao_ref *, tree);
extern tree ao_ref_base (ao_ref *);
extern alias_set_type ao_ref_alias_set (ao_ref *);
-extern enum escape_type is_escape_site (gimple);
extern bool ptr_deref_may_alias_global_p (tree);
extern bool refs_may_alias_p (tree, tree);
extern bool refs_anti_dependent_p (tree, tree);
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 6d263ded177..8557b0b07c9 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1362,7 +1362,7 @@ vn_reference_insert_pieces (tree vuse, alias_set_type set, tree type,
/* Compute and return the hash value for nary operation VBO1. */
-inline hashval_t
+hashval_t
vn_nary_op_compute_hash (const vn_nary_op_t vno1)
{
hashval_t hash = 0;
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 7c95de4f3ec..60863d560f5 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -1664,6 +1664,19 @@ do_ds_constraint (constraint_t c, bitmap delta)
unsigned int t;
HOST_WIDE_INT fieldoffset = v->offset + loff;
+ /* If v is a NONLOCAL then this is an escape point. */
+ if (j == nonlocal_id)
+ {
+ t = find (escaped_id);
+ if (add_graph_edge (graph, t, rhs)
+ && bitmap_ior_into (get_varinfo (t)->solution, sol)
+ && !TEST_BIT (changed, t))
+ {
+ SET_BIT (changed, t);
+ changed_count++;
+ }
+ }
+
if (v->is_special_var)
continue;
@@ -1680,18 +1693,24 @@ do_ds_constraint (constraint_t c, bitmap delta)
if (v->may_have_pointers)
{
t = find (v->id);
- if (add_graph_edge (graph, t, rhs))
+ if (add_graph_edge (graph, t, rhs)
+ && bitmap_ior_into (get_varinfo (t)->solution, sol)
+ && !TEST_BIT (changed, t))
{
- if (bitmap_ior_into (get_varinfo (t)->solution, sol))
- {
- if (t == rhs)
- sol = get_varinfo (rhs)->solution;
- if (!TEST_BIT (changed, t))
- {
- SET_BIT (changed, t);
- changed_count++;
- }
- }
+ SET_BIT (changed, t);
+ changed_count++;
+ }
+ }
+ /* If v is a global variable then this is an escape point. */
+ if (is_global_var (v->decl))
+ {
+ t = find (escaped_id);
+ if (add_graph_edge (graph, t, rhs)
+ && bitmap_ior_into (get_varinfo (t)->solution, sol)
+ && !TEST_BIT (changed, t))
+ {
+ SET_BIT (changed, t);
+ changed_count++;
}
}
@@ -3343,7 +3362,7 @@ handle_rhs_call (gimple stmt, VEC(ce_s, heap) **results)
/* And if we applied NRV the address of the return slot escapes as well. */
if (gimple_call_return_slot_opt_p (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE
- && TREE_ADDRESSABLE (gimple_call_lhs (stmt)))
+ && TREE_ADDRESSABLE (TREE_TYPE (gimple_call_lhs (stmt))))
{
VEC(ce_s, heap) *tmpc = NULL;
struct constraint_expr lhsc, *c;
@@ -3542,7 +3561,6 @@ find_func_aliases (gimple origt)
VEC(ce_s, heap) *lhsc = NULL;
VEC(ce_s, heap) *rhsc = NULL;
struct constraint_expr *c;
- enum escape_type stmt_escape_type;
/* Now build constraints expressions. */
if (gimple_code (t) == GIMPLE_PHI)
@@ -3734,38 +3752,21 @@ find_func_aliases (gimple origt)
process_constraint (new_constraint (*c, *c2));
}
}
+ /* If there is a store to a global variable the rhs escapes. */
+ if ((lhsop = get_base_address (lhsop)) != NULL_TREE
+ && DECL_P (lhsop)
+ && is_global_var (lhsop))
+ make_escape_constraint (rhsop);
}
-
- stmt_escape_type = is_escape_site (t);
- if (stmt_escape_type == ESCAPE_STORED_IN_GLOBAL)
- {
- gcc_assert (is_gimple_assign (t));
- if (gimple_assign_rhs_code (t) == ADDR_EXPR)
- {
- tree rhs = gimple_assign_rhs1 (t);
- tree base = get_base_address (TREE_OPERAND (rhs, 0));
- if (base
- && (!DECL_P (base)
- || !is_global_var (base)))
- make_escape_constraint (rhs);
- }
- else if (get_gimple_rhs_class (gimple_assign_rhs_code (t))
- == GIMPLE_SINGLE_RHS)
- {
- if (could_have_pointers (gimple_assign_rhs1 (t)))
- make_escape_constraint (gimple_assign_rhs1 (t));
- }
- else
- gcc_unreachable ();
- }
- else if (stmt_escape_type == ESCAPE_BAD_CAST)
+ /* For conversions of pointers to non-pointers the pointer escapes. */
+ else if (gimple_assign_cast_p (t)
+ && POINTER_TYPE_P (TREE_TYPE (gimple_assign_rhs1 (t)))
+ && !POINTER_TYPE_P (TREE_TYPE (gimple_assign_lhs (t))))
{
- gcc_assert (is_gimple_assign (t));
- gcc_assert (CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (t))
- || gimple_assign_rhs_code (t) == VIEW_CONVERT_EXPR);
make_escape_constraint (gimple_assign_rhs1 (t));
}
- else if (stmt_escape_type == ESCAPE_TO_ASM)
+ /* Handle asms conservatively by adding escape constraints to everything. */
+ else if (gimple_code (t) == GIMPLE_ASM)
{
unsigned i, noutputs;
const char **oconstraints;
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index ada47e16c08..d63e974cf91 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1079,6 +1079,18 @@ tree_ssa_useless_type_conversion (tree expr)
return false;
}
+/* Strip conversions from EXP according to
+ tree_ssa_useless_type_conversion and return the resulting
+ expression. */
+
+tree
+tree_ssa_strip_useless_type_conversions (tree exp)
+{
+ while (tree_ssa_useless_type_conversion (exp))
+ exp = TREE_OPERAND (exp, 0);
+ return exp;
+}
+
/* Internal helper for walk_use_def_chains. VAR, FN and DATA are as
described in walk_use_def_chains.
diff --git a/gcc/tree.c b/gcc/tree.c
index d68f08e9b6f..f48512fceeb 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9460,5 +9460,78 @@ list_equal_p (const_tree t1, const_tree t2)
return !t1 && !t2;
}
+/* Return true iff conversion in EXP generates no instruction. Mark
+ it inline so that we fully inline into the stripping functions even
+ though we have two uses of this function. */
+
+static inline bool
+tree_nop_conversion (const_tree exp)
+{
+ tree outer_type, inner_type;
+
+ if (!CONVERT_EXPR_P (exp)
+ && TREE_CODE (exp) != NON_LVALUE_EXPR)
+ return false;
+ if (TREE_OPERAND (exp, 0) == error_mark_node)
+ return false;
+
+ outer_type = TREE_TYPE (exp);
+ inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
+
+ /* Use precision rather then machine mode when we can, which gives
+ the correct answer even for submode (bit-field) types. */
+ if ((INTEGRAL_TYPE_P (outer_type)
+ || POINTER_TYPE_P (outer_type)
+ || TREE_CODE (outer_type) == OFFSET_TYPE)
+ && (INTEGRAL_TYPE_P (inner_type)
+ || POINTER_TYPE_P (inner_type)
+ || TREE_CODE (inner_type) == OFFSET_TYPE))
+ return TYPE_PRECISION (outer_type) == TYPE_PRECISION (inner_type);
+
+ /* Otherwise fall back on comparing machine modes (e.g. for
+ aggregate types, floats). */
+ return TYPE_MODE (outer_type) == TYPE_MODE (inner_type);
+}
+
+/* Return true iff conversion in EXP generates no instruction. Don't
+ consider conversions changing the signedness. */
+
+static bool
+tree_sign_nop_conversion (const_tree exp)
+{
+ tree outer_type, inner_type;
+
+ if (!tree_nop_conversion (exp))
+ return false;
+
+ outer_type = TREE_TYPE (exp);
+ inner_type = TREE_TYPE (TREE_OPERAND (exp, 0));
+
+ return (TYPE_UNSIGNED (outer_type) == TYPE_UNSIGNED (inner_type)
+ && POINTER_TYPE_P (outer_type) == POINTER_TYPE_P (inner_type));
+}
+
+/* Strip conversions from EXP according to tree_nop_conversion and
+ return the resulting expression. */
+
+tree
+tree_strip_nop_conversions (tree exp)
+{
+ while (tree_nop_conversion (exp))
+ exp = TREE_OPERAND (exp, 0);
+ return exp;
+}
+
+/* Strip conversions from EXP according to tree_sign_nop_conversion
+ and return the resulting expression. */
+
+tree
+tree_strip_sign_nop_conversions (tree exp)
+{
+ while (tree_sign_nop_conversion (exp))
+ exp = TREE_OPERAND (exp, 0);
+ return exp;
+}
+
#include "gt-tree.h"
diff --git a/gcc/tree.h b/gcc/tree.h
index 41b5001834d..8aabf79cebe 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -966,30 +966,17 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
case NOP_EXPR: \
case CONVERT_EXPR
-/* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs
- that don't change the machine mode. */
+/* Given an expression as a tree, strip any conversion that generates
+ no instruction. Accepts both tree and const_tree arguments since
+ we are not modifying the tree itself. */
-#define STRIP_NOPS(EXP) \
- while ((CONVERT_EXPR_P (EXP) \
- || TREE_CODE (EXP) == NON_LVALUE_EXPR) \
- && TREE_OPERAND (EXP, 0) != error_mark_node \
- && (TYPE_MODE (TREE_TYPE (EXP)) \
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
- (EXP) = TREE_OPERAND (EXP, 0)
+#define STRIP_NOPS(EXP) \
+ (EXP) = tree_strip_nop_conversions (CONST_CAST_TREE (EXP))
/* Like STRIP_NOPS, but don't let the signedness change either. */
#define STRIP_SIGN_NOPS(EXP) \
- while ((CONVERT_EXPR_P (EXP) \
- || TREE_CODE (EXP) == NON_LVALUE_EXPR) \
- && TREE_OPERAND (EXP, 0) != error_mark_node \
- && (TYPE_MODE (TREE_TYPE (EXP)) \
- == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
- && (TYPE_UNSIGNED (TREE_TYPE (EXP)) \
- == TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (EXP, 0)))) \
- && (POINTER_TYPE_P (TREE_TYPE (EXP)) \
- == POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \
- (EXP) = TREE_OPERAND (EXP, 0)
+ (EXP) = tree_strip_sign_nop_conversions (CONST_CAST_TREE (EXP))
/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */
@@ -1004,9 +991,8 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
/* Remove unnecessary type conversions according to
tree_ssa_useless_type_conversion. */
-#define STRIP_USELESS_TYPE_CONVERSION(EXP) \
- while (tree_ssa_useless_type_conversion (EXP)) \
- EXP = TREE_OPERAND (EXP, 0)
+#define STRIP_USELESS_TYPE_CONVERSION(EXP) \
+ (EXP) = tree_ssa_strip_useless_type_conversions (EXP)
/* Nonzero if TYPE represents an integral type. Note that we do not
include COMPLEX types here. Keep these checks in ascending code
@@ -4632,6 +4618,8 @@ extern bool stdarg_p (tree);
extern bool prototype_p (tree);
extern bool auto_var_in_fn_p (const_tree, const_tree);
extern tree build_low_bits_mask (tree, unsigned);
+extern tree tree_strip_nop_conversions (tree);
+extern tree tree_strip_sign_nop_conversions (tree);
/* In cgraph.c */
extern void change_decl_assembler_name (tree, tree);
diff --git a/gcc/vec.c b/gcc/vec.c
index 6563fd372b7..3e60580992d 100644
--- a/gcc/vec.c
+++ b/gcc/vec.c
@@ -227,7 +227,7 @@ vec_gc_o_reserve_1 (void *vec, int reserve, size_t vec_offset, size_t elt_size,
bool exact MEM_STAT_DECL)
{
struct vec_prefix *pfx = (struct vec_prefix *) vec;
- unsigned alloc = alloc = calculate_allocation (pfx, reserve, exact);
+ unsigned alloc = calculate_allocation (pfx, reserve, exact);
if (!alloc)
{
diff --git a/gcc/vec.h b/gcc/vec.h
index d408c6d1a1a..d16fdaacbb4 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -1229,9 +1229,15 @@ extern void *vec_stack_o_reserve_exact (void *, int, size_t, size_t
MEM_STAT_DECL);
extern void vec_stack_free (void *);
+#ifdef GATHER_STATISTICS
+#define VEC_stack_alloc(T,alloc,name,line,function) \
+ (VEC_OP (T,stack,alloc1) \
+ (alloc, XALLOCAVAR (VEC(T,stack), VEC_embedded_size (T, alloc))))
+#else
#define VEC_stack_alloc(T,alloc) \
(VEC_OP (T,stack,alloc1) \
(alloc, XALLOCAVAR (VEC(T,stack), VEC_embedded_size (T, alloc))))
+#endif
#define DEF_VEC_ALLOC_P_STACK(T) \
VEC_TA(T,base,stack); \
@@ -1241,9 +1247,9 @@ struct vec_swallow_trailing_semi
#define DEF_VEC_ALLOC_FUNC_P_STACK(T) \
static inline VEC(T,stack) *VEC_OP (T,stack,alloc1) \
- (int alloc_, VEC(T,stack)* space MEM_STAT_DECL) \
+ (int alloc_, VEC(T,stack)* space) \
{ \
- return (VEC(T,stack) *) vec_stack_p_reserve_exact_1 (alloc_, space); \
+ return (VEC(T,stack) *) vec_stack_p_reserve_exact_1 (alloc_, space); \
}
#define DEF_VEC_ALLOC_O_STACK(T) \
@@ -1254,9 +1260,9 @@ struct vec_swallow_trailing_semi
#define DEF_VEC_ALLOC_FUNC_O_STACK(T) \
static inline VEC(T,stack) *VEC_OP (T,stack,alloc1) \
- (int alloc_, VEC(T,stack)* space MEM_STAT_DECL) \
+ (int alloc_, VEC(T,stack)* space) \
{ \
- return ((VEC(T,stack) *) vec_stack_p_reserve_exact_1 (alloc_, space); \
+ return ((VEC(T,stack) *) vec_stack_p_reserve_exact_1 (alloc_, space); \
}
#define DEF_VEC_ALLOC_I_STACK(T) \
@@ -1267,9 +1273,9 @@ struct vec_swallow_trailing_semi
#define DEF_VEC_ALLOC_FUNC_I_STACK(T) \
static inline VEC(T,stack) *VEC_OP (T,stack,alloc1) \
- (int alloc_, VEC(T,stack)* space MEM_STAT_DECL) \
+ (int alloc_, VEC(T,stack)* space) \
{ \
- return ((VEC(T,stack) *) vec_stack_p_reserve_exact_1 (alloc_, space); \
+ return ((VEC(T,stack) *) vec_stack_p_reserve_exact_1 (alloc_, space); \
}
#endif /* GCC_VEC_H */
diff --git a/gcc/vmsdbgout.c b/gcc/vmsdbgout.c
index 41a3420f9ed..917121a3802 100644
--- a/gcc/vmsdbgout.c
+++ b/gcc/vmsdbgout.c
@@ -173,7 +173,7 @@ static void vmsdbgout_end_source_file (unsigned int);
static void vmsdbgout_begin_block (unsigned int, unsigned int);
static void vmsdbgout_end_block (unsigned int, unsigned int);
static bool vmsdbgout_ignore_block (const_tree);
-static void vmsdbgout_source_line (unsigned int, const char *, int);
+static void vmsdbgout_source_line (unsigned int, const char *, int, bool);
static void vmsdbgout_begin_prologue (unsigned int, const char *);
static void vmsdbgout_end_prologue (unsigned int, const char *);
static void vmsdbgout_end_function (unsigned int);
@@ -1297,7 +1297,7 @@ vmsdbgout_end_prologue (unsigned int line, const char *file)
ASM_OUTPUT_LABEL (asm_out_file, label);
/* VMS PCA expects every PC range to correlate to some line and file. */
- vmsdbgout_source_line (line, file, 0);
+ vmsdbgout_source_line (line, file, 0, true);
}
}
@@ -1331,7 +1331,7 @@ vmsdbgout_end_epilogue (unsigned int line, const char *file)
ASM_OUTPUT_LABEL (asm_out_file, label);
/* VMS PCA expects every PC range to correlate to some line and file. */
- vmsdbgout_source_line (line, file, 0);
+ vmsdbgout_source_line (line, file, 0, true);
}
}
@@ -1534,10 +1534,10 @@ lookup_filename (const char *file_name)
static void
vmsdbgout_source_line (register unsigned line, register const char *filename,
- int discriminator)
+ int discriminator, bool is_stmt)
{
if (write_symbols == VMS_AND_DWARF2_DEBUG)
- (*dwarf2_debug_hooks.source_line) (line, filename, discriminator);
+ (*dwarf2_debug_hooks.source_line) (line, filename, discriminator, is_stmt);
if (debug_info_level >= DINFO_LEVEL_TERSE)
{
diff --git a/gcc/xcoffout.c b/gcc/xcoffout.c
index 3c853544ec4..0f13486ad1e 100644
--- a/gcc/xcoffout.c
+++ b/gcc/xcoffout.c
@@ -322,7 +322,8 @@ xcoffout_source_file (FILE *file, const char *filename, int inline_p)
void
xcoffout_source_line (unsigned int line, const char *filename,
- int discriminator ATTRIBUTE_UNUSED)
+ int discriminator ATTRIBUTE_UNUSED,
+ bool is_stmt ATTRIBUTE_UNUSED)
{
bool inline_p = (strcmp (xcoff_current_function_file, filename) != 0
|| (int) line < xcoff_begin_function_line);
diff --git a/gcc/xcoffout.h b/gcc/xcoffout.h
index caf8b08cc0b..124c106a8b5 100644
--- a/gcc/xcoffout.h
+++ b/gcc/xcoffout.h
@@ -182,4 +182,4 @@ extern void xcoffout_end_function (unsigned int);
extern void xcoffout_end_block (unsigned, unsigned);
extern int xcoff_assign_fundamental_type_number (tree);
extern void xcoffout_declare_function (FILE *, tree, const char *);
-extern void xcoffout_source_line (unsigned int, const char *, int);
+extern void xcoffout_source_line (unsigned int, const char *, int, bool);
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 263d8441cc9..e6ef4c31b07 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-17 Ian Lance Taylor <iant@google.com>
+
+ * include/cpplib.h (progname): Don't declare.
+
2009-06-12 Ian Lance Taylor <iant@google.com>
* include/cpplib.h (struct cpp_options): Add
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index a91f1552158..d39b80e2a5a 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -546,9 +546,6 @@ struct cpp_dir
dev_t dev;
};
-/* Name under which this program was invoked. */
-extern const char *progname;
-
/* The structure of a node in the hash table. The hash table has
entries for all identifiers: either macros defined by #define
commands (type NT_MACRO), assertions created with #assert
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 162470d8cb3..b08b72720cc 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,21 @@
+2009-06-16 Wim Lewis <wiml@hhhh.org>
+
+ * src/powerpc/ffi.c: Avoid clobbering cr3 and cr4, which are
+ supposed to be callee-saved.
+ * src/powerpc/sysv.S (small_struct_return_value): Fix overrun of
+ return buffer for odd-size structs.
+
+2009-06-16 Andreas Tobler <a.tobler@schweiz.org>
+
+ PR libffi/40444
+ * testsuite/lib/libffi-dg.exp (libffi_target_compile): Add
+ allow_stack_execute for Darwin.
+
+2009-06-16 Andrew Haley <aph@redhat.com>
+
+ * configure.ac (TARGETDIR): Add missing blank lines.
+ * configure: Regenerate.
+
2009-06-16 Andrew Haley <aph@redhat.com>
* testsuite/libffi.call/cls_align_sint64.c,
diff --git a/libffi/configure b/libffi/configure
index 05d3fab618e..f8665f73163 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -459,7 +459,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S OBJDUMP ac_ct_OBJDUMP AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 CPP CPPFLAGS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_TRUE MIPS_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_FREEBSD_TRUE X86_FREEBSD_FALSE X86_WIN32_TRUE X86_WIN32_FALSE X86_DARWIN_TRUE X86_DARWIN_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M32R_TRUE M32R_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE POWERPC_FREEBSD_TRUE POWERPC_FREEBSD_FALSE ARM_TRUE ARM_FALSE LIBFFI_CRIS_TRUE LIBFFI_CRIS_FALSE FRV_TRUE FRV_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_LINUX_TRUE PA_LINUX_FALSE PA_HPUX_TRUE PA_HPUX_FALSE PA64_HPUX_TRUE PA64_HPUX_FALSE ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LIBTOOL SED EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S OBJDUMP ac_ct_OBJDUMP AR ac_ct_AR RANLIB ac_ct_RANLIB lt_ECHO DSYMUTIL ac_ct_DSYMUTIL NMEDIT ac_ct_NMEDIT LIPO ac_ct_LIPO OTOOL ac_ct_OTOOL OTOOL64 ac_ct_OTOOL64 CPP CPPFLAGS MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_TRUE MIPS_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_FREEBSD_TRUE X86_FREEBSD_FALSE X86_WIN32_TRUE X86_WIN32_FALSE X86_WIN64_TRUE X86_WIN64_FALSE X86_DARWIN_TRUE X86_DARWIN_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M32R_TRUE M32R_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE POWERPC_FREEBSD_TRUE POWERPC_FREEBSD_FALSE ARM_TRUE ARM_FALSE LIBFFI_CRIS_TRUE LIBFFI_CRIS_FALSE FRV_TRUE FRV_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_LINUX_TRUE PA_LINUX_FALSE PA_HPUX_TRUE PA_HPUX_FALSE PA64_HPUX_TRUE PA64_HPUX_FALSE ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS'
ac_subst_files=''
ac_pwd=`pwd`
@@ -11107,8 +11107,11 @@ case "$host" in
x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;;
+
x86_64-*-cygwin* | x86_64-*-mingw*)
+ TARGET=X86_WIN64; TARGETDIR=x86
;;
+
x86_64-*-*)
TARGET=X86_64; TARGETDIR=x86
;;
@@ -11174,6 +11177,16 @@ fi
+if test x$TARGET = xX86_WIN64; then
+ X86_WIN64_TRUE=
+ X86_WIN64_FALSE='#'
+else
+ X86_WIN64_TRUE='#'
+ X86_WIN64_FALSE=
+fi
+
+
+
if test x$TARGET = xX86_DARWIN; then
X86_DARWIN_TRUE=
X86_DARWIN_FALSE='#'
@@ -13618,6 +13631,13 @@ echo "$as_me: error: conditional \"X86_WIN32\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${X86_WIN64_TRUE}" && test -z "${X86_WIN64_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"X86_WIN64\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"X86_WIN64\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${X86_DARWIN_TRUE}" && test -z "${X86_DARWIN_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"X86_DARWIN\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -14198,6 +14218,9 @@ ac_configure_args="${multilib_arg} ${ac_configure_args}"
multi_basedir="$multi_basedir"
CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
CC="$CC"
+CXX="$CXX"
+GFORTRAN="$GFORTRAN"
+GCJ="$GCJ"
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
@@ -14659,6 +14682,8 @@ s,@X86_FREEBSD_TRUE@,$X86_FREEBSD_TRUE,;t t
s,@X86_FREEBSD_FALSE@,$X86_FREEBSD_FALSE,;t t
s,@X86_WIN32_TRUE@,$X86_WIN32_TRUE,;t t
s,@X86_WIN32_FALSE@,$X86_WIN32_FALSE,;t t
+s,@X86_WIN64_TRUE@,$X86_WIN64_TRUE,;t t
+s,@X86_WIN64_FALSE@,$X86_WIN64_FALSE,;t t
s,@X86_DARWIN_TRUE@,$X86_DARWIN_TRUE,;t t
s,@X86_DARWIN_FALSE@,$X86_DARWIN_FALSE,;t t
s,@ALPHA_TRUE@,$ALPHA_TRUE,;t t
diff --git a/libffi/configure.ac b/libffi/configure.ac
index fe3a5fb075a..2ab5902746e 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -145,9 +145,11 @@ case "$host" in
x86_64-*-darwin*)
TARGET=X86_DARWIN; TARGETDIR=x86
;;
+
x86_64-*-cygwin* | x86_64-*-mingw*)
TARGET=X86_WIN64; TARGETDIR=x86
;;
+
x86_64-*-*)
TARGET=X86_64; TARGETDIR=x86
;;
diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c
index a0426f46750..fbbfbe2e2ea 100644
--- a/libffi/src/powerpc/ffi.c
+++ b/libffi/src/powerpc/ffi.c
@@ -43,11 +43,12 @@ enum {
FLAG_RETURNS_64BITS = 1 << (31-28),
FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */
-
- FLAG_SYSV_SMST_R4 = 1 << (31-16), /* cr4, use r4 for FFI_SYSV 8 byte
+ FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte
structs. */
- FLAG_SYSV_SMST_R3 = 1 << (31-15), /* cr3, use r3 for FFI_SYSV 4 byte
+ FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte
structs. */
+ /* Bits (31-24) through (31-19) store shift value for SMST */
+
FLAG_ARG_NEEDS_COPY = 1 << (31- 7),
FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */
FLAG_4_GPR_ARGUMENTS = 1 << (31- 5),
@@ -685,14 +686,14 @@ ffi_prep_cif_machdep (ffi_cif *cif)
if (size <= 4)
{
flags |= FLAG_SYSV_SMST_R3;
- flags |= 8 * (4 - size) << 4;
+ flags |= 8 * (4 - size) << 8;
break;
}
/* These structs are returned in r3 and r4. See above. */
if (size <= 8)
{
- flags |= FLAG_SYSV_SMST_R4;
- flags |= 8 * (8 - size) << 4;
+ flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4;
+ flags |= 8 * (8 - size) << 8;
break;
}
}
diff --git a/libffi/src/powerpc/sysv.S b/libffi/src/powerpc/sysv.S
index c06311fd591..96ea22b0b40 100644
--- a/libffi/src/powerpc/sysv.S
+++ b/libffi/src/powerpc/sysv.S
@@ -136,29 +136,18 @@ L(float_return_value):
b L(done_return_value)
L(small_struct_return_value):
- mtcrf 0x10,%r31 /* cr3 */
- bt- 15,L(smst_one_register)
- mtcrf 0x08,%r31 /* cr4 */
- bt- 16,L(smst_two_register)
- b L(done_return_value)
-
-L(smst_one_register):
- rlwinm %r5,%r31,5+23,32-5,31 /* Extract the value to shift. */
- slw %r3,%r3,%r5
- stw %r3,0(%r30)
- b L(done_return_value)
-L(smst_two_register):
- rlwinm %r5,%r31,5+23,32-5,31 /* Extract the value to shift. */
- cmpwi %r5,0
- subfic %r9,%r5,32
- slw %r29,%r3,%r5
- srw %r9,%r4,%r9
- beq- L(smst_8byte)
- or %r3,%r9,%r29
- slw %r4,%r4,%r5
-L(smst_8byte):
- stw %r3,0(%r30)
- stw %r4,4(%r30)
+ extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */
+ mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */
+ extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */
+ subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */
+ bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */
+/* smst_one_register: */
+ slw %r3,%r3,%r5 /* Left-justify value in r3 */
+ mtxer %r6 /* move byte count to XER ... */
+ stswx %r3,0,%r30 /* ... and store that many bytes */
+ bf+ 26,L(done_return_value) /* struct in r3:r4 ? */
+ add %r6,%r6,%r30 /* adjust pointer */
+ stswi %r4,%r6,4 /* store last four bytes */
b L(done_return_value)
.LFE1:
diff --git a/libffi/testsuite/lib/libffi-dg.exp b/libffi/testsuite/lib/libffi-dg.exp
index 5ec6c4dc76b..8db38c286a8 100644
--- a/libffi/testsuite/lib/libffi-dg.exp
+++ b/libffi/testsuite/lib/libffi-dg.exp
@@ -187,6 +187,13 @@ proc libffi_target_compile { source dest type options } {
lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.."
lappend options "additional_flags=${libffi_link_flags}"
+ # Darwin needs a stack execution allowed flag.
+
+ if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"]
+ || [istarget "*-*-darwin2*"] } {
+ lappend options "additional_flags=-Wl,-allow_stack_execute"
+ }
+
# If you're building the compiler with --prefix set to a place
# where it's not yet installed, then the linker won't be able to
# find the libgcc used by libffi.dylib. We could pass the
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 69d3617d6e8..f5ac7832942 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,9 @@
+2009-06-16 Nick Clifton <nickc@redhat.com>
+
+ PR 10197
+ * testsuite/test-demangle.c: Rename getline to get_line to avoid
+ conflicts with system function of the same name.
+
2009-05-30 Eli Zaretskii <eliz@gnu.org>
* snprintf.c: Doc fix.
diff --git a/libiberty/testsuite/test-demangle.c b/libiberty/testsuite/test-demangle.c
index 12b07dd6476..1c982d6ef20 100644
--- a/libiberty/testsuite/test-demangle.c
+++ b/libiberty/testsuite/test-demangle.c
@@ -46,7 +46,7 @@ static unsigned int lineno;
#define LINELEN 80
static void
-getline(buf)
+get_line(buf)
struct line *buf;
{
char *data = buf->data;
@@ -196,12 +196,12 @@ main(argc, argv)
{
const char *inp;
- getline (&format);
+ get_line (&format);
if (feof (stdin))
break;
- getline (&input);
- getline (&expect);
+ get_line (&input);
+ get_line (&expect);
inp = protect_end (input.data);
@@ -322,7 +322,7 @@ main(argc, argv)
if (no_params)
{
- getline (&expect);
+ get_line (&expect);
result = cplus_demangle (inp, DMGL_ANSI|DMGL_TYPES);
if (result
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj
index e4d7c2fae3c..6398644ad7d 100644
--- a/libjava/classpath/ChangeLog.gcj
+++ b/libjava/classpath/ChangeLog.gcj
@@ -1,3 +1,13 @@
+2009-06-16 Matthias Klose <doko@ubuntu.com>
+
+ * tools/gnu/classpath/tools/gjdoc/Main.java (getGjdocVersion): Use
+ gnu.classpath.Configuration.CLASSPATH_VERSION as version number.
+ * tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
+ (getDocletVersion): Likewise.
+ * tools/classes/gnu/classpath/tools/gjdoc/Main*.class: Regenerate.
+ * tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet*.class:
+ Regenerate.
+
2009-03-16 Matthias Klose <doko@ubuntu.com>
* configure.ac: Detect xulrunner-1.9.
diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.class b/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.class
index 6e9981b5ee7..e76e4ad0885 100644
--- a/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.class
+++ b/libjava/classpath/tools/classes/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.class
Binary files differ
diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class b/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class
index 1ce24d1d49c..e53a62553b3 100644
--- a/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class
+++ b/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class
Binary files differ
diff --git a/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java b/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
index 837333ddf0f..e49e1c57341 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/doclets/htmldoclet/HtmlDoclet.java
@@ -3736,20 +3736,7 @@ public class HtmlDoclet
protected String getDocletVersion()
{
if (null == docletVersion) {
- try {
- Properties versionProperties = new Properties();
- InputStream in = getClass().getResourceAsStream("/version.properties");
- if (in == null) {
- in = new FileInputStream("src/resources/version.properties");
- }
- versionProperties.load(in);
- docletVersion = versionProperties.getProperty("gjdoc.version");
- }
- catch (IOException ignore) {
- }
- if (null == docletVersion) {
- docletVersion = "unknown";
- }
+ docletVersion = gnu.classpath.Configuration.CLASSPATH_VERSION;
}
return docletVersion;
}
diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
index d1316b34183..cbbc8f4f7dd 100644
--- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
+++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java
@@ -1825,16 +1825,7 @@ public final class Main
public String getGjdocVersion()
{
if (null == gjdocVersion) {
- try {
- Properties versionProperties = new Properties();
- versionProperties.load(getClass().getResourceAsStream("version.properties"));
- gjdocVersion = versionProperties.getProperty("gjdoc.version");
- }
- catch (IOException ignore) {
- }
- if (null == gjdocVersion) {
- gjdocVersion = "unknown";
- }
+ gjdocVersion = gnu.classpath.Configuration.CLASSPATH_VERSION;
}
return gjdocVersion;
}
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2ca72ea84fa..29747b18c8e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,78 @@
+2009-06-17 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/23_containers/list/check_construct_destroy.h: New.
+ Move test logic here.
+ * testsuite/23_containers/list/moveable.h: Same.
+ * testsuite/23_containers/list/modifiers/insert/25288.h: Same.
+ * testsuite/23_containers/list/modifiers/1.h: Same.
+ * testsuite/23_containers/list/modifiers/2.h: Same.
+ * testsuite/23_containers/list/modifiers/3.h: Same.
+ * testsuite/23_containers/list/modifiers/swap/1.h: Same.
+ * testsuite/23_containers/list/modifiers/swap/2.h: Same.
+ * testsuite/23_containers/list/modifiers/swap/3.h: Same.
+ * testsuite/23_containers/list/operations/1.h: Same.
+ * testsuite/23_containers/list/operations/2.h: Same.
+ * testsuite/23_containers/list/operations/3.h: Same.
+ * testsuite/23_containers/list/operations/4.h: Same.
+ * testsuite/23_containers/list/operations/5.h: Same.
+ * testsuite/23_containers/list/capacity/1.h: Same.
+ * testsuite/23_containers/list/init-list.h: Same.
+ * testsuite/23_containers/list/cons/1.h: Same.
+ * testsuite/23_containers/list/cons/2.h: Same.
+ * testsuite/23_containers/list/cons/3.h: Same.
+ * testsuite/23_containers/list/cons/4.h: Same.
+ * testsuite/23_containers/list/cons/5.h: Same.
+ * testsuite/23_containers/list/cons/6.h: Same.
+ * testsuite/23_containers/list/cons/7.h: Same.
+ * testsuite/23_containers/list/cons/8.h: Same.
+ * testsuite/23_containers/list/cons/9.h: Same.
+ * testsuite/23_containers/list/cons/clear_allocator.h: Same.
+ * testsuite/23_containers/list/modifiers/insert/25288.cc: Include test
+ header.
+ * testsuite/23_containers/list/modifiers/1.cc: Same.
+ * testsuite/23_containers/list/modifiers/2.cc: Same.
+ * testsuite/23_containers/list/modifiers/3.cc: Same.
+ * testsuite/23_containers/list/modifiers/swap/1.cc: Same.
+ * testsuite/23_containers/list/modifiers/swap/2.cc: Same.
+ * testsuite/23_containers/list/modifiers/swap/3.cc: Same.
+ * testsuite/23_containers/list/operations/1.cc: Same.
+ * testsuite/23_containers/list/operations/2.cc: Same.
+ * testsuite/23_containers/list/operations/3.cc: Same.
+ * testsuite/23_containers/list/operations/4.cc: Same.
+ * testsuite/23_containers/list/operations/5.cc: Same.
+ * testsuite/23_containers/list/capacity/1.cc: Same.
+ * testsuite/23_containers/list/init-list.cc: Same.
+ * testsuite/23_containers/list/cons/1.cc: Same.
+ * testsuite/23_containers/list/cons/2.cc: Same.
+ * testsuite/23_containers/list/cons/3.cc: Same.
+ * testsuite/23_containers/list/cons/4.cc: Same.
+ * testsuite/23_containers/list/cons/5.cc: Same.
+ * testsuite/23_containers/list/cons/6.cc: Same.
+ * testsuite/23_containers/list/cons/7.cc: Same.
+ * testsuite/23_containers/list/cons/8.cc: Same.
+ * testsuite/23_containers/list/cons/9.cc: Same.
+ * testsuite/23_containers/list/cons/clear_allocator.cc: Same.
+ * testsuite/23_containers/list/check_construct_destroy.cc: Same.
+ * testsuite/23_containers/list/moveable.cc: Same.
+
+2009-06-17 Tom Tromey <tromey@redhat.com>
+
+ * python/hook.in: Do not fail when there is no current objfile.
+ Use os.path.normpath.
+
+2009-06-16 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * libsupc++/exception_ptr.h (exception_ptr::swap(exception_ptr&&)):
+ Remove.
+ (exception_ptr::operator=(exception_ptr&&)): Cast source to
+ rvalue-reference so that move constructor is called.
+ * testsuite/18_support/exception_ptr/move.cc: New.
+
+2009-06-16 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ * include/std/thread (~thread(), operator=(thread&&)): Call terminate
+ if joinable.
+
2009-06-15 Tom Tromey <tromey@redhat.com>
* python/libstdcxx/v6/printers.py (StdMapPrinter.__init__): Don't
diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread
index fbdfe2ee53f..bf282cc0365 100644
--- a/libstdc++-v3/include/std/thread
+++ b/libstdc++-v3/include/std/thread
@@ -135,7 +135,7 @@ namespace std
~thread()
{
if (joinable())
- detach();
+ std::terminate();
}
thread& operator=(const thread&) = delete;
@@ -143,7 +143,7 @@ namespace std
thread& operator=(thread&& __t)
{
if (joinable())
- detach();
+ std::terminate();
swap(__t);
return *this;
}
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 37f3132d7ae..23477c9c3a6 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -123,7 +123,7 @@ namespace std
exception_ptr&
operator=(exception_ptr&& __o) throw()
{
- exception_ptr(__o).swap(*this);
+ exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this);
return *this;
}
#endif
@@ -133,16 +133,6 @@ namespace std
void
swap(exception_ptr&) throw();
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
- void
- swap(exception_ptr &&__o) throw()
- {
- void *__tmp = _M_exception_object;
- _M_exception_object = __o._M_exception_object;
- __o._M_exception_object = __tmp;
- }
-#endif
-
#ifdef _GLIBCXX_EH_PTR_COMPAT
// Retained for compatibility with CXXABI_1.3.
bool operator!() const throw() __attribute__ ((__pure__));
diff --git a/libstdc++-v3/python/hook.in b/libstdc++-v3/python/hook.in
index f7bf1afb44d..120e187ed19 100644
--- a/libstdc++-v3/python/hook.in
+++ b/libstdc++-v3/python/hook.in
@@ -22,33 +22,38 @@ import os.path
pythondir = '@pythondir@'
libdir = '@toolexeclibdir@'
-# Update module path. We want to find the relative path from libdir
-# to pythondir, and then we want to apply that relative path to the
-# directory holding the objfile with which this file is associated.
-# This preserves relocatability of the gcc tree.
-
-# Do a simple normalization that removes duplicate separators.
-pythondir = os.path.join (*['/'] + pythondir.split (os.sep))
-libdir = os.path.join (*['/'] + libdir.split (os.sep))
-
-prefix = os.path.commonprefix ([libdir, pythondir])
-# In some bizarre configuration we might have found a match in the
-# middle of a directory name.
-if prefix[-1] != '/':
- prefix = os.path.dirname (prefix)
-
-# Strip off the prefix.
-pythondir = pythondir[len (prefix):]
-libdir = libdir[len (prefix):]
-
-# Compute the ".."s needed to get from libdir to the prefix.
-dotdots = ('..' + os.sep) * len (libdir.split (os.sep))
-
-objfile = gdb.current_objfile ().filename
-dir = os.path.join (os.path.dirname (objfile), dotdots, pythondir)
-
-if not dir in sys.path:
- sys.path.insert(0, dir)
+# This file might be loaded when there is no current objfile. This
+# can happen if the user loads it manually. In this case we don't
+# update sys.path; instead we just hope the user managed to do that
+# beforehand.
+if gdb.current_objfile () is not None:
+ # Update module path. We want to find the relative path from libdir
+ # to pythondir, and then we want to apply that relative path to the
+ # directory holding the objfile with which this file is associated.
+ # This preserves relocatability of the gcc tree.
+
+ # Do a simple normalization that removes duplicate separators.
+ pythondir = os.path.normpath (pythondir)
+ libdir = os.path.normpath (libdir)
+
+ prefix = os.path.commonprefix ([libdir, pythondir])
+ # In some bizarre configuration we might have found a match in the
+ # middle of a directory name.
+ if prefix[-1] != '/':
+ prefix = os.path.dirname (prefix)
+
+ # Strip off the prefix.
+ pythondir = pythondir[len (prefix):]
+ libdir = libdir[len (prefix):]
+
+ # Compute the ".."s needed to get from libdir to the prefix.
+ dotdots = ('..' + os.sep) * len (libdir.split (os.sep))
+
+ objfile = gdb.current_objfile ().filename
+ dir = os.path.join (os.path.dirname (objfile), dotdots, pythondir)
+
+ if not dir in sys.path:
+ sys.path.insert(0, dir)
# Load the pretty-printers.
from libstdcxx.v6.printers import register_libstdcxx_printers
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc
new file mode 100644
index 00000000000..ce97bc28c25
--- /dev/null
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/move.cc
@@ -0,0 +1,45 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <exception>
+#include <utility>
+#include <testsuite_hooks.h>
+
+// Verify move construction and assignment are efficient and do not copy.
+// This behaviour is a GNU extension provided for efficiency.
+void test01()
+{
+ bool test = true;
+
+ std::exception_ptr p1 = std::copy_exception(test);
+ std::exception_ptr p2 = std::move(p1);
+ VERIFY( p1 == 0 );
+ VERIFY( !(p2 == 0) );
+
+ p1 = std::move(p2);
+ VERIFY( !(p1 == 0) );
+ VERIFY( p2 == 0 );
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
index d820776e3a8..cb6c29ac8d1 100644
--- a/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
@@ -15,51 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.2 list capacity [lib.list.capacity]
-
+#include "1.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// This test verifies the following.
-//
-// 23.2.2 bool empty() const
-// 23.2.2 size_type size() const
-// 23.2.2 iterator begin()
-// 23.2.2 iterator end()
-// 23.2.2.3 void push_back(const T&)
-// 23.2.2 size_type max_size() const
-// 23.2.2.2 void resize(size_type s, T c = T())
-//
-template<typename _Tp>
-void
-capacity01()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator_type;
-
- list_type list0101;
- VERIFY(list0101.empty());
- VERIFY(list0101.size() == 0);
-
- list0101.push_back(1);
- VERIFY(!list0101.empty());
- VERIFY(list0101.size() == 1);
-
- list0101.resize(3, 2);
- VERIFY(!list0101.empty());
- VERIFY(list0101.size() == 3);
-
- iterator_type i = list0101.begin();
- VERIFY(*i == 1); ++i;
- VERIFY(*i == 2); ++i;
- VERIFY(*i == 2); ++i;
- VERIFY(i == list0101.end());
-
- list0101.resize(0);
- VERIFY(list0101.empty());
- VERIFY(list0101.size() == 0);
-}
int
main()
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/1.h b/libstdc++-v3/testsuite/23_containers/list/capacity/1.h
new file mode 100644
index 00000000000..4a2f2bc06a2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/1.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.2 list capacity [lib.list.capacity]
+
+#include <testsuite_hooks.h>
+
+// This test verifies the following.
+//
+// 23.2.2 bool empty() const
+// 23.2.2 size_type size() const
+// 23.2.2 iterator begin()
+// 23.2.2 iterator end()
+// 23.2.2.3 void push_back(const T&)
+// 23.2.2 size_type max_size() const
+// 23.2.2.2 void resize(size_type s, T c = T())
+//
+template<typename _Tp>
+void
+capacity01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator_type;
+
+ list_type list0101;
+ VERIFY(list0101.empty());
+ VERIFY(list0101.size() == 0);
+
+ list0101.push_back(1);
+ VERIFY(!list0101.empty());
+ VERIFY(list0101.size() == 1);
+
+ list0101.resize(3, 2);
+ VERIFY(!list0101.empty());
+ VERIFY(list0101.size() == 3);
+
+ iterator_type i = list0101.begin();
+ VERIFY(*i == 1); ++i;
+ VERIFY(*i == 2); ++i;
+ VERIFY(*i == 2); ++i;
+ VERIFY(i == list0101.end());
+
+ list0101.resize(0);
+ VERIFY(list0101.empty());
+ VERIFY(list0101.size() == 0);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
index a223bc85007..31dacb59253 100644
--- a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
@@ -18,70 +18,12 @@
// <http://www.gnu.org/licenses/>.
//
+#include "check_construct_destroy.h"
#include <list>
-#include <iterator>
-#include <testsuite_allocator.h>
-
-
-template<typename _Tp>
-bool
-construct_destroy()
-{
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator_type;
-
- using namespace __gnu_test;
- const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
- bool ok = true;
-
- tracker_allocator_counter::reset();
- {
- list_type c;
- ok = check_construct_destroy("empty container", 0, 0) && ok;
- }
- ok = check_construct_destroy("empty container", 0, 0) && ok;
-
-
- tracker_allocator_counter::reset();
- {
- list_type c(arr10, arr10 + 10);
- ok = check_construct_destroy("Construct from range", 10, 0) && ok;
- }
- ok = check_construct_destroy("Construct from range", 10, 10) && ok;
-
- {
- list_type c(arr10, arr10 + 10);
- tracker_allocator_counter::reset();
- c.insert(c.begin(), arr10[0]);
- ok = check_construct_destroy("Insert element", 1, 0) && ok;
- }
- ok = check_construct_destroy("Insert element", 1, 11) && ok;
-
- {
- list_type c(arr10, arr10 + 10);
- tracker_allocator_counter::reset();
- iterator_type i5 = c.begin();
- std::advance(i5, 5);
- c.insert(i5, arr10, arr10+3);
- ok = check_construct_destroy("Insert short range", 3, 0) && ok;
- }
- ok = check_construct_destroy("Insert short range", 3, 13) && ok;
-
- {
- list_type c(arr10, arr10 + 10);
- tracker_allocator_counter::reset();
- iterator_type i7 = c.begin();
- std::advance(i7, 5);
- c.insert(i7, arr10, arr10+10);
- ok = check_construct_destroy("Insert long range", 10, 0) && ok;
- }
- ok = check_construct_destroy("Insert long range", 10, 20) && ok;
-
- return ok ? 0 : 1;
-}
int main()
{
- construct_destroy<std::list<int, __gnu_test::tracker_allocator<int> > >();
+ typedef __gnu_test::tracker_allocator<int> allocator_type;
+ construct_destroy<std::list<int, allocator_type> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h
new file mode 100644
index 00000000000..14da42dc875
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.h
@@ -0,0 +1,79 @@
+// 2004-07-26 Matt Austern <austern@apple.com>
+//
+// Copyright (C) 2003, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <iterator>
+#include <testsuite_allocator.h>
+
+template<typename _Tp>
+bool
+construct_destroy()
+{
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator_type;
+
+ using namespace __gnu_test;
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ list_type c;
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+ }
+ ok = check_construct_destroy("empty container", 0, 0) && ok;
+
+
+ tracker_allocator_counter::reset();
+ {
+ list_type c(arr10, arr10 + 10);
+ ok = check_construct_destroy("Construct from range", 10, 0) && ok;
+ }
+ ok = check_construct_destroy("Construct from range", 10, 10) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ c.insert(c.begin(), arr10[0]);
+ ok = check_construct_destroy("Insert element", 1, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert element", 1, 11) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ iterator_type i5 = c.begin();
+ std::advance(i5, 5);
+ c.insert(i5, arr10, arr10+3);
+ ok = check_construct_destroy("Insert short range", 3, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert short range", 3, 13) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ iterator_type i7 = c.begin();
+ std::advance(i7, 5);
+ c.insert(i7, arr10, arr10+10);
+ ok = check_construct_destroy("Insert long range", 10, 0) && ok;
+ }
+ ok = check_construct_destroy("Insert long range", 10, 20) && ok;
+
+ return ok ? 0 : 1;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/1.cc b/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
index 2228a506fe9..da469ebb194 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
@@ -15,55 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "1.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// A nontrivial type.
-template<typename T>
- struct A { };
-
-// Another nontrivial type
-struct B { };
-
-// Default constructor, basic properties
-//
-// This test verifies the following.
-// 23.2.2.1 explicit list(const a& = Allocator())
-// 23.1 (7) iterator behaviour of empty containers
-// 23.2.2 iterator begin()
-// 23.2.2 iterator end()
-// 23.2.2 size_type size() const
-// 23.2.2 existence of required typedefs
-//
-template<typename _Tp>
-void
-cons01()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
-
- list_type list0101;
- VERIFY(list0101.begin() == list0101.end());
- VERIFY(list0101.size() == 0);
-
- // check type definitions -- will fail compile if missing
- typedef typename list_type::reference reference;
- typedef typename list_type::const_reference const_reference;
- typedef typename list_type::iterator iterator;
- typedef typename list_type::const_iterator const_iterator;
- typedef typename list_type::size_type size_type;
- typedef typename list_type::difference_type difference_type;
- typedef typename list_type::value_type value_type;
- typedef typename list_type::allocator_type allocator_type;
- typedef typename list_type::pointer pointer;
- typedef typename list_type::const_pointer const_pointer;
- typedef typename list_type::reverse_iterator reverse_iterator;
- typedef typename list_type::const_reverse_iterator const_reverse_iterator;
-
- // allocator checks?
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/1.h b/libstdc++-v3/testsuite/23_containers/list/cons/1.h
new file mode 100644
index 00000000000..2aa48be9146
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/1.h
@@ -0,0 +1,63 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type.
+template<typename T>
+ struct A { };
+
+// Another nontrivial type
+struct B { };
+
+// Default constructor, basic properties
+//
+// This test verifies the following.
+// 23.2.2.1 explicit list(const a& = Allocator())
+// 23.1 (7) iterator behaviour of empty containers
+// 23.2.2 iterator begin()
+// 23.2.2 iterator end()
+// 23.2.2 size_type size() const
+// 23.2.2 existence of required typedefs
+//
+template<typename _Tp>
+void
+cons01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type list0101;
+ VERIFY(list0101.begin() == list0101.end());
+ VERIFY(list0101.size() == 0);
+
+ // check type definitions -- will fail compile if missing
+ typedef typename list_type::reference reference;
+ typedef typename list_type::const_reference const_reference;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::const_iterator const_iterator;
+ typedef typename list_type::size_type size_type;
+ typedef typename list_type::difference_type difference_type;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::pointer pointer;
+ typedef typename list_type::const_pointer const_pointer;
+ typedef typename list_type::reverse_iterator reverse_iterator;
+ typedef typename list_type::const_reverse_iterator const_reverse_iterator;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/2.cc b/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
index a38cf7d1bba..86c59f383f8 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
@@ -15,67 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "2.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// A nontrivial type.
-template<typename T>
- struct A { };
-
-// Another nontrivial type
-struct B { };
-
-// Fill constructor
-//
-// This test verifies the following.
-// 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
-// 23.2.2 const_iterator begin() const
-// 23.2.2 const_iterator end() const
-// 23.2.2 size_type size() const
-//
-template<typename _Tp>
-void
-cons021()
-{
- bool test __attribute__((unused)) = true;
- const std::size_t LIST_SIZE = 5;
- const int INIT_VALUE = 7;
- std::size_t count;
-
- typedef _Tp list_type;
- typedef typename list_type::const_iterator const_iterator;
- const_iterator i;
-
- // default value
- list_type list0202(LIST_SIZE);
- for (i = list0202.begin(), count = 0;
- i != list0202.end();
- ++i, ++count)
- VERIFY(*i == 0);
- VERIFY(count == LIST_SIZE);
- VERIFY(list0202.size() == LIST_SIZE);
-
- // explicit value
- list_type list0203(LIST_SIZE, INIT_VALUE);
- for (i = list0203.begin(), count = 0;
- i != list0203.end();
- ++i, ++count)
- VERIFY(*i == INIT_VALUE);
- VERIFY(count == LIST_SIZE);
- VERIFY(list0203.size() == LIST_SIZE);
-}
-
-template<typename _Tp>
-void
-cons022()
-{
- // nontrivial value_type
- typedef _Tp list_type;
- const std::size_t LIST_SIZE = 5;
- list_type list0201(LIST_SIZE);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/2.h b/libstdc++-v3/testsuite/23_containers/list/cons/2.h
new file mode 100644
index 00000000000..eb32896e79a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/2.h
@@ -0,0 +1,77 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type.
+template<typename T>
+ struct A { };
+
+// Another nontrivial type
+struct B { };
+
+// Fill constructor
+//
+// This test verifies the following.
+// 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons021()
+{
+ bool test __attribute__((unused)) = true;
+ const std::size_t LIST_SIZE = 5;
+ const int INIT_VALUE = 7;
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ // default value
+ list_type list0202(LIST_SIZE);
+ for (i = list0202.begin(), count = 0;
+ i != list0202.end();
+ ++i, ++count)
+ VERIFY(*i == 0);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0202.size() == LIST_SIZE);
+
+ // explicit value
+ list_type list0203(LIST_SIZE, INIT_VALUE);
+ for (i = list0203.begin(), count = 0;
+ i != list0203.end();
+ ++i, ++count)
+ VERIFY(*i == INIT_VALUE);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0203.size() == LIST_SIZE);
+}
+
+template<typename _Tp>
+void
+cons022()
+{
+ // nontrivial value_type
+ typedef _Tp list_type;
+ const std::size_t LIST_SIZE = 5;
+ list_type list0201(LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/3.cc b/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
index b067ee17bc2..f373cc05d8a 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
@@ -15,38 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "3.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// A nontrivial type convertible from an int
-struct C
-{
- C(int i) : i_(i) { }
- bool operator==(const C& rhs) { return i_ == rhs.i_; }
- int i_;
-};
-
-// Fill constructor disguised as a range constructor
-template<typename _Tp>
-void
-cons03()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
-
- const std::size_t LIST_SIZE = 5;
- const int INIT_VALUE = 7;
- std::size_t count = 0;
- list_type list0204(LIST_SIZE, INIT_VALUE);
- iterator i = list0204.begin();
- for (; i != list0204.end(); ++i, ++count)
- VERIFY(*i == INIT_VALUE);
- VERIFY(count == LIST_SIZE);
- VERIFY(list0204.size() == LIST_SIZE);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/3.h b/libstdc++-v3/testsuite/23_containers/list/cons/3.h
new file mode 100644
index 00000000000..983c24ca8ae
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/3.h
@@ -0,0 +1,48 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type convertible from an int
+struct C
+{
+ C(int i) : i_(i) { }
+ bool operator==(const C& rhs) { return i_ == rhs.i_; }
+ int i_;
+};
+
+// Fill constructor disguised as a range constructor
+template<typename _Tp>
+void
+cons03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const std::size_t LIST_SIZE = 5;
+ const int INIT_VALUE = 7;
+ std::size_t count = 0;
+ list_type list0204(LIST_SIZE, INIT_VALUE);
+ iterator i = list0204.begin();
+ for (; i != list0204.end(); ++i, ++count)
+ VERIFY(*i == INIT_VALUE);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0204.size() == LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/4.cc b/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
index 0dde9e9eaf4..d6b58be0481 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
@@ -15,51 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "4.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// Range constructor
-//
-// This test verifies the following.
-// 23.2.2.1 template list(InputIterator f, InputIterator l,
-// const Allocator& a = Allocator())
-// 23.2.2 const_iterator begin() const
-// 23.2.2 const_iterator end() const
-// 23.2.2 size_type size() const
-//
-template<typename _Tp>
-void
-cons04()
-{
- bool test __attribute__((unused)) = true;
- const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
- const std::size_t N = sizeof(A) / sizeof(int);
- std::size_t count;
-
- typedef std::list<int> list_type;
- typedef typename list_type::const_iterator const_iterator;
- const_iterator i;
-
- // construct from a dissimilar range
- list_type list0301(A, A + N);
- for (i = list0301.begin(), count = 0;
- i != list0301.end();
- ++i, ++count)
- VERIFY(*i == A[count]);
- VERIFY(count == N);
- VERIFY(list0301.size() == N);
-
- // construct from a similar range
- list_type list0302(list0301.begin(), list0301.end());
- for (i = list0302.begin(), count = 0;
- i != list0302.end();
- ++i, ++count)
- VERIFY(*i == A[count]);
- VERIFY(count == N);
- VERIFY(list0302.size() == N);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/4.h b/libstdc++-v3/testsuite/23_containers/list/cons/4.h
new file mode 100644
index 00000000000..bf2e51c138d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/4.h
@@ -0,0 +1,61 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Range constructor
+//
+// This test verifies the following.
+// 23.2.2.1 template list(InputIterator f, InputIterator l,
+// const Allocator& a = Allocator())
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons04()
+{
+ bool test __attribute__((unused)) = true;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ // construct from a dissimilar range
+ list_type list0301(A, A + N);
+ for (i = list0301.begin(), count = 0;
+ i != list0301.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0301.size() == N);
+
+ // construct from a similar range
+ list_type list0302(list0301.begin(), list0301.end());
+ for (i = list0302.begin(), count = 0;
+ i != list0302.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0302.size() == N);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/5.cc b/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
index be8b5921aeb..de86dccd696 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
@@ -15,41 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "5.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// Copy constructor
-//
-// This test verifies the following.
-// 23.2.2.1 list(const list& x)
-// 23.2.2 reverse_iterator rbegin()
-// 23.2.2 reverse_iterator rend()
-// 23.2.2 size_type size() const
-//
-template<typename _Tp>
-void
-cons05()
-{
- bool test __attribute__((unused)) = true;
- const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
- const std::size_t N = sizeof(A) / sizeof(int);
- int count;
-
- typedef _Tp list_type;
- typedef typename list_type::reverse_iterator reverse_iterator;
- reverse_iterator i;
- list_type list0401(A, A + N);
-
- list_type list0402(list0401);
- for (i = list0401.rbegin(), count = N - 1;
- i != list0401.rend();
- ++i, --count)
- VERIFY(*i == A[count]);
- VERIFY(count == -1);
- VERIFY(list0401.size() == N);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/5.h b/libstdc++-v3/testsuite/23_containers/list/cons/5.h
new file mode 100644
index 00000000000..5c273a322e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/5.h
@@ -0,0 +1,51 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Copy constructor
+//
+// This test verifies the following.
+// 23.2.2.1 list(const list& x)
+// 23.2.2 reverse_iterator rbegin()
+// 23.2.2 reverse_iterator rend()
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons05()
+{
+ bool test __attribute__((unused)) = true;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ int count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::reverse_iterator reverse_iterator;
+ reverse_iterator i;
+ list_type list0401(A, A + N);
+
+ list_type list0402(list0401);
+ for (i = list0401.rbegin(), count = N - 1;
+ i != list0401.rend();
+ ++i, --count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == -1);
+ VERIFY(list0401.size() == N);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/6.cc b/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
index c2ecc59de25..c1a2baedca2 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
@@ -15,54 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "6.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// Range assign
-//
-// This test verifies the following.
-// 23.2.2.1 void assign(InputIterator f, InputIterator l)
-// 23.2.2 const_iterator begin() const
-// 23.2.2 const_iterator end() const
-// 23.2.2 size_type size() const
-//
-template<typename _Tp>
-void
-cons06()
-{
- bool test __attribute__((unused)) = true;
- const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
- const int B[] = {101, 102, 103, 104, 105};
- const std::size_t N = sizeof(A) / sizeof(int);
- const std::size_t M = sizeof(B) / sizeof(int);
- std::size_t count;
-
- typedef _Tp list_type;
- typedef typename list_type::const_iterator const_iterator;
- const_iterator i;
-
- list_type list0501;
-
- // make it bigger
- list0501.assign(A, A + N);
- for (i = list0501.begin(), count = 0;
- i != list0501.end();
- ++i, ++count)
- VERIFY(*i == A[count]);
- VERIFY(count == N);
- VERIFY(list0501.size() == N);
-
- // make it smaller
- list0501.assign(B, B + M);
- for (i = list0501.begin(), count = 0;
- i != list0501.end();
- ++i, ++count)
- VERIFY(*i == B[count]);
- VERIFY(count == M);
- VERIFY(list0501.size() == M);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/6.h b/libstdc++-v3/testsuite/23_containers/list/cons/6.h
new file mode 100644
index 00000000000..b247e5563cb
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/6.h
@@ -0,0 +1,64 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Range assign
+//
+// This test verifies the following.
+// 23.2.2.1 void assign(InputIterator f, InputIterator l)
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons06()
+{
+ bool test __attribute__((unused)) = true;
+ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
+ const int B[] = {101, 102, 103, 104, 105};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ const std::size_t M = sizeof(B) / sizeof(int);
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ list_type list0501;
+
+ // make it bigger
+ list0501.assign(A, A + N);
+ for (i = list0501.begin(), count = 0;
+ i != list0501.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0501.size() == N);
+
+ // make it smaller
+ list0501.assign(B, B + M);
+ for (i = list0501.begin(), count = 0;
+ i != list0501.end();
+ ++i, ++count)
+ VERIFY(*i == B[count]);
+ VERIFY(count == M);
+ VERIFY(list0501.size() == M);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/7.cc b/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
index 9a626a6234f..0f3de3c6763 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
@@ -15,55 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "7.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// Fill assign
-//
-// This test verifies the following.
-// 23.2.2.1 void assign(size_type n, const T& v)
-// 23.2.2 const_iterator begin() const
-// 23.2.2 const_iterator end() const
-// 23.2.2 size_type size() const
-//
-template<typename _Tp>
-void
-cons07()
-{
- bool test __attribute__((unused)) = true;
- const std::size_t BIG_LIST_SIZE = 11;
- const int BIG_INIT_VALUE = 7;
- const std::size_t SMALL_LIST_SIZE = 5;
- const int SMALL_INIT_VALUE = 17;
- std::size_t count;
-
- typedef _Tp list_type;
- typedef typename list_type::const_iterator const_iterator;
- const_iterator i;
-
- list_type list0601;
- VERIFY(list0601.size() == 0);
-
- // make it bigger
- list0601.assign(BIG_LIST_SIZE, BIG_INIT_VALUE);
- for (i = list0601.begin(), count = 0;
- i != list0601.end();
- ++i, ++count)
- VERIFY(*i == BIG_INIT_VALUE);
- VERIFY(count == BIG_LIST_SIZE);
- VERIFY(list0601.size() == BIG_LIST_SIZE);
-
- // make it shrink
- list0601.assign(SMALL_LIST_SIZE, SMALL_INIT_VALUE);
- for (i = list0601.begin(), count = 0;
- i != list0601.end();
- ++i, ++count)
- VERIFY(*i == SMALL_INIT_VALUE);
- VERIFY(count == SMALL_LIST_SIZE);
- VERIFY(list0601.size() == SMALL_LIST_SIZE);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/7.h b/libstdc++-v3/testsuite/23_containers/list/cons/7.h
new file mode 100644
index 00000000000..1ebd7a5cfaa
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/7.h
@@ -0,0 +1,65 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Fill assign
+//
+// This test verifies the following.
+// 23.2.2.1 void assign(size_type n, const T& v)
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
+//
+template<typename _Tp>
+void
+cons07()
+{
+ bool test __attribute__((unused)) = true;
+ const std::size_t BIG_LIST_SIZE = 11;
+ const int BIG_INIT_VALUE = 7;
+ const std::size_t SMALL_LIST_SIZE = 5;
+ const int SMALL_INIT_VALUE = 17;
+ std::size_t count;
+
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ list_type list0601;
+ VERIFY(list0601.size() == 0);
+
+ // make it bigger
+ list0601.assign(BIG_LIST_SIZE, BIG_INIT_VALUE);
+ for (i = list0601.begin(), count = 0;
+ i != list0601.end();
+ ++i, ++count)
+ VERIFY(*i == BIG_INIT_VALUE);
+ VERIFY(count == BIG_LIST_SIZE);
+ VERIFY(list0601.size() == BIG_LIST_SIZE);
+
+ // make it shrink
+ list0601.assign(SMALL_LIST_SIZE, SMALL_INIT_VALUE);
+ for (i = list0601.begin(), count = 0;
+ i != list0601.end();
+ ++i, ++count)
+ VERIFY(*i == SMALL_INIT_VALUE);
+ VERIFY(count == SMALL_LIST_SIZE);
+ VERIFY(list0601.size() == SMALL_LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/8.cc b/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
index f93520c5406..16d888b4472 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
@@ -15,41 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "8.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// A nontrivial type convertible from an int
-struct C
-{
- C(int i) : i_(i) { }
- bool operator==(const C& rhs) { return i_ == rhs.i_; }
- int i_;
-};
-
-// Fill Assignment disguised as a Range Assignment
-template<typename _Tp>
-void
-cons08()
-{
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
- bool test __attribute__((unused)) = true;
- const std::size_t LIST_SIZE = 5;
- const int INIT_VALUE = 7;
- std::size_t count = 0;
-
- list_type list0604;
- VERIFY(list0604.size() == 0);
-
- list0604.assign(LIST_SIZE, INIT_VALUE);
- iterator i = list0604.begin();
- for (; i != list0604.end(); ++i, ++count)
- VERIFY(*i == INIT_VALUE);
- VERIFY(count == LIST_SIZE);
- VERIFY(list0604.size() == LIST_SIZE);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/8.h b/libstdc++-v3/testsuite/23_containers/list/cons/8.h
new file mode 100644
index 00000000000..4aed16b81d9
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/8.h
@@ -0,0 +1,51 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// A nontrivial type convertible from an int
+struct C
+{
+ C(int i) : i_(i) { }
+ bool operator==(const C& rhs) { return i_ == rhs.i_; }
+ int i_;
+};
+
+// Fill Assignment disguised as a Range Assignment
+template<typename _Tp>
+void
+cons08()
+{
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ bool test __attribute__((unused)) = true;
+ const std::size_t LIST_SIZE = 5;
+ const int INIT_VALUE = 7;
+ std::size_t count = 0;
+
+ list_type list0604;
+ VERIFY(list0604.size() == 0);
+
+ list0604.assign(LIST_SIZE, INIT_VALUE);
+ iterator i = list0604.begin();
+ for (; i != list0604.end(); ++i, ++count)
+ VERIFY(*i == INIT_VALUE);
+ VERIFY(count == LIST_SIZE);
+ VERIFY(list0604.size() == LIST_SIZE);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/9.cc b/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
index 87cb0270c40..908454453a2 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
@@ -15,49 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.1 list constructors, copy, and assignment
-
+#include "9.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// Assignment operator
-//
-// This test verifies the following.
-// 23.2.2 operator=(const list& x)
-// 23.2.2 iterator begin()
-// 23.2.2 iterator end()
-// 23.2.2 size_type size() const
-// 23.2.2 bool operator==(const list& x, const list& y)
-//
-template<typename _Tp>
-void
-cons09()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
-
- const int A[] = {701, 702, 703, 704, 705};
- const std::size_t N = sizeof(A) / sizeof(int);
- std::size_t count;
-
- iterator i;
-
- list_type list0701(A, A + N);
- VERIFY(list0701.size() == N);
-
- list_type list0702;
- VERIFY(list0702.size() == 0);
-
- list0702 = list0701;
- VERIFY(list0702.size() == N);
- for (i = list0702.begin(), count = 0;
- i != list0702.end();
- ++i, ++count)
- VERIFY(*i == A[count]);
- VERIFY(count == N);
- VERIFY(list0702 == list0701);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/9.h b/libstdc++-v3/testsuite/23_containers/list/cons/9.h
new file mode 100644
index 00000000000..90c3fd0540e
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/9.h
@@ -0,0 +1,59 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.1 list constructors, copy, and assignment
+
+#include <testsuite_hooks.h>
+
+// Assignment operator
+//
+// This test verifies the following.
+// 23.2.2 operator=(const list& x)
+// 23.2.2 iterator begin()
+// 23.2.2 iterator end()
+// 23.2.2 size_type size() const
+// 23.2.2 bool operator==(const list& x, const list& y)
+//
+template<typename _Tp>
+void
+cons09()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int A[] = {701, 702, 703, 704, 705};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ std::size_t count;
+
+ iterator i;
+
+ list_type list0701(A, A + N);
+ VERIFY(list0701.size() == N);
+
+ list_type list0702;
+ VERIFY(list0702.size() == 0);
+
+ list0702 = list0701;
+ VERIFY(list0702.size() == N);
+ for (i = list0702.begin(), count = 0;
+ i != list0702.end();
+ ++i, ++count)
+ VERIFY(*i == A[count]);
+ VERIFY(count == N);
+ VERIFY(list0702 == list0701);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
index 82a47ade754..cb186d321cb 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
@@ -15,69 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#include "clear_allocator.h"
#include <list>
-#include <ext/new_allocator.h>
-
-using namespace std;
-using __gnu_cxx::new_allocator;
-
-template<typename T>
- class clear_alloc : public new_allocator<T>
- {
- public:
-
- template <typename T1>
- struct rebind
- { typedef clear_alloc<T1> other; };
-
- virtual void clear() throw()
- { }
-
- clear_alloc() throw()
- { }
-
- clear_alloc(clear_alloc const&) throw() : new_allocator<T>()
- { }
-
- template<typename T1>
- clear_alloc(clear_alloc<T1> const&) throw()
- { }
-
- virtual ~clear_alloc() throw()
- { this->clear(); }
-
- T* allocate(typename new_allocator<T>::size_type n, const void *hint = 0)
- {
- this->clear();
- return new_allocator<T>::allocate(n, hint);
- }
-
- void deallocate(T *ptr, typename new_allocator<T>::size_type n)
- {
- this->clear();
- new_allocator<T>::deallocate(ptr, n);
- }
- };
-
-template<typename Container>
- void Check_Container()
- {
- Container* pic = new Container;
- int x = 230;
-
- while (x--)
- {
- pic->push_back(x);
- }
-
- pic->get_allocator();
-
- // The following has led to infinite recursions or cores.
- pic->clear();
-
- delete pic;
- }
-
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h
new file mode 100644
index 00000000000..3a53751c962
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.h
@@ -0,0 +1,78 @@
+// Copyright (C) 2004, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <ext/new_allocator.h>
+
+using namespace std;
+using __gnu_cxx::new_allocator;
+
+template<typename T>
+ class clear_alloc : public new_allocator<T>
+ {
+ public:
+
+ template <typename T1>
+ struct rebind
+ { typedef clear_alloc<T1> other; };
+
+ virtual void clear() throw()
+ { }
+
+ clear_alloc() throw()
+ { }
+
+ clear_alloc(clear_alloc const&) throw() : new_allocator<T>()
+ { }
+
+ template<typename T1>
+ clear_alloc(clear_alloc<T1> const&) throw()
+ { }
+
+ virtual ~clear_alloc() throw()
+ { this->clear(); }
+
+ T* allocate(typename new_allocator<T>::size_type n, const void *hint = 0)
+ {
+ this->clear();
+ return new_allocator<T>::allocate(n, hint);
+ }
+
+ void deallocate(T *ptr, typename new_allocator<T>::size_type n)
+ {
+ this->clear();
+ new_allocator<T>::deallocate(ptr, n);
+ }
+ };
+
+template<typename Container>
+ void Check_Container()
+ {
+ Container* pic = new Container;
+ int x = 230;
+
+ while (x--)
+ {
+ pic->push_back(x);
+ }
+
+ pic->get_allocator();
+
+ // The following has led to infinite recursions or cores.
+ pic->clear();
+
+ delete pic;
+ }
diff --git a/libstdc++-v3/testsuite/23_containers/list/init-list.cc b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
index 261ef084f09..db6bc3b6937 100644
--- a/libstdc++-v3/testsuite/23_containers/list/init-list.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
@@ -1,3 +1,5 @@
+// { dg-options "-std=gnu++0x" }
+
// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -16,56 +18,8 @@
// <http://www.gnu.org/licenses/>.
//
-// { dg-options "-std=gnu++0x" }
-
+#include "init-list.h"
#include <list>
-#include <testsuite_allocator.h>
-
-template<typename _Tp>
-bool
-init_list()
-{
- using namespace __gnu_test;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
-
- const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
- bool ok = true;
-
- tracker_allocator_counter::reset();
- {
- list_type c({ 2, 4, 1 });
- ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
- iterator i = c.begin();
- ok &= (*i++ == 2);
- ok &= (*i++ == 4);
- }
- ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
-
- {
- list_type c(arr10, arr10 + 10);
- tracker_allocator_counter::reset();
- iterator i = c.begin();
- ++i; ++i; ++i; ++i; ++i; ++i; ++i;
- c.insert(i, { 234, 42, 1 });
- ok = check_construct_destroy("Insert init-list", 3, 0) && ok;
- ok &= (*--i == 1);
- ok &= (*--i == 42);
- }
- ok = check_construct_destroy("Insert init-list", 3, 13) && ok;
-
- {
- list_type c;
- tracker_allocator_counter::reset();
- c = { 13, 0, 42 };
- ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
- iterator i = c.begin();
- ok &= (*i++ == 13);
- }
- ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
-
- return ok ? 0 : 1;
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/init-list.h b/libstdc++-v3/testsuite/23_containers/list/init-list.h
new file mode 100644
index 00000000000..a391ffdad67
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/init-list.h
@@ -0,0 +1,65 @@
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+//
+
+#include <testsuite_allocator.h>
+
+template<typename _Tp>
+bool
+init_list()
+{
+ using namespace __gnu_test;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
+ bool ok = true;
+
+ tracker_allocator_counter::reset();
+ {
+ list_type c({ 2, 4, 1 });
+ ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
+ iterator i = c.begin();
+ ok &= (*i++ == 2);
+ ok &= (*i++ == 4);
+ }
+ ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
+
+ {
+ list_type c(arr10, arr10 + 10);
+ tracker_allocator_counter::reset();
+ iterator i = c.begin();
+ ++i; ++i; ++i; ++i; ++i; ++i; ++i;
+ c.insert(i, { 234, 42, 1 });
+ ok = check_construct_destroy("Insert init-list", 3, 0) && ok;
+ ok &= (*--i == 1);
+ ok &= (*--i == 42);
+ }
+ ok = check_construct_destroy("Insert init-list", 3, 13) && ok;
+
+ {
+ list_type c;
+ tracker_allocator_counter::reset();
+ c = { 13, 0, 42 };
+ ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
+ iterator i = c.begin();
+ ok &= (*i++ == 13);
+ }
+ ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
+
+ return ok ? 0 : 1;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
index b1c85f0511c..cf8c20a6578 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
@@ -15,103 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.3 list modifiers [lib.list.modifiers]
-
+#include "1.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// range and fill insert/erase + clear
-// missing: o fill insert disguised as a range insert in all its variants
-// o exception effects
-template<typename _Tp>
-void
-modifiers1()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
- typedef typename list_type::value_type value_type;
-
- list_type list0301;
- value_type::reset();
-
- // fill insert at beginning of list / empty list
- list0301.insert(list0301.begin(), 3, value_type(11)); // should be [11 11 11]
- VERIFY(list0301.size() == 3);
- VERIFY(value_type::copyCount() == 3);
-
- // save iterators to verify post-insert validity
- iterator b = list0301.begin();
- iterator m = list0301.end(); --m;
- iterator e = list0301.end();
-
- // fill insert at end of list
- value_type::reset();
- list0301.insert(list0301.end(), 3, value_type(13)); // should be [11 11 11 13 13 13]
- VERIFY(list0301.size() == 6);
- VERIFY(value_type::copyCount() == 3);
- VERIFY(b == list0301.begin() && b->id() == 11);
- VERIFY(e == list0301.end());
- VERIFY(m->id() == 11);
-
- // fill insert in the middle of list
- ++m;
- value_type::reset();
- list0301.insert(m, 3, value_type(12)); // should be [11 11 11 12 12 12 13 13 13]
- VERIFY(list0301.size() == 9);
- VERIFY(value_type::copyCount() == 3);
- VERIFY(b == list0301.begin() && b->id() == 11);
- VERIFY(e == list0301.end());
- VERIFY(m->id() == 13);
-
- // single erase
- value_type::reset();
- m = list0301.erase(m); // should be [11 11 11 12 12 12 13 13]
- VERIFY(list0301.size() == 8);
- VERIFY(value_type::dtorCount() == 1);
- VERIFY(b == list0301.begin() && b->id() == 11);
- VERIFY(e == list0301.end());
- VERIFY(m->id() == 13);
-
- // range erase
- value_type::reset();
- m = list0301.erase(list0301.begin(), m); // should be [13 13]
- VERIFY(list0301.size() == 2);
- VERIFY(value_type::dtorCount() == 6);
- VERIFY(m->id() == 13);
-
- // range fill at beginning
- const int A[] = {321, 322, 333};
- const int N = sizeof(A) / sizeof(int);
- value_type::reset();
- b = list0301.begin();
- list0301.insert(b, A, A + N); // should be [321 322 333 13 13]
- VERIFY(list0301.size() == 5);
- VERIFY(value_type::copyCount() == 3);
- VERIFY(m->id() == 13);
-
- // range fill at end
- value_type::reset();
- list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333]
- VERIFY(list0301.size() == 8);
- VERIFY(value_type::copyCount() == 3);
- VERIFY(e == list0301.end());
- VERIFY(m->id() == 13);
-
- // range fill in middle
- value_type::reset();
- list0301.insert(m, A, A + N);
- VERIFY(list0301.size() == 11);
- VERIFY(value_type::copyCount() == 3);
- VERIFY(e == list0301.end());
- VERIFY(m->id() == 13);
-
- value_type::reset();
- list0301.clear();
- VERIFY(list0301.size() == 0);
- VERIFY(value_type::dtorCount() == 11);
- VERIFY(e == list0301.end());
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h
new file mode 100644
index 00000000000..f26fd885485
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h
@@ -0,0 +1,113 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+
+// range and fill insert/erase + clear
+// missing: o fill insert disguised as a range insert in all its variants
+// o exception effects
+template<typename _Tp>
+void
+modifiers1()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::value_type value_type;
+
+ list_type list0301;
+ value_type::reset();
+
+ // fill insert at beginning of list / empty list
+ list0301.insert(list0301.begin(), 3, value_type(11)); // should be [11 11 11]
+ VERIFY(list0301.size() == 3);
+ VERIFY(value_type::copyCount() == 3);
+
+ // save iterators to verify post-insert validity
+ iterator b = list0301.begin();
+ iterator m = list0301.end(); --m;
+ iterator e = list0301.end();
+
+ // fill insert at end of list
+ value_type::reset();
+ list0301.insert(list0301.end(), 3, value_type(13)); // should be [11 11 11 13 13 13]
+ VERIFY(list0301.size() == 6);
+ VERIFY(value_type::copyCount() == 3);
+ VERIFY(b == list0301.begin() && b->id() == 11);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 11);
+
+ // fill insert in the middle of list
+ ++m;
+ value_type::reset();
+ list0301.insert(m, 3, value_type(12)); // should be [11 11 11 12 12 12 13 13 13]
+ VERIFY(list0301.size() == 9);
+ VERIFY(value_type::copyCount() == 3);
+ VERIFY(b == list0301.begin() && b->id() == 11);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ // single erase
+ value_type::reset();
+ m = list0301.erase(m); // should be [11 11 11 12 12 12 13 13]
+ VERIFY(list0301.size() == 8);
+ VERIFY(value_type::dtorCount() == 1);
+ VERIFY(b == list0301.begin() && b->id() == 11);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ // range erase
+ value_type::reset();
+ m = list0301.erase(list0301.begin(), m); // should be [13 13]
+ VERIFY(list0301.size() == 2);
+ VERIFY(value_type::dtorCount() == 6);
+ VERIFY(m->id() == 13);
+
+ // range fill at beginning
+ const int A[] = {321, 322, 333};
+ const int N = sizeof(A) / sizeof(int);
+ value_type::reset();
+ b = list0301.begin();
+ list0301.insert(b, A, A + N); // should be [321 322 333 13 13]
+ VERIFY(list0301.size() == 5);
+ VERIFY(value_type::copyCount() == 3);
+ VERIFY(m->id() == 13);
+
+ // range fill at end
+ value_type::reset();
+ list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333]
+ VERIFY(list0301.size() == 8);
+ VERIFY(value_type::copyCount() == 3);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ // range fill in middle
+ value_type::reset();
+ list0301.insert(m, A, A + N);
+ VERIFY(list0301.size() == 11);
+ VERIFY(value_type::copyCount() == 3);
+ VERIFY(e == list0301.end());
+ VERIFY(m->id() == 13);
+
+ value_type::reset();
+ list0301.clear();
+ VERIFY(list0301.size() == 0);
+ VERIFY(value_type::dtorCount() == 11);
+ VERIFY(e == list0301.end());
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
index da39397d098..ee9b54923df 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
@@ -15,76 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.3 list modifiers [lib.list.modifiers]
-
+#include "2.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// general single insert/erase + swap
-template<typename _Tp>
-void
-modifiers2()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::value_type value_type;
- typedef typename list_type::iterator iterator;
- typedef typename list_type::const_iterator const_iterator;
-
- list_type list0201;
- value_type::reset();
-
- list0201.insert(list0201.begin(), value_type(1)); // list should be [1]
- VERIFY(list0201.size() == 1);
- VERIFY(value_type::copyCount() == 1);
-
- list0201.insert(list0201.end(), value_type(2)); // list should be [1 2]
- VERIFY(list0201.size() == 2);
- VERIFY(value_type::copyCount() == 2);
-
- iterator i = list0201.begin();
- const_iterator j = i;
- VERIFY(i->id() == 1); ++i;
- VERIFY(i->id() == 2);
-
- list0201.insert(i, value_type(3)); // list should be [1 3 2]
- VERIFY(list0201.size() == 3);
- VERIFY(value_type::copyCount() == 3);
-
- const_iterator k = i;
- VERIFY(i->id() == 2); --i;
- VERIFY(i->id() == 3); --i;
- VERIFY(i->id() == 1);
- VERIFY(j->id() == 1);
-
- ++i; // will point to '3'
- value_type::reset();
- list0201.erase(i); // should be [1 2]
- VERIFY(list0201.size() == 2);
- VERIFY(value_type::dtorCount() == 1);
- VERIFY(k->id() == 2);
- VERIFY(j->id() == 1);
-
- list_type list0202;
- value_type::reset();
- VERIFY(list0202.size() == 0);
- VERIFY(value_type::copyCount() == 0);
- VERIFY(value_type::dtorCount() == 0);
-
- // member swap
- list0202.swap(list0201);
- VERIFY(list0201.size() == 0);
- VERIFY(list0202.size() == 2);
- VERIFY(value_type::copyCount() == 0);
- VERIFY(value_type::dtorCount() == 0);
-
- // specialized swap
- swap(list0201, list0202);
- VERIFY(list0201.size() == 2);
- VERIFY(list0202.size() == 0);
- VERIFY(value_type::copyCount() == 0);
- VERIFY(value_type::dtorCount() == 0);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h
new file mode 100644
index 00000000000..64a348769e2
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.h
@@ -0,0 +1,86 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+
+// general single insert/erase + swap
+template<typename _Tp>
+void
+modifiers2()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::const_iterator const_iterator;
+
+ list_type list0201;
+ value_type::reset();
+
+ list0201.insert(list0201.begin(), value_type(1)); // list should be [1]
+ VERIFY(list0201.size() == 1);
+ VERIFY(value_type::copyCount() == 1);
+
+ list0201.insert(list0201.end(), value_type(2)); // list should be [1 2]
+ VERIFY(list0201.size() == 2);
+ VERIFY(value_type::copyCount() == 2);
+
+ iterator i = list0201.begin();
+ const_iterator j = i;
+ VERIFY(i->id() == 1); ++i;
+ VERIFY(i->id() == 2);
+
+ list0201.insert(i, value_type(3)); // list should be [1 3 2]
+ VERIFY(list0201.size() == 3);
+ VERIFY(value_type::copyCount() == 3);
+
+ const_iterator k = i;
+ VERIFY(i->id() == 2); --i;
+ VERIFY(i->id() == 3); --i;
+ VERIFY(i->id() == 1);
+ VERIFY(j->id() == 1);
+
+ ++i; // will point to '3'
+ value_type::reset();
+ list0201.erase(i); // should be [1 2]
+ VERIFY(list0201.size() == 2);
+ VERIFY(value_type::dtorCount() == 1);
+ VERIFY(k->id() == 2);
+ VERIFY(j->id() == 1);
+
+ list_type list0202;
+ value_type::reset();
+ VERIFY(list0202.size() == 0);
+ VERIFY(value_type::copyCount() == 0);
+ VERIFY(value_type::dtorCount() == 0);
+
+ // member swap
+ list0202.swap(list0201);
+ VERIFY(list0201.size() == 0);
+ VERIFY(list0202.size() == 2);
+ VERIFY(value_type::copyCount() == 0);
+ VERIFY(value_type::dtorCount() == 0);
+
+ // specialized swap
+ swap(list0201, list0202);
+ VERIFY(list0201.size() == 2);
+ VERIFY(list0202.size() == 0);
+ VERIFY(value_type::copyCount() == 0);
+ VERIFY(value_type::dtorCount() == 0);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
index b6a41e3dc45..8454c3f46fa 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
@@ -15,108 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.3 list modifiers [lib.list.modifiers]
-
+#include "3.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// This test verifies the following.
-//
-// 23.2.2.3 void push_front(const T& x)
-// 23.2.2.3 void push_back(const T& x)
-// 23.2.2.3 (1) iterator and reference non-invalidation
-// 23.2.2.3 (1) exception effects
-// 23.2.2.3 (2) complexity requirements
-//
-// 23.2.2.3 void pop_front()
-// 23.2.2.3 void pop_back()
-// 23.2.2.3 (3) iterator and reference non-invalidation
-// 23.2.2.3 (5) complexity requirements
-//
-// 23.2.2 const_iterator begin() const
-// 23.2.2 iterator end()
-// 23.2.2 const_reverse_iterator rbegin() const
-// 23.2.2 _reference front()
-// 23.2.2 const_reference front() const
-// 23.2.2 reference back()
-// 23.2.2 const_reference back() const
-//
-template<typename _Tp>
-void
-modifiers3()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
- typedef typename list_type::value_type value_type;
- typedef typename list_type::const_iterator const_iterator;
- typedef typename list_type::const_reverse_iterator const_reverse_iterator;
-
- list_type list0101;
- const_iterator i;
- const_reverse_iterator j;
- iterator k;
- value_type::reset();
-
- list0101.push_back(value_type(1)); // list should be [1]
- VERIFY(list0101.size() == 1);
- VERIFY(value_type::copyCount() == 1);
-
- k = list0101.end();
- --k;
- VERIFY(k->id() == 1);
- VERIFY(k->id() == list0101.front().id());
- VERIFY(k->id() == list0101.back().id());
-
- list0101.push_front(value_type(2)); // list should be [2 1]
- VERIFY(list0101.size() == 2);
- VERIFY(value_type::copyCount() == 2);
- VERIFY(k->id() == 1);
-
- list0101.push_back(value_type(3)); // list should be [2 1 3]
- VERIFY(list0101.size() == 3);
- VERIFY(value_type::copyCount() == 3);
- VERIFY(k->id() == 1);
-
- try
- {
- list0101.push_back(value_type(4, true));
- VERIFY(false);
- }
- catch (...)
- {
- VERIFY(list0101.size() == 3);
- VERIFY(value_type::copyCount() == 4);
- }
-
- i = list0101.begin();
- VERIFY(i->id() == 2);
- VERIFY(i->id() == list0101.front().id());
-
- j = list0101.rbegin();
- VERIFY(j->id() == 3);
- VERIFY(j->id() == list0101.back().id());
-
- ++i;
- VERIFY(i->id() == 1);
-
- ++j;
- VERIFY(j->id() == 1);
-
- value_type::reset();
-
- list0101.pop_back(); // list should be [2 1]
- VERIFY(list0101.size() == 2);
- VERIFY(value_type::dtorCount() == 1);
- VERIFY(i->id() == 1);
- VERIFY(k->id() == 1);
-
- list0101.pop_front(); // list should be [1]
- VERIFY(list0101.size() == 1);
- VERIFY(value_type::dtorCount() == 2);
- VERIFY(i->id() == 1);
- VERIFY(k->id() == 1);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h
new file mode 100644
index 00000000000..43e5c58ec60
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.h
@@ -0,0 +1,118 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+
+// This test verifies the following.
+//
+// 23.2.2.3 void push_front(const T& x)
+// 23.2.2.3 void push_back(const T& x)
+// 23.2.2.3 (1) iterator and reference non-invalidation
+// 23.2.2.3 (1) exception effects
+// 23.2.2.3 (2) complexity requirements
+//
+// 23.2.2.3 void pop_front()
+// 23.2.2.3 void pop_back()
+// 23.2.2.3 (3) iterator and reference non-invalidation
+// 23.2.2.3 (5) complexity requirements
+//
+// 23.2.2 const_iterator begin() const
+// 23.2.2 iterator end()
+// 23.2.2 const_reverse_iterator rbegin() const
+// 23.2.2 _reference front()
+// 23.2.2 const_reference front() const
+// 23.2.2 reference back()
+// 23.2.2 const_reference back() const
+//
+template<typename _Tp>
+void
+modifiers3()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::const_iterator const_iterator;
+ typedef typename list_type::const_reverse_iterator const_reverse_iterator;
+
+ list_type list0101;
+ const_iterator i;
+ const_reverse_iterator j;
+ iterator k;
+ value_type::reset();
+
+ list0101.push_back(value_type(1)); // list should be [1]
+ VERIFY(list0101.size() == 1);
+ VERIFY(value_type::copyCount() == 1);
+
+ k = list0101.end();
+ --k;
+ VERIFY(k->id() == 1);
+ VERIFY(k->id() == list0101.front().id());
+ VERIFY(k->id() == list0101.back().id());
+
+ list0101.push_front(value_type(2)); // list should be [2 1]
+ VERIFY(list0101.size() == 2);
+ VERIFY(value_type::copyCount() == 2);
+ VERIFY(k->id() == 1);
+
+ list0101.push_back(value_type(3)); // list should be [2 1 3]
+ VERIFY(list0101.size() == 3);
+ VERIFY(value_type::copyCount() == 3);
+ VERIFY(k->id() == 1);
+
+ try
+ {
+ list0101.push_back(value_type(4, true));
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ VERIFY(list0101.size() == 3);
+ VERIFY(value_type::copyCount() == 4);
+ }
+
+ i = list0101.begin();
+ VERIFY(i->id() == 2);
+ VERIFY(i->id() == list0101.front().id());
+
+ j = list0101.rbegin();
+ VERIFY(j->id() == 3);
+ VERIFY(j->id() == list0101.back().id());
+
+ ++i;
+ VERIFY(i->id() == 1);
+
+ ++j;
+ VERIFY(j->id() == 1);
+
+ value_type::reset();
+
+ list0101.pop_back(); // list should be [2 1]
+ VERIFY(list0101.size() == 2);
+ VERIFY(value_type::dtorCount() == 1);
+ VERIFY(i->id() == 1);
+ VERIFY(k->id() == 1);
+
+ list0101.pop_front(); // list should be [1]
+ VERIFY(list0101.size() == 1);
+ VERIFY(value_type::dtorCount() == 2);
+ VERIFY(i->id() == 1);
+ VERIFY(k->id() == 1);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
index e108288586e..e9195ddbc64 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
@@ -1,3 +1,5 @@
+// { dg-require-time "" }
+
// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -15,82 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.3 list modifiers [lib.list.modifiers]
-
-// { dg-require-time "" }
-
+#include "25288.h"
#include <list>
-#include <testsuite_hooks.h>
-#include <ext/throw_allocator.h>
-
-// libstdc++/25288
-template<typename _Tp>
-void insert1()
-{
- bool test __attribute__((unused)) = true;
-
- typedef _Tp list_type;
- typedef typename _Tp::value_type value_type;
- typedef typename _Tp::allocator_type allocator_type;
- typedef typename _Tp::size_type size_type;
-
- for (int j = 0; j < 10; ++j)
- for (int i = 0; i < 10; ++i)
- {
- allocator_type alloc1;
- typename allocator_type::never_adjustor adjust1;
- list_type list1(alloc1);
-
- for (int k = 0; k < j; ++k)
- list1.push_back(value_type(-(k + 1)));
-
- try
- {
- typename allocator_type::always_adjustor adjust2;
- list1.insert(list1.begin(), 10, 99);
- VERIFY( false );
- }
- catch (__gnu_cxx::forced_exception_error&)
- {
- VERIFY( true );
- }
- catch (...)
- {
- __throw_exception_again;
- }
-
- VERIFY( list1.size() == size_type(j) );
- VERIFY( list1.size() == 0 || list1.back() == -j );
- VERIFY( list1.size() == 0 || list1.front() == -1 );
-
- allocator_type alloc2;
- list_type list2(alloc2);
-
- const int data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- for (int k = 0; k < j; ++k)
- list2.push_back(-(k + 1));
-
- try
- {
- typename allocator_type::always_adjustor adjust3;
- list2.insert(list2.begin(), data, data + 10);
- VERIFY( false );
- }
- catch (__gnu_cxx::forced_exception_error&)
- {
- VERIFY( true );
- }
- catch (...)
- {
- VERIFY( false );
- }
-
- VERIFY( list2.size() == size_type(j) );
- VERIFY( list2.size() == 0 || list2.back() == -j );
- VERIFY( list2.size() == 0 || list2.front() == -1 );
- }
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h
new file mode 100644
index 00000000000..c3ec6628f3d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.h
@@ -0,0 +1,90 @@
+// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.3 list modifiers [lib.list.modifiers]
+
+#include <testsuite_hooks.h>
+#include <ext/throw_allocator.h>
+
+// libstdc++/25288
+template<typename _Tp>
+void insert1()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+ typedef typename _Tp::value_type value_type;
+ typedef typename _Tp::allocator_type allocator_type;
+ typedef typename _Tp::size_type size_type;
+
+ for (int j = 0; j < 10; ++j)
+ for (int i = 0; i < 10; ++i)
+ {
+ allocator_type alloc1;
+ typename allocator_type::never_adjustor adjust1;
+ list_type list1(alloc1);
+
+ for (int k = 0; k < j; ++k)
+ list1.push_back(value_type(-(k + 1)));
+
+ try
+ {
+ typename allocator_type::always_adjustor adjust2;
+ list1.insert(list1.begin(), 10, 99);
+ VERIFY( false );
+ }
+ catch (__gnu_cxx::forced_exception_error&)
+ {
+ VERIFY( true );
+ }
+ catch (...)
+ {
+ __throw_exception_again;
+ }
+
+ VERIFY( list1.size() == size_type(j) );
+ VERIFY( list1.size() == 0 || list1.back() == -j );
+ VERIFY( list1.size() == 0 || list1.front() == -1 );
+
+ allocator_type alloc2;
+ list_type list2(alloc2);
+
+ const int data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ for (int k = 0; k < j; ++k)
+ list2.push_back(-(k + 1));
+
+ try
+ {
+ typename allocator_type::always_adjustor adjust3;
+ list2.insert(list2.begin(), data, data + 10);
+ VERIFY( false );
+ }
+ catch (__gnu_cxx::forced_exception_error&)
+ {
+ VERIFY( true );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ VERIFY( list2.size() == size_type(j) );
+ VERIFY( list2.size() == 0 || list2.back() == -j );
+ VERIFY( list2.size() == 0 || list2.front() == -1 );
+ }
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
index c66ead57c76..d9bd9a2194e 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
@@ -15,12 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+#include "1.h"
#include <list>
-#include <testsuite_hooks.h>
-
-struct T { int i; };
-
-int swap_calls;
namespace std
{
@@ -30,41 +26,6 @@ namespace std
{ ++swap_calls; }
}
-// Should use list specialization for swap.
-template<typename _Tp>
-void
-swap11()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
-
- list_type A;
- list_type B;
- swap_calls = 0;
- std::swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-// Should use list specialization for swap.
-template<typename _Tp>
-void
-swap12()
-{
- using namespace std;
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
-
- list_type A;
- list_type B;
- swap_calls = 0;
- swap(A, B);
- VERIFY(1 == swap_calls);
-}
-
-#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
-template class __gnu_cxx::__mt_alloc<std::_List_node<T> >;
-#endif
-
// See c++/13658 for background info.
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h
new file mode 100644
index 00000000000..64619b42470
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.h
@@ -0,0 +1,58 @@
+// Copyright (C) 2004, 2009 Free Software Foundation
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <algorithm>
+#include <testsuite_hooks.h>
+
+struct T { int i; };
+
+int swap_calls;
+
+// Should use list specialization for swap.
+template<typename _Tp>
+void
+swap11()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type A;
+ list_type B;
+ swap_calls = 0;
+ std::swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+// Should use list specialization for swap.
+template<typename _Tp>
+void
+swap12()
+{
+ using namespace std;
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type A;
+ list_type B;
+ swap_calls = 0;
+ swap(A, B);
+ VERIFY(1 == swap_calls);
+}
+
+#if !__GXX_WEAK__ && _MT_ALLOCATOR_H
+template class __gnu_cxx::__mt_alloc<std::_List_node<T> >;
+#endif
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
index e31c0fb5924..7bd75a39e3c 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
@@ -17,115 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.3 list::swap
-
+#include "2.h"
#include <list>
-#include <testsuite_hooks.h>
-#include <testsuite_allocator.h>
-
-// uneq_allocator as a non-empty allocator.
-template<typename _Tp>
-void
-swap2()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
-
- typedef _Tp list_type;
- typedef typename list_type::allocator_type allocator_type;
- typedef typename list_type::size_type size_type;
-
- const char title01[] = "Rivers of sand";
- const char title02[] = "Concret PH";
- const char title03[] = "Sonatas and Interludes for Prepared Piano";
- const char title04[] = "never as tired as when i'm waking up";
-
- const size_t N1 = sizeof(title01);
- const size_t N2 = sizeof(title02);
- const size_t N3 = sizeof(title03);
- const size_t N4 = sizeof(title04);
-
- size_type size01, size02;
-
- allocator_type alloc01(1);
-
- list_type lis01(alloc01);
- size01 = lis01.size();
- list_type lis02(alloc01);
- size02 = lis02.size();
-
- lis01.swap(lis02);
- VERIFY( lis01.size() == size02 );
- VERIFY( lis01.empty() );
- VERIFY( lis02.size() == size01 );
- VERIFY( lis02.empty() );
-
- list_type lis03(alloc01);
- size01 = lis03.size();
- list_type lis04(title02, title02 + N2, alloc01);
- size02 = lis04.size();
-
- lis03.swap(lis04);
- VERIFY( lis03.size() == size02 );
- VERIFY( equal(lis03.begin(), lis03.end(), title02) );
- VERIFY( lis04.size() == size01 );
- VERIFY( lis04.empty() );
-
- list_type lis05(title01, title01 + N1, alloc01);
- size01 = lis05.size();
- list_type lis06(title02, title02 + N2, alloc01);
- size02 = lis06.size();
-
- lis05.swap(lis06);
- VERIFY( lis05.size() == size02 );
- VERIFY( equal(lis05.begin(), lis05.end(), title02) );
- VERIFY( lis06.size() == size01 );
- VERIFY( equal(lis06.begin(), lis06.end(), title01) );
-
- list_type lis07(title01, title01 + N1, alloc01);
- size01 = lis07.size();
- list_type lis08(title03, title03 + N3, alloc01);
- size02 = lis08.size();
-
- lis07.swap(lis08);
- VERIFY( lis07.size() == size02 );
- VERIFY( equal(lis07.begin(), lis07.end(), title03) );
- VERIFY( lis08.size() == size01 );
- VERIFY( equal(lis08.begin(), lis08.end(), title01) );
-
- list_type lis09(title03, title03 + N3, alloc01);
- size01 = lis09.size();
- list_type lis10(title04, title04 + N4, alloc01);
- size02 = lis10.size();
-
- lis09.swap(lis10);
- VERIFY( lis09.size() == size02 );
- VERIFY( equal(lis09.begin(), lis09.end(), title04) );
- VERIFY( lis10.size() == size01 );
- VERIFY( equal(lis10.begin(), lis10.end(), title03) );
-
- list_type lis11(title04, title04 + N4, alloc01);
- size01 = lis11.size();
- list_type lis12(title01, title01 + N1, alloc01);
- size02 = lis12.size();
-
- lis11.swap(lis12);
- VERIFY( lis11.size() == size02 );
- VERIFY( equal(lis11.begin(), lis11.end(), title01) );
- VERIFY( lis12.size() == size01 );
- VERIFY( equal(lis12.begin(), lis12.end(), title04) );
-
- list_type lis13(title03, title03 + N3, alloc01);
- size01 = lis13.size();
- list_type lis14(title03, title03 + N3, alloc01);
- size02 = lis14.size();
-
- lis13.swap(lis14);
- VERIFY( lis13.size() == size02 );
- VERIFY( equal(lis13.begin(), lis13.end(), title03) );
- VERIFY( lis14.size() == size01 );
- VERIFY( equal(lis14.begin(), lis14.end(), title03) );
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h
new file mode 100644
index 00000000000..2cd68f60c7a
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.h
@@ -0,0 +1,127 @@
+// 2005-12-20 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.3 list::swap
+
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator as a non-empty allocator.
+template<typename _Tp>
+void
+swap2()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::size_type size_type;
+
+ const char title01[] = "Rivers of sand";
+ const char title02[] = "Concret PH";
+ const char title03[] = "Sonatas and Interludes for Prepared Piano";
+ const char title04[] = "never as tired as when i'm waking up";
+
+ const size_t N1 = sizeof(title01);
+ const size_t N2 = sizeof(title02);
+ const size_t N3 = sizeof(title03);
+ const size_t N4 = sizeof(title04);
+
+ size_type size01, size02;
+
+ allocator_type alloc01(1);
+
+ list_type lis01(alloc01);
+ size01 = lis01.size();
+ list_type lis02(alloc01);
+ size02 = lis02.size();
+
+ lis01.swap(lis02);
+ VERIFY( lis01.size() == size02 );
+ VERIFY( lis01.empty() );
+ VERIFY( lis02.size() == size01 );
+ VERIFY( lis02.empty() );
+
+ list_type lis03(alloc01);
+ size01 = lis03.size();
+ list_type lis04(title02, title02 + N2, alloc01);
+ size02 = lis04.size();
+
+ lis03.swap(lis04);
+ VERIFY( lis03.size() == size02 );
+ VERIFY( equal(lis03.begin(), lis03.end(), title02) );
+ VERIFY( lis04.size() == size01 );
+ VERIFY( lis04.empty() );
+
+ list_type lis05(title01, title01 + N1, alloc01);
+ size01 = lis05.size();
+ list_type lis06(title02, title02 + N2, alloc01);
+ size02 = lis06.size();
+
+ lis05.swap(lis06);
+ VERIFY( lis05.size() == size02 );
+ VERIFY( equal(lis05.begin(), lis05.end(), title02) );
+ VERIFY( lis06.size() == size01 );
+ VERIFY( equal(lis06.begin(), lis06.end(), title01) );
+
+ list_type lis07(title01, title01 + N1, alloc01);
+ size01 = lis07.size();
+ list_type lis08(title03, title03 + N3, alloc01);
+ size02 = lis08.size();
+
+ lis07.swap(lis08);
+ VERIFY( lis07.size() == size02 );
+ VERIFY( equal(lis07.begin(), lis07.end(), title03) );
+ VERIFY( lis08.size() == size01 );
+ VERIFY( equal(lis08.begin(), lis08.end(), title01) );
+
+ list_type lis09(title03, title03 + N3, alloc01);
+ size01 = lis09.size();
+ list_type lis10(title04, title04 + N4, alloc01);
+ size02 = lis10.size();
+
+ lis09.swap(lis10);
+ VERIFY( lis09.size() == size02 );
+ VERIFY( equal(lis09.begin(), lis09.end(), title04) );
+ VERIFY( lis10.size() == size01 );
+ VERIFY( equal(lis10.begin(), lis10.end(), title03) );
+
+ list_type lis11(title04, title04 + N4, alloc01);
+ size01 = lis11.size();
+ list_type lis12(title01, title01 + N1, alloc01);
+ size02 = lis12.size();
+
+ lis11.swap(lis12);
+ VERIFY( lis11.size() == size02 );
+ VERIFY( equal(lis11.begin(), lis11.end(), title01) );
+ VERIFY( lis12.size() == size01 );
+ VERIFY( equal(lis12.begin(), lis12.end(), title04) );
+
+ list_type lis13(title03, title03 + N3, alloc01);
+ size01 = lis13.size();
+ list_type lis14(title03, title03 + N3, alloc01);
+ size02 = lis14.size();
+
+ lis13.swap(lis14);
+ VERIFY( lis13.size() == size02 );
+ VERIFY( equal(lis13.begin(), lis13.end(), title03) );
+ VERIFY( lis14.size() == size01 );
+ VERIFY( equal(lis14.begin(), lis14.end(), title03) );
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
index c0e0f65bf64..f994e9b4ae1 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
@@ -17,144 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.3 list::swap
-
+#include "3.h"
#include <list>
-#include <testsuite_hooks.h>
-#include <testsuite_allocator.h>
-
-// uneq_allocator, two different personalities.
-template<typename _Tp>
-void
-swap3()
-{
- bool test __attribute__((unused)) = true;
- using namespace std;
-
- typedef _Tp list_type;
- typedef typename list_type::allocator_type allocator_type;
- typedef typename list_type::size_type size_type;
-
- const char title01[] = "Rivers of sand";
- const char title02[] = "Concret PH";
- const char title03[] = "Sonatas and Interludes for Prepared Piano";
- const char title04[] = "never as tired as when i'm waking up";
-
- const size_t N1 = sizeof(title01);
- const size_t N2 = sizeof(title02);
- const size_t N3 = sizeof(title03);
- const size_t N4 = sizeof(title04);
-
- size_type size01, size02;
-
- allocator_type alloc01(1), alloc02(2);
- int personality01, personality02;
-
- list_type lis01(alloc01);
- size01 = lis01.size();
- personality01 = lis01.get_allocator().get_personality();
- list_type lis02(alloc02);
- size02 = lis02.size();
- personality02 = lis02.get_allocator().get_personality();
-
- lis01.swap(lis02);
- VERIFY( lis01.size() == size02 );
- VERIFY( lis01.empty() );
- VERIFY( lis02.size() == size01 );
- VERIFY( lis02.empty() );
- VERIFY( lis01.get_allocator().get_personality() == personality02 );
- VERIFY( lis02.get_allocator().get_personality() == personality01 );
-
- list_type lis03(alloc02);
- size01 = lis03.size();
- personality01 = lis03.get_allocator().get_personality();
- list_type lis04(title02, title02 + N2, alloc01);
- size02 = lis04.size();
- personality02 = lis04.get_allocator().get_personality();
-
- lis03.swap(lis04);
- VERIFY( lis03.size() == size02 );
- VERIFY( equal(lis03.begin(), lis03.end(), title02) );
- VERIFY( lis04.size() == size01 );
- VERIFY( lis04.empty() );
- VERIFY( lis03.get_allocator().get_personality() == personality02 );
- VERIFY( lis04.get_allocator().get_personality() == personality01 );
-
- list_type lis05(title01, title01 + N1, alloc01);
- size01 = lis05.size();
- personality01 = lis05.get_allocator().get_personality();
- list_type lis06(title02, title02 + N2, alloc02);
- size02 = lis06.size();
- personality02 = lis06.get_allocator().get_personality();
-
- lis05.swap(lis06);
- VERIFY( lis05.size() == size02 );
- VERIFY( equal(lis05.begin(), lis05.end(), title02) );
- VERIFY( lis06.size() == size01 );
- VERIFY( equal(lis06.begin(), lis06.end(), title01) );
- VERIFY( lis05.get_allocator().get_personality() == personality02 );
- VERIFY( lis06.get_allocator().get_personality() == personality01 );
-
- list_type lis07(title01, title01 + N1, alloc02);
- size01 = lis07.size();
- personality01 = lis07.get_allocator().get_personality();
- list_type lis08(title03, title03 + N3, alloc01);
- size02 = lis08.size();
- personality02 = lis08.get_allocator().get_personality();
-
- lis07.swap(lis08);
- VERIFY( lis07.size() == size02 );
- VERIFY( equal(lis07.begin(), lis07.end(), title03) );
- VERIFY( lis08.size() == size01 );
- VERIFY( equal(lis08.begin(), lis08.end(), title01) );
- VERIFY( lis07.get_allocator().get_personality() == personality02 );
- VERIFY( lis08.get_allocator().get_personality() == personality01 );
-
- list_type lis09(title03, title03 + N3, alloc01);
- size01 = lis09.size();
- personality01 = lis09.get_allocator().get_personality();
- list_type lis10(title04, title04 + N4, alloc02);
- size02 = lis10.size();
- personality02 = lis10.get_allocator().get_personality();
-
- lis09.swap(lis10);
- VERIFY( lis09.size() == size02 );
- VERIFY( equal(lis09.begin(), lis09.end(), title04) );
- VERIFY( lis10.size() == size01 );
- VERIFY( equal(lis10.begin(), lis10.end(), title03) );
- VERIFY( lis09.get_allocator().get_personality() == personality02 );
- VERIFY( lis10.get_allocator().get_personality() == personality01 );
-
- list_type lis11(title04, title04 + N4, alloc02);
- size01 = lis11.size();
- personality01 = lis11.get_allocator().get_personality();
- list_type lis12(title01, title01 + N1, alloc01);
- size02 = lis12.size();
- personality02 = lis12.get_allocator().get_personality();
-
- lis11.swap(lis12);
- VERIFY( lis11.size() == size02 );
- VERIFY( equal(lis11.begin(), lis11.end(), title01) );
- VERIFY( lis12.size() == size01 );
- VERIFY( equal(lis12.begin(), lis12.end(), title04) );
- VERIFY( lis11.get_allocator().get_personality() == personality02 );
- VERIFY( lis12.get_allocator().get_personality() == personality01 );
-
- list_type lis13(title03, title03 + N3, alloc01);
- size01 = lis13.size();
- personality01 = lis13.get_allocator().get_personality();
- list_type lis14(title03, title03 + N3, alloc02);
- size02 = lis14.size();
- personality02 = lis14.get_allocator().get_personality();
-
- lis13.swap(lis14);
- VERIFY( lis13.size() == size02 );
- VERIFY( equal(lis13.begin(), lis13.end(), title03) );
- VERIFY( lis14.size() == size01 );
- VERIFY( equal(lis14.begin(), lis14.end(), title03) );
- VERIFY( lis13.get_allocator().get_personality() == personality02 );
- VERIFY( lis14.get_allocator().get_personality() == personality01 );
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h
new file mode 100644
index 00000000000..b4f2cd097d8
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.h
@@ -0,0 +1,156 @@
+// 2005-12-20 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.3 list::swap
+
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// uneq_allocator, two different personalities.
+template<typename _Tp>
+void
+swap3()
+{
+ bool test __attribute__((unused)) = true;
+ using namespace std;
+
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::size_type size_type;
+
+ const char title01[] = "Rivers of sand";
+ const char title02[] = "Concret PH";
+ const char title03[] = "Sonatas and Interludes for Prepared Piano";
+ const char title04[] = "never as tired as when i'm waking up";
+
+ const size_t N1 = sizeof(title01);
+ const size_t N2 = sizeof(title02);
+ const size_t N3 = sizeof(title03);
+ const size_t N4 = sizeof(title04);
+
+ size_type size01, size02;
+
+ allocator_type alloc01(1), alloc02(2);
+ int personality01, personality02;
+
+ list_type lis01(alloc01);
+ size01 = lis01.size();
+ personality01 = lis01.get_allocator().get_personality();
+ list_type lis02(alloc02);
+ size02 = lis02.size();
+ personality02 = lis02.get_allocator().get_personality();
+
+ lis01.swap(lis02);
+ VERIFY( lis01.size() == size02 );
+ VERIFY( lis01.empty() );
+ VERIFY( lis02.size() == size01 );
+ VERIFY( lis02.empty() );
+ VERIFY( lis01.get_allocator().get_personality() == personality02 );
+ VERIFY( lis02.get_allocator().get_personality() == personality01 );
+
+ list_type lis03(alloc02);
+ size01 = lis03.size();
+ personality01 = lis03.get_allocator().get_personality();
+ list_type lis04(title02, title02 + N2, alloc01);
+ size02 = lis04.size();
+ personality02 = lis04.get_allocator().get_personality();
+
+ lis03.swap(lis04);
+ VERIFY( lis03.size() == size02 );
+ VERIFY( equal(lis03.begin(), lis03.end(), title02) );
+ VERIFY( lis04.size() == size01 );
+ VERIFY( lis04.empty() );
+ VERIFY( lis03.get_allocator().get_personality() == personality02 );
+ VERIFY( lis04.get_allocator().get_personality() == personality01 );
+
+ list_type lis05(title01, title01 + N1, alloc01);
+ size01 = lis05.size();
+ personality01 = lis05.get_allocator().get_personality();
+ list_type lis06(title02, title02 + N2, alloc02);
+ size02 = lis06.size();
+ personality02 = lis06.get_allocator().get_personality();
+
+ lis05.swap(lis06);
+ VERIFY( lis05.size() == size02 );
+ VERIFY( equal(lis05.begin(), lis05.end(), title02) );
+ VERIFY( lis06.size() == size01 );
+ VERIFY( equal(lis06.begin(), lis06.end(), title01) );
+ VERIFY( lis05.get_allocator().get_personality() == personality02 );
+ VERIFY( lis06.get_allocator().get_personality() == personality01 );
+
+ list_type lis07(title01, title01 + N1, alloc02);
+ size01 = lis07.size();
+ personality01 = lis07.get_allocator().get_personality();
+ list_type lis08(title03, title03 + N3, alloc01);
+ size02 = lis08.size();
+ personality02 = lis08.get_allocator().get_personality();
+
+ lis07.swap(lis08);
+ VERIFY( lis07.size() == size02 );
+ VERIFY( equal(lis07.begin(), lis07.end(), title03) );
+ VERIFY( lis08.size() == size01 );
+ VERIFY( equal(lis08.begin(), lis08.end(), title01) );
+ VERIFY( lis07.get_allocator().get_personality() == personality02 );
+ VERIFY( lis08.get_allocator().get_personality() == personality01 );
+
+ list_type lis09(title03, title03 + N3, alloc01);
+ size01 = lis09.size();
+ personality01 = lis09.get_allocator().get_personality();
+ list_type lis10(title04, title04 + N4, alloc02);
+ size02 = lis10.size();
+ personality02 = lis10.get_allocator().get_personality();
+
+ lis09.swap(lis10);
+ VERIFY( lis09.size() == size02 );
+ VERIFY( equal(lis09.begin(), lis09.end(), title04) );
+ VERIFY( lis10.size() == size01 );
+ VERIFY( equal(lis10.begin(), lis10.end(), title03) );
+ VERIFY( lis09.get_allocator().get_personality() == personality02 );
+ VERIFY( lis10.get_allocator().get_personality() == personality01 );
+
+ list_type lis11(title04, title04 + N4, alloc02);
+ size01 = lis11.size();
+ personality01 = lis11.get_allocator().get_personality();
+ list_type lis12(title01, title01 + N1, alloc01);
+ size02 = lis12.size();
+ personality02 = lis12.get_allocator().get_personality();
+
+ lis11.swap(lis12);
+ VERIFY( lis11.size() == size02 );
+ VERIFY( equal(lis11.begin(), lis11.end(), title01) );
+ VERIFY( lis12.size() == size01 );
+ VERIFY( equal(lis12.begin(), lis12.end(), title04) );
+ VERIFY( lis11.get_allocator().get_personality() == personality02 );
+ VERIFY( lis12.get_allocator().get_personality() == personality01 );
+
+ list_type lis13(title03, title03 + N3, alloc01);
+ size01 = lis13.size();
+ personality01 = lis13.get_allocator().get_personality();
+ list_type lis14(title03, title03 + N3, alloc02);
+ size02 = lis14.size();
+ personality02 = lis14.get_allocator().get_personality();
+
+ lis13.swap(lis14);
+ VERIFY( lis13.size() == size02 );
+ VERIFY( equal(lis13.begin(), lis13.end(), title03) );
+ VERIFY( lis14.size() == size01 );
+ VERIFY( equal(lis14.begin(), lis14.end(), title03) );
+ VERIFY( lis13.get_allocator().get_personality() == personality02 );
+ VERIFY( lis14.get_allocator().get_personality() == personality01 );
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/moveable.cc b/libstdc++-v3/testsuite/23_containers/list/moveable.cc
index dc245b1ca00..fbe06634e6f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/moveable.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/moveable.cc
@@ -17,31 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// NOTE: This makes use of the fact that we know how moveable
-// is implemented on list (via swap). If the implementation changed
-// this test may begin to fail.
-
+#include "moveable.h"
#include <list>
-#include <utility>
-#include <testsuite_hooks.h>
-
-template<typename _Tp>
- void
- test_moveable()
- {
- bool test __attribute__((unused)) = true;
-
- typedef _Tp list_type;
-
- list_type a,b;
- a.push_back(1);
- b = std::move(a);
- VERIFY( b.size() == 1 && *b.begin() == 1 && a.size() == 0 );
-
- list_type c(std::move(b));
- VERIFY( c.size() == 1 && *c.begin() == 1 );
- VERIFY( b.size() == 0 );
- }
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/moveable.h b/libstdc++-v3/testsuite/23_containers/list/moveable.h
new file mode 100644
index 00000000000..1f11d6221e7
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/moveable.h
@@ -0,0 +1,41 @@
+// Copyright (C) 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// NOTE: This makes use of the fact that we know how moveable
+// is implemented on list (via swap). If the implementation changed
+// this test may begin to fail.
+
+#include <utility>
+#include <testsuite_hooks.h>
+
+template<typename _Tp>
+ void
+ test_moveable()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+
+ list_type a,b;
+ a.push_back(1);
+ b = std::move(a);
+ VERIFY( b.size() == 1 && *b.begin() == 1 && a.size() == 0 );
+
+ list_type c(std::move(b));
+ VERIFY( c.size() == 1 && *c.begin() == 1 );
+ VERIFY( b.size() == 0 );
+ }
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/1.cc b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
index d44e1c70612..2c98213e2a5 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
@@ -15,58 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.4 list operations [lib.list.ops]
-
+#include "1.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// splice(p, x) + remove + reverse
-template<typename _Tp>
-void
-operations01()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
-
- const int K = 417;
- const int A[] = {1, 2, 3, 4, 5};
- const int B[] = {K, K, K, K, K};
- const std::size_t N = sizeof(A) / sizeof(int);
- const std::size_t M = sizeof(B) / sizeof(int);
-
- list_type list0101(A, A + N);
- list_type list0102(B, B + M);
- iterator p = list0101.begin();
-
- VERIFY(list0101.size() == N);
- VERIFY(list0102.size() == M);
-
- ++p;
- list0101.splice(p, list0102); // [1 K K K K K 2 3 4 5]
- VERIFY(list0101.size() == N + M);
- VERIFY(list0102.size() == 0);
-
- // remove range from middle
- list0101.remove(K);
- VERIFY(list0101.size() == N);
-
- // remove first element
- list0101.remove(1);
- VERIFY(list0101.size() == N - 1);
-
- // remove last element
- list0101.remove(5);
- VERIFY(list0101.size() == N - 2);
-
- // reverse
- list0101.reverse();
- p = list0101.begin();
- VERIFY(*p == 4); ++p;
- VERIFY(*p == 3); ++p;
- VERIFY(*p == 2); ++p;
- VERIFY(p == list0101.end());
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/1.h b/libstdc++-v3/testsuite/23_containers/list/operations/1.h
new file mode 100644
index 00000000000..2f3f9df9465
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/1.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// splice(p, x) + remove + reverse
+template<typename _Tp>
+void
+operations01()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int K = 417;
+ const int A[] = {1, 2, 3, 4, 5};
+ const int B[] = {K, K, K, K, K};
+ const std::size_t N = sizeof(A) / sizeof(int);
+ const std::size_t M = sizeof(B) / sizeof(int);
+
+ list_type list0101(A, A + N);
+ list_type list0102(B, B + M);
+ iterator p = list0101.begin();
+
+ VERIFY(list0101.size() == N);
+ VERIFY(list0102.size() == M);
+
+ ++p;
+ list0101.splice(p, list0102); // [1 K K K K K 2 3 4 5]
+ VERIFY(list0101.size() == N + M);
+ VERIFY(list0102.size() == 0);
+
+ // remove range from middle
+ list0101.remove(K);
+ VERIFY(list0101.size() == N);
+
+ // remove first element
+ list0101.remove(1);
+ VERIFY(list0101.size() == N - 1);
+
+ // remove last element
+ list0101.remove(5);
+ VERIFY(list0101.size() == N - 2);
+
+ // reverse
+ list0101.reverse();
+ p = list0101.begin();
+ VERIFY(*p == 4); ++p;
+ VERIFY(*p == 3); ++p;
+ VERIFY(*p == 2); ++p;
+ VERIFY(p == list0101.end());
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2.cc b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
index 743b176b38f..100066fc29b 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
@@ -15,44 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.4 list operations [lib.list.ops]
-
+#include "2.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// splice(p, x, i) + remove_if + operator==
-template<typename _Tp>
-void
-operations02()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
-
- const int A[] = {1, 2, 3, 4, 5};
- const int B[] = {2, 1, 3, 4, 5};
- const int C[] = {1, 3, 4, 5, 2};
- const int N = sizeof(A) / sizeof(int);
- list_type list0201(A, A + N);
- list_type list0202(A, A + N);
- list_type list0203(B, B + N);
- list_type list0204(C, C + N);
- iterator i = list0201.begin();
-
- // result should be unchanged
- list0201.splice(list0201.begin(), list0201, i);
- VERIFY(list0201 == list0202);
-
- // result should be [2 1 3 4 5]
- ++i;
- list0201.splice(list0201.begin(), list0201, i);
- VERIFY(list0201 != list0202);
- VERIFY(list0201 == list0203);
-
- // result should be [1 3 4 5 2]
- list0201.splice(list0201.end(), list0201, i);
- VERIFY(list0201 == list0204);
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2.h b/libstdc++-v3/testsuite/23_containers/list/operations/2.h
new file mode 100644
index 00000000000..8eb3da4e780
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2.h
@@ -0,0 +1,54 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// splice(p, x, i) + remove_if + operator==
+template<typename _Tp>
+void
+operations02()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int A[] = {1, 2, 3, 4, 5};
+ const int B[] = {2, 1, 3, 4, 5};
+ const int C[] = {1, 3, 4, 5, 2};
+ const int N = sizeof(A) / sizeof(int);
+ list_type list0201(A, A + N);
+ list_type list0202(A, A + N);
+ list_type list0203(B, B + N);
+ list_type list0204(C, C + N);
+ iterator i = list0201.begin();
+
+ // result should be unchanged
+ list0201.splice(list0201.begin(), list0201, i);
+ VERIFY(list0201 == list0202);
+
+ // result should be [2 1 3 4 5]
+ ++i;
+ list0201.splice(list0201.begin(), list0201, i);
+ VERIFY(list0201 != list0202);
+ VERIFY(list0201 == list0203);
+
+ // result should be [1 3 4 5 2]
+ list0201.splice(list0201.end(), list0201, i);
+ VERIFY(list0201 == list0204);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3.cc b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
index 83d00133c49..53570b4a694 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
@@ -15,58 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.4 list operations [lib.list.ops]
-
+#include "3.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// splice(p, x, f, l) + sort + merge + unique
-template<typename _Tp>
-void
-operations03()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
- typedef typename list_type::iterator iterator;
-
- const int A[] = {103, 203, 603, 303, 403, 503};
- const int B[] = {417, 417, 417, 417, 417};
- const int E[] = {103, 417, 417, 203, 603, 303, 403, 503};
- const int F[] = {103, 203, 303, 403, 417, 417, 503, 603};
- const int C[] = {103, 203, 303, 403, 417, 417, 417, 417, 417, 503, 603};
- const int D[] = {103, 203, 303, 403, 417, 503, 603};
- const int N = sizeof(A) / sizeof(int);
- const int M = sizeof(B) / sizeof(int);
- const int P = sizeof(C) / sizeof(int);
- const int Q = sizeof(D) / sizeof(int);
- const int R = sizeof(E) / sizeof(int);
-
- list_type list0301(A, A + N);
- list_type list0302(B, B + M);
- list_type list0303(C, C + P);
- list_type list0304(D, D + Q);
- list_type list0305(E, E + R);
- list_type list0306(F, F + R);
- iterator p = list0301.begin();
- iterator q = list0302.begin();
-
- ++p; ++q; ++q;
- list0301.splice(p, list0302, list0302.begin(), q);
- VERIFY(list0301 == list0305);
- VERIFY(list0301.size() == N + 2);
- VERIFY(list0302.size() == M - 2);
-
- list0301.sort();
- VERIFY(list0301 == list0306);
-
- list0301.merge(list0302);
- VERIFY(list0301.size() == N + M);
- VERIFY(list0302.size() == 0);
- VERIFY(list0301 == list0303);
-
- list0301.unique();
- VERIFY(list0301 == list0304);
-}
int main(void)
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3.h b/libstdc++-v3/testsuite/23_containers/list/operations/3.h
new file mode 100644
index 00000000000..4d28daea12b
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3.h
@@ -0,0 +1,68 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// splice(p, x, f, l) + sort + merge + unique
+template<typename _Tp>
+void
+operations03()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
+ const int A[] = {103, 203, 603, 303, 403, 503};
+ const int B[] = {417, 417, 417, 417, 417};
+ const int E[] = {103, 417, 417, 203, 603, 303, 403, 503};
+ const int F[] = {103, 203, 303, 403, 417, 417, 503, 603};
+ const int C[] = {103, 203, 303, 403, 417, 417, 417, 417, 417, 503, 603};
+ const int D[] = {103, 203, 303, 403, 417, 503, 603};
+ const int N = sizeof(A) / sizeof(int);
+ const int M = sizeof(B) / sizeof(int);
+ const int P = sizeof(C) / sizeof(int);
+ const int Q = sizeof(D) / sizeof(int);
+ const int R = sizeof(E) / sizeof(int);
+
+ list_type list0301(A, A + N);
+ list_type list0302(B, B + M);
+ list_type list0303(C, C + P);
+ list_type list0304(D, D + Q);
+ list_type list0305(E, E + R);
+ list_type list0306(F, F + R);
+ iterator p = list0301.begin();
+ iterator q = list0302.begin();
+
+ ++p; ++q; ++q;
+ list0301.splice(p, list0302, list0302.begin(), q);
+ VERIFY(list0301 == list0305);
+ VERIFY(list0301.size() == N + 2);
+ VERIFY(list0302.size() == M - 2);
+
+ list0301.sort();
+ VERIFY(list0301 == list0306);
+
+ list0301.merge(list0302);
+ VERIFY(list0301.size() == N + M);
+ VERIFY(list0302.size() == 0);
+ VERIFY(list0301 == list0303);
+
+ list0301.unique();
+ VERIFY(list0301 == list0304);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/4.cc b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
index 37b983a39a2..a220b9b331f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
@@ -15,81 +15,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.4 list operations [lib.list.ops]
-
+#include "4.h"
#include <list>
-#include <testsuite_hooks.h>
-
-// A comparison predicate to order by rightmost digit. Tracks call
-// counts for performance checks.
-struct CompLastLt
-{
- bool operator()(const int x, const int y)
- { ++itsCount; return x % 10 < y % 10; }
- static int count() { return itsCount; }
- static void reset() { itsCount = 0; }
- static int itsCount;
-};
-
-int CompLastLt::itsCount;
-
-struct CompLastEq
-{
- bool operator()(const int x, const int y)
- { ++itsCount; return x % 10 == y % 10; }
- static int count() { return itsCount; }
- static void reset() { itsCount = 0; }
- static int itsCount;
-};
-
-int CompLastEq::itsCount;
-
-// sort(pred) + merge(pred) + unique(pred)
-// also checks performance requirements
-template<typename _Tp>
-void
-operations04()
-{
- bool test __attribute__((unused)) = true;
- typedef _Tp list_type;
-
- const int A[] = {1, 2, 3, 4, 5, 6};
- const int B[] = {12, 15, 13, 14, 11};
- const int C[] = {11, 12, 13, 14, 15};
- const int D[] = {1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6};
- const int N = sizeof(A) / sizeof(int);
- const int M = sizeof(B) / sizeof(int);
- const int Q = sizeof(D) / sizeof(int);
-
- list_type list0401(A, A + N);
- list_type list0402(B, B + M);
- list_type list0403(C, C + M);
- list_type list0404(D, D + Q);
- list_type list0405(A, A + N);
-
- // sort B
- CompLastLt lt;
-
- CompLastLt::reset();
- list0402.sort(lt);
- VERIFY(list0402 == list0403);
-
- CompLastLt::reset();
- list0401.merge(list0402, lt);
- VERIFY(list0401 == list0404);
-#ifndef _GLIBCXX_DEBUG
- VERIFY(lt.count() <= (N + M - 1));
-#endif
-
- CompLastEq eq;
-
- CompLastEq::reset();
- list0401.unique(eq);
- VERIFY(list0401 == list0405);
-#ifndef _GLIBCXX_DEBUG
- VERIFY(eq.count() == (N + M - 1));
-#endif
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/4.h b/libstdc++-v3/testsuite/23_containers/list/operations/4.h
new file mode 100644
index 00000000000..0a3ea4d234d
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/4.h
@@ -0,0 +1,92 @@
+// Copyright (C) 2001, 2004, 2005, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <testsuite_hooks.h>
+
+// A comparison predicate to order by rightmost digit. Tracks call
+// counts for performance checks.
+struct CompLastLt
+{
+ bool operator()(const int x, const int y)
+ { ++itsCount; return x % 10 < y % 10; }
+ static int count() { return itsCount; }
+ static void reset() { itsCount = 0; }
+ static int itsCount;
+};
+
+int CompLastLt::itsCount;
+
+struct CompLastEq
+{
+ bool operator()(const int x, const int y)
+ { ++itsCount; return x % 10 == y % 10; }
+ static int count() { return itsCount; }
+ static void reset() { itsCount = 0; }
+ static int itsCount;
+};
+
+int CompLastEq::itsCount;
+
+// sort(pred) + merge(pred) + unique(pred)
+// also checks performance requirements
+template<typename _Tp>
+void
+operations04()
+{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ const int A[] = {1, 2, 3, 4, 5, 6};
+ const int B[] = {12, 15, 13, 14, 11};
+ const int C[] = {11, 12, 13, 14, 15};
+ const int D[] = {1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6};
+ const int N = sizeof(A) / sizeof(int);
+ const int M = sizeof(B) / sizeof(int);
+ const int Q = sizeof(D) / sizeof(int);
+
+ list_type list0401(A, A + N);
+ list_type list0402(B, B + M);
+ list_type list0403(C, C + M);
+ list_type list0404(D, D + Q);
+ list_type list0405(A, A + N);
+
+ // sort B
+ CompLastLt lt;
+
+ CompLastLt::reset();
+ list0402.sort(lt);
+ VERIFY(list0402 == list0403);
+
+ CompLastLt::reset();
+ list0401.merge(list0402, lt);
+ VERIFY(list0401 == list0404);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(lt.count() <= (N + M - 1));
+#endif
+
+ CompLastEq eq;
+
+ CompLastEq::reset();
+ list0401.unique(eq);
+ VERIFY(list0401 == list0405);
+#ifndef _GLIBCXX_DEBUG
+ VERIFY(eq.count() == (N + M - 1));
+#endif
+}
+
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
index ae1939c8824..ad99c27ae42 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
@@ -17,122 +17,8 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-// 23.2.2.4 list operations [lib.list.ops]
-
+#include "5.h"
#include <list>
-#include <stdexcept>
-#include <testsuite_hooks.h>
-#include <testsuite_allocator.h>
-
-// Check the splice (and merge) bits of N1599.
-template<typename _Tp>
-void
-operations05()
-{
- bool test __attribute__((unused)) = true;
-
- typedef _Tp list_type;
- typedef typename list_type::allocator_type allocator_type;
-
- const int data1[] = {1, 2, 3, 4, 5};
- const int data2[] = {6, 7, 8, 9, 10};
- const size_t N1 = sizeof(data1) / sizeof(int);
- const size_t N2 = sizeof(data2) / sizeof(int);
-
- allocator_type alloc01(1), alloc02(2);
-
- list_type l01(data1, data1 + N1, alloc01);
- const list_type l01_ref = l01;
-
- list_type l02(data2, data2 + N2, alloc02);
- const list_type l02_ref = l02;
-
- bool catched = false;
-
- try
- {
- l01.splice(l01.begin(), l02);
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.splice(l01.begin(), l02, l02.begin());
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.splice(l01.begin(), l02, l02.begin(), l02.end());
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.merge(l02);
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-
- catched = false;
- try
- {
- l01.merge(l02, std::less<int>());
- }
- catch(std::runtime_error&)
- {
- catched = true;
- }
- catch(...)
- {
- VERIFY( false );
- }
- VERIFY( catched );
- VERIFY( l01 == l01_ref );
- VERIFY( l02 == l02_ref );
-}
int main()
{
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.h b/libstdc++-v3/testsuite/23_containers/list/operations/5.h
new file mode 100644
index 00000000000..2b54d5195ff
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/5.h
@@ -0,0 +1,134 @@
+// 2006-01-19 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 23.2.2.4 list operations [lib.list.ops]
+
+#include <stdexcept>
+#include <testsuite_hooks.h>
+#include <testsuite_allocator.h>
+
+// Check the splice (and merge) bits of N1599.
+template<typename _Tp>
+void
+operations05()
+{
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+
+ const int data1[] = {1, 2, 3, 4, 5};
+ const int data2[] = {6, 7, 8, 9, 10};
+ const size_t N1 = sizeof(data1) / sizeof(int);
+ const size_t N2 = sizeof(data2) / sizeof(int);
+
+ allocator_type alloc01(1), alloc02(2);
+
+ list_type l01(data1, data1 + N1, alloc01);
+ const list_type l01_ref = l01;
+
+ list_type l02(data2, data2 + N2, alloc02);
+ const list_type l02_ref = l02;
+
+ bool catched = false;
+
+ try
+ {
+ l01.splice(l01.begin(), l02);
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.splice(l01.begin(), l02, l02.begin());
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.splice(l01.begin(), l02, l02.begin(), l02.end());
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.merge(l02);
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+
+ catched = false;
+ try
+ {
+ l01.merge(l02, std::less<int>());
+ }
+ catch(std::runtime_error&)
+ {
+ catched = true;
+ }
+ catch(...)
+ {
+ VERIFY( false );
+ }
+ VERIFY( catched );
+ VERIFY( l01 == l01_ref );
+ VERIFY( l02 == l02_ref );
+}