diff options
author | kan <kan@FreeBSD.org> | 2006-08-26 21:29:10 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2006-08-26 21:29:10 +0000 |
commit | 5c84bed2e8cff6c766e11d6ea545e97164e691c5 (patch) | |
tree | 7078a2224aa03a9d5caa5d11a9c917980f60fd6a /contrib/gcc | |
parent | 768d4ea5cbe248d3d90adabc5fd80c7c1fa74bcb (diff) | |
parent | ab6c6e434e4ca0bf593007d49dee6eceb73286c0 (diff) | |
download | FreeBSD-src-5c84bed2e8cff6c766e11d6ea545e97164e691c5.zip FreeBSD-src-5c84bed2e8cff6c766e11d6ea545e97164e691c5.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r161651,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/gcc')
91 files changed, 2773 insertions, 944 deletions
diff --git a/contrib/gcc/ChangeLog b/contrib/gcc/ChangeLog index fe9363f..d17872f 100644 --- a/contrib/gcc/ChangeLog +++ b/contrib/gcc/ChangeLog @@ -1,3 +1,822 @@ +2006-04-25 Nick Clifton <nickc@redhat.com> + + * config/m32r/m32r.c (gen_compare): Fix reg/smallconst equal code, + the patch for which was accidentally omitted from the previous + commit. + +2006-04-04 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + PR target/26775 + PR target/26776 + * config/m32r/m32r.c (m32r_output_function_epilogue): Case for + a large stack frame at epilogue. Use fp to recover a stack + pointer for alloca function at epilogue. + + PR target/36276 + * config/m32r/m32r.c (gen_compare): Removed a rule addsi3 codes + to avoid a miss optimizing at simplify_relational_operation(). + * config/m32r/m32r.md (seq): Ditto. Changed reg_or_eq_int16_operand + to reg_or_uint16_operand because seq_insn has not used addsi3 already. + (seq_insn): Ditto. Removed operand check mode "P". Changed + reg_or_eq_int16_operand to reg_or_uint16_operand. + +2006-03-05 Release Manager + + * GCC 3.4.6 released. + +2006-03-01 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Backport + 2005-11-03 James E Wilson <wilson@specifix.com> + + PR preprocessor/24202 + * cppfiles.c (_cpp_pop_file_buffer): Set buffer_valid to false. + +2006-03-01 Alan Modra <amodra@bigpond.net.au> + + PR target/21616 + Revert most of 2004-03-10 changes, apply mainline 2005-01-07. + * config/rs6000/rs6000.c (invalid_gpr_mem): Delete. + (base_reg_operand): Delete. + (legitimate_offset_address_p): Revert 2004-03-10 changes. + (secondary_reload_class): Likewise. + (rs6000_legitimize_reload_address): Convert non-word aligned + offset address using ld/std into indirect address. + * config/rs6000/rs6000.h (SECONDARY_RELOAD_CLASS): Define. + (SECONDARY_INPUT_RELOAD_CLASS, SECONDARY_OUTPUT_RELOAD_CLASS): Delete. + (PREDICATE_CODES): Delete invalid_gpr_mem and base_reg_operand. + * config/rs6000/rs6000-protos.h (secondary_reload_class): Update. + * config/rs6000/rs6000.md (movdf_hardfloat64): Remove m->b + alternative and split. + (movdi_internal64): Likewise. + (reload_outdf, reload_indf, reload_outdi, reload_indi): Delete. + +2006-02-28 Gabriel Dos Reis <gdr@integrable-solutions.net> + + Backport + 2004-04-28 Serge Belyshev <1319@bot.ru> + + PR 14944 + * coverage.c (read_counts_file): Fix usage of warning () call. + * pretty-print.c (pp_base_format_text): Fix typo in the comment. + +2006-02-18 Olivier Hainque <hainque@adacore.com> + + PR ada/13408 + * pa.h (WIDEST_HARDWARE_FP_SIZE): Define. + +2006-02-13 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + Backport: + 2006-02-01 Steve Ellcey <sje@cup.hp.com> + + PR middle-end/24901 + * fold-const.c (fold_checksum_tree): Change type of buf. + +2006-02-11 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * doc/contrib.texi: Update my entry. + +2006-02-09 Eric Botcazou <ebotcazou@libertysurf.fr> + + * config/sparc/sparc.c (tls_call_delay): Fix oversight. + +2006-02-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR target/26109 + * pa.c (attr_length_indirect_call): Don't return length 8 for distances + >= 240000 when generating code for SOM runtime. + (output_indirect_call): Don't use "b,l" instruction for indirect calls + to $$dyncall when generating code for SOM runtime.. + +2006-02-02 Nick Clifton <nickc@redhat.com> + + PR 24376 + * sched-rgn.c (add_branch_dependences): For cc0 targets extend + the dependencies inside a block back to the very first cc0 setter + in the block. + +2006-01-21 Joseph S. Myers <joseph@codesourcery.com> + + * gcc.c (process_command), gcov.c (print_version), gcov-dump.c + (print_version), mips-tdump.c (main), mips-tfile.c (main): Update + copyright notice dates. + +2006-01-12 Kaz Kojima <kkojima@gcc.gnu.org> + + PR target/25613 + * config/sh/sh.h (CONSTRAINT_LEN): Use unchecking version. + +2005-12-30 Roger Sayle <roger@eyesopen.com> + + PR target/25213 + Backport from mainline + 2005-09-06 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/23098 + * cse.c (fold_rtx_mem): Call delegitimize_address target hook. + * simplify-rtx.c (constant_pool_reference_p): New function. + * rtl.h (constant_pool_reference_p): New prototype. + * config/i386/i386.md (pushf split, mov[sdx]f split): Use + constant_pool_reference_p in condition and + avoid_constant_pool_reference in preparation statements. + +2005-12-30 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR fortran/25586 + * pa.md: Remove REG_POINTER check from REG+REG peephole2 floating-point + store patterns. + +2005-12-29 Alan Modra <amodra@bigpond.net.au> + + PR target/25572 + * config/rs6000/rs6000.c (create_TOC_reference): Set regs_ever_live. + +2005-12-17 Steven Bosscher <stevenb@suse.de> + + PR rtl-optimization/23837 + * optabs.c (expand_binop): For a multi-word rotate, never emit + a REG_NO_CONFLICT block. + +2005-12-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + Backport from mainline: + 2004-11-01 Mike Stump <mrs@apple.com> + + * inclhack.def (stdio_va_list): Break out clients from here... + (stdio_va_list_clients): ...to here. Also, don't fix if stdarg.h is + included or ifdef va_start. + * fixincl.x: Regenerate. + +2005-12-13 Alan Modra <amodra@bigpond.net.au> + + * config/rs6000/linux64.h (TARGET_ALIGN_NATURAL): Define. + +2005-12-10 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR target/25258 + * pa.c (som_text_section_asm_op): Use .NSUBSPA directive when changing + to the text subspace to output debugging information. + +2005-12-06 Alan Modra <amodra@bigpond.net.au> + + PR other/13873 + * longlong.h: Merge PPC tests from upstream. + +2005-12-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + PR middle-end/25022 + * builtins.c (expand_builtin_fputs, expand_builtin_printf, + expand_builtin_fprintf): Lookup the explicit replacement functions + for any unlocked stdio builtin transformations. + + * builtins.c (expand_builtin_fputs): Defer check for missing + replacement functions. + +2005-12-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/24103 + Backport: + 2002-08-22 Diego Novillo <dnovillo@redhat.com> + + * tree.c (simple_cst_equal): Call simple_cst_list_equal to compare + CONSTRUCTOR_ELTS pointers. + +2005-12-01 Gabriel Dos Reis <gdr@integrable-solutions.net> + + * version.c: Bump version number. + * doc/include/gcc-common.texi: Likewise. + +2005-11-30 Release Manager + + * GCC 3.4.5 released. + +2005-11-23 Alan Modra <amodra@bigpond.net.au> + + PR middle-end/24950 + * expmed.c (store_bit_field): Don't attempt to insv a field + larger than the reg. + + Merge from trunk + 2005-11-14 Dale Johannesen <dalej@apple.com> + * expmed.c (store_bit_field): Add offset unconditionally for + memory targets. + (extract_bit_field): Don't force extzv or extv operand into + a register if field is too big. + 2004-12-01 Richard Henderson <rth@redhat.com> + * expmed.c (store_bit_field): Use simplify_gen_subreg instead + of gen_rtx_SUBREG directly. + +2005-11-16 Steve Ellcey <sje@cup.hp.com> + + PR target/24718 + * mklibgcc.in: Create dummy object for libgcc_eh.a + * config/ia64/hpux.h (LIBGCC_SPEC): Remove. + +2005-11-13 Andreas Jaeger <aj@suse.de> + + * fixinc/check.tpl: Handle CVS additionally. + +2005-11-10 Uros Bizjak <uros@kss-loka.si> + + PR target/24315 + * config/i386/i386.md (*pushdi2_rex64 splitter) + (*movdi_1_rex64 splitter): Delay splitting after + flow2 pass only when (optimize > 0 && flag_peephole2). + +2005-11-10 Uros Bizjak <uros@kss-loka.si> + + PR target/19340 + * reg-stack.c (reg_to_stack): Update register liveness also + for flag_sched2_use_traces. + +2005-11-09 Per Bothner <per@bothner.com> + Uros Bizjak <uros@kss-loka.si> + + PR c/24101 + * toplev.c (process_options): Initialize debug_hooks early + in case lang_hooks.post_options ends up calling a debug_hook. + * cppinit.c (read_original_filename): Temporarily set + state.in_directive before calling _cpp_lex_direct for + CPP_HASH tokens. + +2005-11-07 Steve Ellcey <sje@cup.hp.com> + + PR bootstrap/24688 + * fixinc/inclhack.def (sco_math): Add bypass. + * fixinc/fixincl.x: Regenerate. + +2005-11-07 James E Wilson <wilson@specifix.com> + + PR preprocessor/15220 + * cppfiles.c (_cpp_find_file): New parameter angle_brackets. Fix all + callers. Pass to open_file_failed. + (open_file_failed): New parameter angle_brackets. Fix + all callers. use in print_dep assignment. + * cpphash.h (_cpp_find_file): Add new parm to declaration. + * cppinit.c (cpp_read_main_file): Pass another arg to _cpp_find_file. + +2005-11-05 Andreas Jaeger <aj@suse.de> + + * fixinc/check.tpl: Adopt for move to subversion. + +2005-11-03 Richard Guenther <rguenther@suse.de> + + PR middle-end/24470 + * fold-const.c (fold): Avoid running in circles if we + got some un-folded subtree. + +2005-10-30 Alan Modra <amodra@bigpond.net.au> + + PR target/23070 + * config/rs6000/rs6000.c (function_arg): For ABI_V4 calls to + stdarg functions, set/clear the fp marker even when no variable + args are passed. + * config/rs6000/sysv4.h (SUBTARGET_SWITCHES): Describe + -mprototype and -mno-prototype. + +2005-10-21 Alan Modra <amodra@bigpond.net.au> + + PR target/24465 + * config/rs6000/rs6000.c (rs6000_legitimize_tls_address): Always + use r2 for 64-bit tls .got access. + +2005-10-19 Paolo Bonzini <bonzini@gnu.org> + + * dojump.c (do_jump): Revert the last patch as it breaks Ada. + +2005-10-19 Paolo Bonzini <bonzini@gnu.org> + + PR #19672 + * dojump.c (do_jump): Handle TRUTH_AND_EXPR and TRUTH_OR_EXPR + like TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR, if the branch cost + is low enough. + +2005-10-09 Eric Botcazou <ebotcazou@libertysurf.fr> + + * config/sparc/gmon-sol2.c (internal_mcount): Mark as used. + +2005-10-08 Janis Johnson <janis187@us.ibm.com> + + PR debug/24267 + Partial backport from mainline + 2004-05-04 Paolo Bonzini <bonzini@gnu.org> + Richard Henderson <rth@redhat.com> + * tree.c (make_or_reuse_type): New. + (build_common_tree_nodes): Use it. + + PR target/18583 + Partial backport from mainline + 2004-05-04 Paolo Bonzini <bonzini@gnu.org> + Richard Henderson <rth@redhat.com> + * c-common.c (vector_types_convertible_p): New function. + * c-common.h: Declare it. + * c-typeck.c (digest_init): Use it. + +2005-10-07 James E Wilson <wilson@specifix.com> + + PR target/23644 + * doc/invoke.texi (IA-64 Options, item -mtune): Renamed from + -mtune-arch. + +2005-10-01 Richard Earnshaw <richard.earnshaw@arm.com> + + PR target/23985 + Back-port 2004-08-19 Richard Henderson <rth@redhat.com> + * config/arm/arm.c (arm_gen_load_multiple): Use + adjust_automodify_address. Take base memory and offset instead + of unchanging/struct/scalar bits. + (arm_gen_store_multiple): Likewise. + (arm_gen_movstrqi): Use adjust_automodify_address. + * config/arm/arm-protos.h: Update decls. + * config/arm/arm.md (load_multiple): Update arm_gen_load_multiple call. + (store_multiple): Similarly. + +2005-09-29 Alan Modra <amodra@bigpond.net.au> + + PR target/24102 + * config/rs6000/rs6000.md (floatdisf2_internal2): Correct range + check for numbers that need no bit twiddle. + +2005-09-09 Richard Guenther <rguenther@suse.de> + + PR c/20239 + * cppinit.c (cpp_read_main_file): Avoid segfaulting on + NULL pfile->map. + +2005-09-09 Richard Guenther <rguenther@suse.de> + + PR c++/23624 + * fold-const.c (fold): Check truth_value_p before calling + invert_truthvalue. + +2005-09-08 Craig Rodrigues <rodrigc@gcc.gnu.org> + + Backport from mainline + 2005-09-01 Craig Rodrigues <rodrigc@gcc.gnu.org> + + * c-decl.c (diagnose_mismatched_decls): With -Wredundant-decls, + do not issue warning for a variable definition following + a declaration. + +2005-09-02 Richard Sandiford <richard@codesourcery.com> + + PR c/22061 + * c-decl.c (push_parm_decl): Push and pop x_dont_save_pending_sizes_p + around the call to grokdeclarator. Call grokdeclarator with the + field set to 0. + (store_parm_decls): Always store the pending_sizes in cfun. + (c_expand_body_1): Call put_pending_sizes. + * c-objc-common.c (c_cannot_inline_tree_fn): Always check + pending_sizes. + +2005-09-01 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/23478 + * regs.h (reg_info): Add throw_calls_crossed. + (REG_N_THROWING_CALLS_CROSSED): Define. + * flow.c (allocate_reg_life_data): Initialize + REG_N_THROWING_CALLS_CROSSED. + (propagate_one_insn, attempt_auto_inc): Update + REG_N_THROWING_CALLS_CROSSED. + * local-alloc.c (struct qty): Add n_throwing_calls_crossed field. + (alloc_qty): Initialize it. + (update_equiv_regs): Clear REG_N_THROWING_CALLS_CROSSED. + (combine_regs): Combine also n_throwing_calls_crossed fields. + (find_free_reg): Don't attempt to caller-save pseudos crossing + calls that might throw. + * global.c (struct allocno): Add throwing_calls_crossed field. + (global_alloc): Initialize throwing_calls_crossed. + (find_reg): Don't attempt to caller-save pseudos crossing calls that + might throw. + +2005-09-01 Richard Earnshaw <richard.earnshaw@arm.com> + + PR rtl-optimization/17810 target/15342 + * regrename.c: Fix polluted patch in previous change. + +2005-09-01 Richard Earnshaw <richard.earnshaw@arm.com> + + PR rtl-optimization/17810 + Backport + 2004-11-04 Richard Sandiford <rsandifo@redhat.com> + PR target/15342 + * regrename.c (scan_rtx): Treat the destinations of SETs and CLOBBERs + as OP_INOUT if the instruction is predicated. + +2005-08-31 David Edelsohn <edelsohn@gnu.org> + + PR target/23539 + Backport from mainline: + + 2005-08-27 David Edelsohn <edelsohn@gnu.org> + * config/rs6000/rs6000.c (expand_block_move): Use HImode when + bytes >= 2 not bytes == 2. + +2005-08-21 Jakub Jelinek <jakub@redhat.com> + + * simplify-rtx.c (simplify_immed_subreg) <case CONST_DOUBLE>: Only + clear up to elem_bitsize bits, not max_bitsize. + +2005-07-20 Steve Ellcey <sje@cup.hp.com> + + PR target/21841 + * doc/invoke.texi (-mgnu-ld): Update description. + (-mhp-ld): Ditto. + +2005-08-09 Paolo Bonzini <bonzini@gnu.org> + + PR rtl-optimization/17860 + * loop.c (check_dbra_loop): Do not try to use an end condition + like "i != 0" in the reversed loop. + +2005-08-08 Josh Conner <jconner@apple.com> + + PR rtl-optimization/23241 + * combine.c (simplify_comparison): Fix error in determining + whether to lift a subreg from comparison. + +2005-08-08 Richard Sandiford <richard@codesourcery.com> + + PR middle-end/21964 + * stmt.c (tail_recursion_args): Insert a call to emit_queue. + +2005-08-08 Richard Sandiford <richard@codesourcery.com> + + PR c/22458 + * c-decl.c (c_begin_compound_stmt): Set the initial body to + error_mark_node, not NULL. + +2005-08-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * pa64-regs.h (CONDITIONAL_REGISTER_USAGE): Fix loop upper bound. + +2005-08-06 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR pch/14940 + Backport from mainline: + + * config.host (hppa*-*-hpux*, hppa*-*-linux): Define out_host_hook_obj + and host_xmake_file using new host configuration files. + * config/pa/pa-host.c, config/pa/x-hpux, config/pa/x-linux: New files. + +2005-08-06 Christian Joensson <christian.joensson@gmail.com> + + PR target/20673 + Backport from mainline: + + 2005-04-15 David S. Miller <davem@davemloft.net> + + * config/sparc/sparc.h (sparc_hard_reg_printed): Mark as GTY(()). + +2005-08-05 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + * pa.c (function_arg): Fix typo in last change. + + * pa.c (function_value): Handle small aggregates on 32-bit targets. + (function_arg): Pass small aggregates in general registers on 32-bit + targets. + * som.h (MEMBER_TYPE_FORCES_BLK): Delete define. + +2005-08-04 Gerald Pfeifer <gerald@pfeifer.com> + + * doc/install.texi (Specific): Adjust link to openavr.org. + (Specific): Remove broken reference to GCC 2.8.1 for OS/2. + (Binaries): Adjust HP-UX Porting Center link. + (Binaries): Adjust Free Software Foundation ordering link. + (Binaries): Remove broken link to Sinix/Reliant Unix binaries. + +2005-08-04 Eric Botcazou <ebotcazou@adacore.com> + + * doc/invoke.texi (Optimize Options): Document that -funswitch-loops + is enabled at -O3. + +2005-08-03 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR target/21723 + * pa.md: Remove fcpy alternative from movhi and movqi patterns. + * pa32-regs.h (HARD_REGNO_NREGS): Return two floating point registers + for complex modes when generating code for PA 1.0. + (VALID_FP_MODE_P): New macro. + (HARD_REGNO_MODE_OK): Use VALID_FP_MODE_P. Use non-overlapping register + sets for all general and floating point modes. Align wide floating + point modes to even register boundaries to comply with architectural + requirements. + (CLASS_MAX_NREGS): Update to align with change to HARD_REGNO_NREGS. + * pa64-regs.h (HARD_REGNO_NREGS): Update comment and formatting. + (VALID_FP_MODE_P): New macro. + (HARD_REGNO_MODE_OK): Use VALID_FP_MODE_P. Use non-overlapping register + sets for all general and floating point modes. Align wide floating + point modes to even register boundaries to comply with architectural + requirements. + +2005-08-03 Richard Sandiford <richard@codesourcery.com> + + PR target/18582 + * config/i386/i386.c (ix86_expand_unop_builtin): Force the target + to be a register if do_load is true. + +2005-08-02 Ian Lance Taylor <ian@airs.com> + + PR pch/14400 + Backport from mainline: + + 2005-08-01 Ian Lance Taylor <ian@airs.com> + + * config/host-linux.c (linux_gt_pch_get_address): Add new name + randomize_va_space for virtual address randomization control. + + 2005-02-15 James A. Morrison <phython@gcc.gnu.org> + + PR pch/14940 + PR target/19300 + * config/host-linux.c (linux_gt_pch_use_address): Copy from + config/pa/pa-host.c:pa_gt_pch_use_address. + + 2004-11-09 James A. Morrison <phython@gcc.gnu.org> + + PR pch/14940 + * config/host-linux.c (TRY_EMPTY_VM_SPACE): Add __sparc__ + definitions. + + 2004-10-15 Jon Grimm <jgrimm2@us.ibm.com> + + * config/host-linux.c (TRY_EMPTY_VM_SPACE): Add __powerpc__ + definition. + + 2004-04-24 Ulrich Weigand <uweigand@de.ibm.com> + + * config/host-linux.c (TRY_EMPTY_VM_SPACE): Define for __s390__ + and __s390x__ hosts. + + 2004-04-08 Ian Lance Taylor <ian@wasabisystems.com> + + * config/rs6000/host-darwin.c (darwin_rs6000_gt_pch_use_address): + Return 1 if file was successfully mapped. + + 2004-03-15 Ian Lance Taylor <ian@wasabisystems.com> + + * config/rs6000/host-darwin.c (darwin_rs6000_gt_pch_use_address): + Fix the check for abort and only do the mmap if we can. + + 2004-03-12 Andrew Pinski <apinski@apple.com> + + * config/rs6000/host-darwin.c (darwin_rs6000_gt_pch_use_address): + Use ret instead of result. Use addr instead of base. + + 2004-03-10 Richard Henderson <rth@redhat.com> + + * c-pch.c (c_common_no_more_pch): Update for gt_pch_use_address + extra arguments. + * config.host (*-*-solaris2*, *-*-linux*): Add out_host_hook_obj + and host_xmake_file fragments. + * ggc-common.c (gt_pch_save): Update for gt_pch_get_address change. + (gt_pch_restore): Similarly for gt_pch_use_address. + (default_gt_pch_get_address): New. + (mmap_gt_pch_get_address): Split out of gt_pch_save. + (default_gt_pch_use_address): Split out of gt_pch_restore. + (mmap_gt_pch_use_address): Likewise. + * hooks.c (hook_voidp_size_t_null): Remove. + (hook_bool_voidp_size_t_false): Remove. + * hooks.h: Likewise. + * hosthooks-def.h (HOST_HOOKS_GT_PCH_GET_ADDRESS): Use one of the + default_ or mmap_ definitions. + (HOST_HOOKS_GT_PCH_USE_ADDRESS): Likewise. + * hosthooks.h (struct host_hooks): Update gt_pch_get_address + and gt_pch_use_address. + * config/host-linux.c, config/host-solaris.c: New files. + * config/x-linux, config/x-solaris: New files. + * config/rs6000/host-darwin.c darwin_rs6000_gt_pch_get_address): + Update for changed definition. + (darwin_rs6000_gt_pch_use_address): Likewise. + * doc/hostconfig.texi: Update docs. + +2005-07-31 Richard Sandiford <richard@codesourcery.com> + + PR target/20621 + Backport from mainline: + + 2004-08-01 Richard Sandiford <rsandifo@redhat.com> + * config/mips/mips.md (cprestore): Provide two alternatives, one for + an in-range offset and one for an out-of-range offset. Wrap the latter + in .set macro/.set nomacro if it's inside a .set nomacro block. + + 2004-08-01 Richard Sandiford <rsandifo@redhat.com> + * config/mips/mips-protos.h (mips_gp_save_slot): Remove. + (mips_restore_gp): Declare. + * config/mips/mips.c (mips_add_offset): Add a scratch register + argument. Reimplement in rtl only, reusing MIPS16 logic from + mips_output_mi_thunk. + (mips_legitimize_address, mips_legitimize_const_move): Adjust calls + to mips_add_offset. + (mips_gp_save_slot): Delete. + (mips_restore_gp): New function. + (mips_set_return_address, mips_output_mi_thunk): Use mips_add_offset. + * config/mips/mips.md (exception_receiver): Turn into a + define_insn_and_split. Use mips_restore_gp to do the split. + (call_internal, call_value_internal, call_value_multiple_internal): Use + mips_restore_gp to restore $gp. + +2005-07-29 Alan Modra <amodra@bigpond.net.au> + + * config/rs6000/sysv4.h (TARGET_ASM_EXCEPTION_SECTION): Delete. + +2005-07-28 Richard Henderson <rth@redhat.com> + + PR rtl-opt/22619 + * cfgcleanup.c (try_forward_edges): Watch out for end of + insn chain. + +2005-07-28 Joseph S. Myers <joseph@codesourcery.com> + + PR c/17188 + PR c/21899 + * c-decl.c (diagnose_mismatched_decls): Check for duplicate + declarations of enumerators. + (start_struct): Check TYPE_SIZE rather than TYPE_FIELDS to check + for redefinition. Check for nested redefinition. + (finish_struct): Don't check for nested redefinition. + (start_enum): Check for nested redefinition. + +2005-07-28 Joseph S. Myers <joseph@codesourcery.com> + + PR c/21873 + * c-typeck.c (push_init_level): Don't pop levels without braces if + implicit == 1. + +2005-07-28 Gerald Pfeifer <gerald@pfeifer.com> + + * doc/install.texi (Configuration): Update Valgrind homepage. + +2005-07-28 Richard Sandiford <richard@codesourcery.com> + + PR c/20187 + * fold-const.c (fold): When shortening comparisons of widened operands, + check whether the tree returned by get_unwidened really is wider. + +2005-07-28 Richard Sandiford <richard@codesourcery.com> + + PR c/22589 + Backport from mainline: + + 2004-06-16 Alexandre Oliva <aoliva@redhat.com> + * tree.c (get_narrower): Don't narrow integral types into + non-integral types. + +2005-07-26 Bernardo Innocenti <bernie@develer.com> + + Backport from mainline: + 2005-07-12 Peter Barada <peter@the-baradas.com> + PR middle-end/16719 + PR middle-end/18421 + * config/m68k/m68k.h (HARD_REGNO_MODE_OK): Disallow bytes + in address registers. + * config/m68k/m68k.c (hard_regno_mode_ok): Likewise. + * config/m68k/m68k.md: Replace 's' with 'i' in 4th + alternative of addsi3_5200. + +2005-07-21 Janis Johnson <janis187@us.ibm.com> + + PR target/20191 + Backport from mainline: + + 2004-04-23 Dale Johannesen <dalej@apple.com> + + * config/rs6000.md (movsf_hardfloat): Add POWER form of nop. + (movdf_hardfloat64): Ditto. + (movdf_softfloat64): Ditto. + + * config/rs6000.md (movsf_hardfloat): Accept CTR-to-CTR copy. + (movdf_hardfloat64): Ditto. + +2005-07-21 Richard Sandiford <richard@codesourcery.com> + + PR rtl-optimization/22167 + * gcse.c (hoist_code): Fix hoist_exprs[] check. + +2005-07-19 Gerald Pfeifer <gerald@pfeifer.com> + + * config.gcc: Add support for *-*-freebsd7, *-*-freebsd8, + and *-*-freebsd9. + * config/freebsd-spec.h (FBSD_TARGET_OS_CPP_BUILTINS): Ditto. + +2005-07-09 Jakub Jelinek <jakub@redhat.com> + + * config/i386/i386.c (output_set_got): Don't omit OFFSET FLAT: + in Intel syntax add %reg, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_+(.-.Lx). + +2005-07-08 David Edelsohn <edelsohn@gnu.org> + + Backport from mainline: + 2005-06-18 Roger Sayle <roger@eyesopen.com> + PR target/22083 + * config/rs6000/aix51.h (TARGET_C99_FUNCTIONS): Remove definition. + +2005-07-05 Joseph S. Myers <joseph@codesourcery.com> + + PR c/22308 + * c-decl.c (finish_struct): Also copy C_TYPE_FIELDS_READONLY, + C_TYPE_FIELDS_VOLATILE and C_TYPE_VARIABLE_SIZE to type variants. + +2005-06-14 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR target/20301 + * config/sparc/sol2.h (ASM_GENERATE_INTERNAL_LABEL): Emit + unsigned index numbers. + +2005-06-08 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR target/21889 + * config/sparc/sol2.h (ASM_OUTPUT_DWARF_DTPREL): Undefine. + * config/sparc/sol2-gas.h (ASM_OUTPUT_DWARF_DTPREL): Redefine. + +2005-06-04 Richard Henderson <rth@redhat.com> + + PR target/21888 + * config/alpha/alpha.c (alpha_align_insns): Don't insert nops + until we've passed initial ldgp. + +2005-06-01 Richard Henderson <rth@redhat.com> + + * configure.ac (HAVE_AS_JSRDIRECT_RELOCS): New. + * config.in, configure: Rebuild. + * config/alpha/alpha.c (print_operand): Add 'j'. + * alpha.md (divmodsi_internal_er_1): Use it. + (divmoddi_internal_er_1): Likewise. + +2005-05-31 Eric Botcazou <ebotcazou@libertysurf.fr> + + * doc/install.texi (sparc-sun-solaris2*): Update note + about Sun bug 4910101. + +2005-05-29 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR target/19933 + * fixinc/inclhack.def (solaris_math_6_1): New fix. + (solaris_math_9): Rewrite and guard with #ifdef __sparc__. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/iso/math_c99.h: Adjust for above changes. + + Backport from mainline: + 2005-05-19 Eric Botcazou <ebotcazou@libertysurf.fr> + Joseph S. Myers <joseph@codesourcery.com> + + * fixinc/inclhack.def: New fixes solaris_math_[1-9]. + * fixinc/fixincl.x: Regenerate. + * fixinc/tests/base/iso/math_c99.h: New. + + Backport from mainline: + 2005-05-10 Joseph S. Myers <joseph@codesourcery.com> + + * fixinc/inclhack.def (stdio_stdarg_h, stdio_va_list): Bypass on + *-*-solaris2.1[0-9]*, not just *-*-solaris2.1[0-9]. + * fixinc/fixincl.x: Regenerate. + + Backport from mainline: + 2004-11-26 Mark Mitchell <mark@codesourcery.com> + + * fixinc/inclhack.def (gnu_types): Do not use on Solaris 2.1x. + (stdio_va_list): Likewise. + (stdio_stdarg.h): Likewise. + (solaris_stdio_tag): Add bypass. + * fixinc/fixincl.x: Regenerated. + +2005-05-26 Jakub Jelinek <jakub@redhat.com> + + PR target/21716 + * reg-stack.c (swap_rtx_condition): Don't crash if %ax user was not + found in the basic block and last insn in the basic block is not + INSN_P. Remove explicit unspec numbers that are no longer valid + from comments. + +2005-05-25 Roger Sayle <roger@eyesopen.com> + + PR middle-end/21709 + * fold-const.c (const_binop): Check for division by zero during + complex division. + +2005-05-24 Kazuhiro Inaoka <inaoka.kazuhiro@renesas.com> + + * config/m32r/m32r.c (m32r_expand_block_move): Return 0 if + nothing was done. + * config/m32r/m32r.md (movmemsi): If m32r_expand_block_move did + nothing then FAIL. + * config/m32r/m32r/m32r-protos.h (m32r_expand_block_move): Update + prototype. + +2005-05-23 Ulrich Weigand <uweigand@de.ibm.com> + + * unroll.c (loop_iterations): Remove common term from initial + and final value only if it is loop invariant. + +2005-05-20 Mark Mitchell <mark@codesourcery.com> + + * version.c (version_string): Mark as 3.4.5. + +2005-05-19 Mark Mitchell <mark@codesourcery.com> + + * version.c (version_string): Restore pre-release marker. + 2005-05-19 Release Manager * GCC 3.4.4 released. @@ -87,7 +906,7 @@ (m68hc11_split_move): Likewise. 2005-05-06 Bruce Korb <bkorb@gnu.org> - Joseph S. Myers <joseph@codesourcery.com> + Joseph S. Myers <joseph@codesourcery.com> * fixinc/inclhack.def: Correct backslashes * fixinc/fixincl.x: regen diff --git a/contrib/gcc/ansidecl.h b/contrib/gcc/ansidecl.h index d2c8776..ee0aecf 100644 --- a/contrib/gcc/ansidecl.h +++ b/contrib/gcc/ansidecl.h @@ -305,6 +305,15 @@ So instead we use the macro below and test it against specific values. */ # define ATTRIBUTE_NULL_PRINTF_5 ATTRIBUTE_NULL_PRINTF(5, 6) #endif /* ATTRIBUTE_NULL_PRINTF */ + +#ifndef ATTRIBUTE_ALIGNED_ALIGNOF +# if (GCC_VERSION >= 3000) +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m)))) +# else +# define ATTRIBUTE_ALIGNED_ALIGNOF(m) +# endif /* GNUC >= 3.0 */ +#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */ + /* We use __extension__ in some places to suppress -pedantic warnings about GCC extensions. This feature didn't work properly before gcc 2.8. */ diff --git a/contrib/gcc/c-objc-common.c b/contrib/gcc/c-objc-common.c index fe0c0d5..0efa2ad 100644 --- a/contrib/gcc/c-objc-common.c +++ b/contrib/gcc/c-objc-common.c @@ -118,17 +118,12 @@ c_cannot_inline_tree_fn (tree *fnp) } } - if (! DECL_FILE_SCOPE_P (fn)) + if (DECL_LANG_SPECIFIC (fn)->pending_sizes) { - /* If a nested function has pending sizes, we may have already - saved them. */ - if (DECL_LANG_SPECIFIC (fn)->pending_sizes) - { - if (do_warning) - warning ("%Jnested function '%F' can never be inlined because it " - "has possibly saved pending sizes", fn, fn); - goto cannot_inline; - } + if (do_warning) + warning ("%Jfunction '%F' can never be inlined because it has " + "pending sizes", fn, fn); + goto cannot_inline; } return 0; diff --git a/contrib/gcc/c-pch.c b/contrib/gcc/c-pch.c index 8e4b602..4589864 100644 --- a/contrib/gcc/c-pch.c +++ b/contrib/gcc/c-pch.c @@ -428,6 +428,6 @@ c_common_no_more_pch (void) if (cpp_get_callbacks (parse_in)->valid_pch) { cpp_get_callbacks (parse_in)->valid_pch = NULL; - host_hooks.gt_pch_use_address (NULL, 0); + host_hooks.gt_pch_use_address (NULL, 0, -1, 0); } } diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c index c9479f0..42c7b77 100644 --- a/contrib/gcc/c-typeck.c +++ b/contrib/gcc/c-typeck.c @@ -4098,7 +4098,8 @@ digest_init (tree type, tree init, int require_constant) vector constructor is not constant (e.g. {1,2,3,foo()}) then punt below and handle as a constructor. */ if (code == VECTOR_TYPE - && comptypes (TREE_TYPE (inside_init), type, COMPARE_STRICT) + && TREE_CODE (TREE_TYPE (inside_init)) == VECTOR_TYPE + && vector_types_convertible_p (TREE_TYPE (inside_init), type) && TREE_CONSTANT (inside_init)) { if (TREE_CODE (inside_init) == VECTOR_CST @@ -4634,19 +4635,27 @@ push_init_level (int implicit) tree value = NULL_TREE; /* If we've exhausted any levels that didn't have braces, - pop them now. */ - while (constructor_stack->implicit) + pop them now. If implicit == 1, this will have been done in + process_init_element; do not repeat it here because in the case + of excess initializers for an empty aggregate this leads to an + infinite cycle of popping a level and immediately recreating + it. */ + if (implicit != 1) { - if ((TREE_CODE (constructor_type) == RECORD_TYPE - || TREE_CODE (constructor_type) == UNION_TYPE) - && constructor_fields == 0) - process_init_element (pop_init_level (1)); - else if (TREE_CODE (constructor_type) == ARRAY_TYPE - && constructor_max_index - && tree_int_cst_lt (constructor_max_index, constructor_index)) - process_init_element (pop_init_level (1)); - else - break; + while (constructor_stack->implicit) + { + if ((TREE_CODE (constructor_type) == RECORD_TYPE + || TREE_CODE (constructor_type) == UNION_TYPE) + && constructor_fields == 0) + process_init_element (pop_init_level (1)); + else if (TREE_CODE (constructor_type) == ARRAY_TYPE + && constructor_max_index + && tree_int_cst_lt (constructor_max_index, + constructor_index)) + process_init_element (pop_init_level (1)); + else + break; + } } /* Unless this is an explicit brace, we need to preserve previous diff --git a/contrib/gcc/cfgcleanup.c b/contrib/gcc/cfgcleanup.c index 06fb913..7321b07 100644 --- a/contrib/gcc/cfgcleanup.c +++ b/contrib/gcc/cfgcleanup.c @@ -521,7 +521,7 @@ try_forward_edges (int mode, basic_block b) && NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG) break; - if (GET_CODE (insn) == NOTE) + if (insn && GET_CODE (insn) == NOTE) break; /* Do not clean up branches to just past the end of a loop diff --git a/contrib/gcc/combine.c b/contrib/gcc/combine.c index 0a3f381..8f43c23 100644 --- a/contrib/gcc/combine.c +++ b/contrib/gcc/combine.c @@ -10739,7 +10739,7 @@ simplify_comparison (enum rtx_code code, rtx *pop0, rtx *pop1) /* (A - C1) always sign-extends, like C2. */ && num_sign_bit_copies (a, inner_mode) > (unsigned int) (GET_MODE_BITSIZE (inner_mode) - - mode_width - 1))) + - (mode_width - 1)))) { op0 = SUBREG_REG (op0); continue; diff --git a/contrib/gcc/config.gcc b/contrib/gcc/config.gcc index 9c5c193..d22f34b 100644 --- a/contrib/gcc/config.gcc +++ b/contrib/gcc/config.gcc @@ -406,6 +406,12 @@ case ${target} in tm_defines="${tm_defines} FBSD_MAJOR=5" ;; *-*-freebsd6 | *-*-freebsd[6].*) tm_defines="${tm_defines} FBSD_MAJOR=6" ;; + *-*-freebsd7 | *-*-freebsd[7].*) + tm_defines="${tm_defines} FBSD_MAJOR=7" ;; + *-*-freebsd8 | *-*-freebsd[8].*) + tm_defines="${tm_defines} FBSD_MAJOR=8" ;; + *-*-freebsd9 | *-*-freebsd[9].*) + tm_defines="${tm_defines} FBSD_MAJOR=9" ;; *) echo 'Please update *-*-freebsd* in gcc/config.gcc' exit 1 diff --git a/contrib/gcc/config.host b/contrib/gcc/config.host index fa6bced..e4f0357 100644 --- a/contrib/gcc/config.host +++ b/contrib/gcc/config.host @@ -103,7 +103,12 @@ case ${host} in hppa1.0-*-hpux10* | hppa1.1-*-hpux10* | hppa2*-*-hpux10* | \ hppa1.0-*-hpux11* | hppa1.1-*-hpux11* | hppa2*-*-hpux11* | \ hppa*64*-*-hpux11*) - host_xmake_file="pa/x-ada" + out_host_hook_obj=pa-host.o + host_xmake_file=pa/x-hpux + ;; + hppa*-*-linux*) + out_host_hook_obj=pa-host.o + host_xmake_file=pa/x-linux ;; i370-*-opened* | i370-*-mvs* ) # IBM 360/370/390 Architecture host_xm_defines='FATAL_EXIT_CODE=12' @@ -113,6 +118,8 @@ case ${host} in ;; i[34567]86-*-solaris2*) host_xm_defines="SMALL_ARG_MAX" + out_host_hook_obj=host-solaris.o + host_xmake_file=x-solaris ;; i[34567]86-*-sysv4*) # Intel 80386's running System V Release 4 host_xm_defines="SMALL_ARG_MAX" @@ -152,4 +159,12 @@ case ${host} in out_host_hook_obj=host-darwin.o host_xmake_file=rs6000/x-darwin ;; + *-*-solaris2*) + out_host_hook_obj=host-solaris.o + host_xmake_file=x-solaris + ;; + *-*-linux*) + out_host_hook_obj=host-linux.o + host_xmake_file=x-linux + ;; esac diff --git a/contrib/gcc/config.in b/contrib/gcc/config.in index 547dda0..f797190 100644 --- a/contrib/gcc/config.in +++ b/contrib/gcc/config.in @@ -97,6 +97,9 @@ /* Define if your assembler supports the Sun syntax for cmov. */ #undef HAVE_AS_IX86_CMOV_SUN_SYNTAX +/* Define if your assembler supports the lituse_jsrdirect relocation. */ +#undef HAVE_AS_JSRDIRECT_RELOCS + /* Define if your assembler supports .sleb128 and .uleb128. */ #undef HAVE_AS_LEB128 diff --git a/contrib/gcc/config/alpha/alpha.md b/contrib/gcc/config/alpha/alpha.md index c008e1b..cca51ba 100644 --- a/contrib/gcc/config/alpha/alpha.md +++ b/contrib/gcc/config/alpha/alpha.md @@ -967,7 +967,7 @@ (clobber (reg:DI 23)) (clobber (reg:DI 28))] "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS" - "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#" + "#" "&& reload_completed" [(parallel [(set (match_dup 0) (sign_extend:DI (match_dup 3))) @@ -1012,7 +1012,7 @@ (clobber (reg:DI 23)) (clobber (reg:DI 28))] "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS" - "jsr $23,($27),__%E3%J5" + "jsr $23,($27),__%E3%j5" [(set_attr "type" "jsr") (set_attr "length" "4")]) @@ -1036,7 +1036,7 @@ (clobber (reg:DI 23)) (clobber (reg:DI 28))] "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS" - "ldq $27,__%E3($29)\t\t!literal!%#\;jsr $23,($27),__%E3\t\t!lituse_jsr!%#" + "#" "&& reload_completed" [(parallel [(set (match_dup 0) (match_dup 3)) (use (match_dup 0)) @@ -1080,7 +1080,7 @@ (clobber (reg:DI 23)) (clobber (reg:DI 28))] "TARGET_EXPLICIT_RELOCS && ! TARGET_ABI_OPEN_VMS" - "jsr $23,($27),__%E3%J5" + "jsr $23,($27),__%E3%j5" [(set_attr "type" "jsr") (set_attr "length" "4")]) diff --git a/contrib/gcc/config/arm/arm-protos.h b/contrib/gcc/config/arm/arm-protos.h index 2da99b8..0b28e74 100644 --- a/contrib/gcc/config/arm/arm-protos.h +++ b/contrib/gcc/config/arm/arm-protos.h @@ -105,8 +105,10 @@ extern int load_multiple_sequence (rtx *, int, int *, int *, HOST_WIDE_INT *); extern const char *emit_ldm_seq (rtx *, int); extern int store_multiple_sequence (rtx *, int, int *, int *, HOST_WIDE_INT *); extern const char * emit_stm_seq (rtx *, int); -extern rtx arm_gen_load_multiple (int, int, rtx, int, int, int, int, int); -extern rtx arm_gen_store_multiple (int, int, rtx, int, int, int, int, int); +extern rtx arm_gen_load_multiple (int, int, rtx, int, int, + rtx, HOST_WIDE_INT *); +extern rtx arm_gen_store_multiple (int, int, rtx, int, int, + rtx, HOST_WIDE_INT *); extern int arm_gen_movstrqi (rtx *); extern rtx arm_gen_rotated_half_load (rtx); extern enum machine_mode arm_select_cc_mode (RTX_CODE, rtx, rtx); diff --git a/contrib/gcc/config/arm/arm.c b/contrib/gcc/config/arm/arm.c index 9518894..2f0eaed 100644 --- a/contrib/gcc/config/arm/arm.c +++ b/contrib/gcc/config/arm/arm.c @@ -5158,13 +5158,13 @@ multi_register_push (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) rtx arm_gen_load_multiple (int base_regno, int count, rtx from, int up, - int write_back, int unchanging_p, int in_struct_p, - int scalar_p) + int write_back, rtx basemem, HOST_WIDE_INT *offsetp) { + HOST_WIDE_INT offset = *offsetp; int i = 0, j; rtx result; int sign = up ? 1 : -1; - rtx mem; + rtx mem, addr; /* XScale has load-store double instructions, but they have stricter alignment requirements than load-store multiple, so we can not @@ -5202,15 +5202,17 @@ arm_gen_load_multiple (int base_regno, int count, rtx from, int up, for (i = 0; i < count; i++) { - mem = gen_rtx_MEM (SImode, plus_constant (from, i * 4 * sign)); - RTX_UNCHANGING_P (mem) = unchanging_p; - MEM_IN_STRUCT_P (mem) = in_struct_p; - MEM_SCALAR_P (mem) = scalar_p; + addr = plus_constant (from, i * 4 * sign); + mem = adjust_automodify_address (basemem, SImode, addr, offset); emit_move_insn (gen_rtx_REG (SImode, base_regno + i), mem); + offset += 4 * sign; } if (write_back) - emit_move_insn (from, plus_constant (from, count * 4 * sign)); + { + emit_move_insn (from, plus_constant (from, count * 4 * sign)); + *offsetp = offset; + } seq = get_insns (); end_sequence (); @@ -5231,26 +5233,28 @@ arm_gen_load_multiple (int base_regno, int count, rtx from, int up, for (j = 0; i < count; i++, j++) { - mem = gen_rtx_MEM (SImode, plus_constant (from, j * 4 * sign)); - RTX_UNCHANGING_P (mem) = unchanging_p; - MEM_IN_STRUCT_P (mem) = in_struct_p; - MEM_SCALAR_P (mem) = scalar_p; + addr = plus_constant (from, j * 4 * sign); + mem = adjust_automodify_address_nv (basemem, SImode, addr, offset); XVECEXP (result, 0, i) = gen_rtx_SET (VOIDmode, gen_rtx_REG (SImode, base_regno + j), mem); + offset += 4 * sign; } + if (write_back) + *offsetp = offset; + return result; } rtx arm_gen_store_multiple (int base_regno, int count, rtx to, int up, - int write_back, int unchanging_p, int in_struct_p, - int scalar_p) + int write_back, rtx basemem, HOST_WIDE_INT *offsetp) { + HOST_WIDE_INT offset = *offsetp; int i = 0, j; rtx result; int sign = up ? 1 : -1; - rtx mem; + rtx mem, addr; /* See arm_gen_load_multiple for discussion of the pros/cons of ldm/stm usage for XScale. */ @@ -5262,15 +5266,17 @@ arm_gen_store_multiple (int base_regno, int count, rtx to, int up, for (i = 0; i < count; i++) { - mem = gen_rtx_MEM (SImode, plus_constant (to, i * 4 * sign)); - RTX_UNCHANGING_P (mem) = unchanging_p; - MEM_IN_STRUCT_P (mem) = in_struct_p; - MEM_SCALAR_P (mem) = scalar_p; + addr = plus_constant (to, i * 4 * sign); + mem = adjust_automodify_address (basemem, SImode, addr, offset); emit_move_insn (mem, gen_rtx_REG (SImode, base_regno + i)); + offset += 4 * sign; } if (write_back) - emit_move_insn (to, plus_constant (to, count * 4 * sign)); + { + emit_move_insn (to, plus_constant (to, count * 4 * sign)); + *offsetp = offset; + } seq = get_insns (); end_sequence (); @@ -5291,15 +5297,16 @@ arm_gen_store_multiple (int base_regno, int count, rtx to, int up, for (j = 0; i < count; i++, j++) { - mem = gen_rtx_MEM (SImode, plus_constant (to, j * 4 * sign)); - RTX_UNCHANGING_P (mem) = unchanging_p; - MEM_IN_STRUCT_P (mem) = in_struct_p; - MEM_SCALAR_P (mem) = scalar_p; - + addr = plus_constant (to, j * 4 * sign); + mem = adjust_automodify_address_nv (basemem, SImode, addr, offset); XVECEXP (result, 0, i) = gen_rtx_SET (VOIDmode, mem, gen_rtx_REG (SImode, base_regno + j)); + offset += 4 * sign; } + if (write_back) + *offsetp = offset; + return result; } @@ -5307,13 +5314,11 @@ int arm_gen_movstrqi (rtx *operands) { HOST_WIDE_INT in_words_to_go, out_words_to_go, last_bytes; + HOST_WIDE_INT srcoffset, dstoffset; int i; - rtx src, dst; - rtx st_src, st_dst, fin_src, fin_dst; + rtx src, dst, srcbase, dstbase; rtx part_bytes_reg = NULL; rtx mem; - int dst_unchanging_p, dst_in_struct_p, src_unchanging_p, src_in_struct_p; - int dst_scalar_p, src_scalar_p; if (GET_CODE (operands[2]) != CONST_INT || GET_CODE (operands[3]) != CONST_INT @@ -5321,23 +5326,17 @@ arm_gen_movstrqi (rtx *operands) || INTVAL (operands[3]) & 3) return 0; - st_dst = XEXP (operands[0], 0); - st_src = XEXP (operands[1], 0); - - dst_unchanging_p = RTX_UNCHANGING_P (operands[0]); - dst_in_struct_p = MEM_IN_STRUCT_P (operands[0]); - dst_scalar_p = MEM_SCALAR_P (operands[0]); - src_unchanging_p = RTX_UNCHANGING_P (operands[1]); - src_in_struct_p = MEM_IN_STRUCT_P (operands[1]); - src_scalar_p = MEM_SCALAR_P (operands[1]); - - fin_dst = dst = copy_to_mode_reg (SImode, st_dst); - fin_src = src = copy_to_mode_reg (SImode, st_src); + dstbase = operands[0]; + srcbase = operands[1]; + + dst = copy_to_mode_reg (SImode, XEXP (dstbase, 0)); + src = copy_to_mode_reg (SImode, XEXP (srcbase, 0)); in_words_to_go = ARM_NUM_INTS (INTVAL (operands[2])); out_words_to_go = INTVAL (operands[2]) / 4; last_bytes = INTVAL (operands[2]) & 3; - + dstoffset = srcoffset = 0; + if (out_words_to_go != in_words_to_go && ((in_words_to_go - 1) & 3) != 0) part_bytes_reg = gen_rtx_REG (SImode, (in_words_to_go - 1) & 3); @@ -5345,38 +5344,32 @@ arm_gen_movstrqi (rtx *operands) { if (in_words_to_go > 4) emit_insn (arm_gen_load_multiple (0, 4, src, TRUE, TRUE, - src_unchanging_p, - src_in_struct_p, - src_scalar_p)); + srcbase, &srcoffset)); else emit_insn (arm_gen_load_multiple (0, in_words_to_go, src, TRUE, - FALSE, src_unchanging_p, - src_in_struct_p, src_scalar_p)); + FALSE, srcbase, &srcoffset)); if (out_words_to_go) { if (out_words_to_go > 4) emit_insn (arm_gen_store_multiple (0, 4, dst, TRUE, TRUE, - dst_unchanging_p, - dst_in_struct_p, - dst_scalar_p)); + dstbase, &dstoffset)); + else if (out_words_to_go != 1) emit_insn (arm_gen_store_multiple (0, out_words_to_go, dst, TRUE, (last_bytes == 0 ? FALSE : TRUE), - dst_unchanging_p, - dst_in_struct_p, - dst_scalar_p)); + dstbase, &dstoffset)); else { - mem = gen_rtx_MEM (SImode, dst); - RTX_UNCHANGING_P (mem) = dst_unchanging_p; - MEM_IN_STRUCT_P (mem) = dst_in_struct_p; - MEM_SCALAR_P (mem) = dst_scalar_p; + mem = adjust_automodify_address (dstbase, SImode, dst, dstoffset); emit_move_insn (mem, gen_rtx_REG (SImode, 0)); if (last_bytes != 0) - emit_insn (gen_addsi3 (dst, dst, GEN_INT (4))); + { + emit_insn (gen_addsi3 (dst, dst, GEN_INT (4))); + dstoffset += 4; + } } } @@ -5388,20 +5381,12 @@ arm_gen_movstrqi (rtx *operands) if (out_words_to_go) { rtx sreg; - - mem = gen_rtx_MEM (SImode, src); - RTX_UNCHANGING_P (mem) = src_unchanging_p; - MEM_IN_STRUCT_P (mem) = src_in_struct_p; - MEM_SCALAR_P (mem) = src_scalar_p; - emit_move_insn (sreg = gen_reg_rtx (SImode), mem); - emit_move_insn (fin_src = gen_reg_rtx (SImode), plus_constant (src, 4)); - - mem = gen_rtx_MEM (SImode, dst); - RTX_UNCHANGING_P (mem) = dst_unchanging_p; - MEM_IN_STRUCT_P (mem) = dst_in_struct_p; - MEM_SCALAR_P (mem) = dst_scalar_p; + + mem = adjust_automodify_address (srcbase, SImode, src, srcoffset); + sreg = copy_to_reg (mem); + + mem = adjust_automodify_address (dstbase, SImode, dst, dstoffset); emit_move_insn (mem, sreg); - emit_move_insn (fin_dst = gen_reg_rtx (SImode), plus_constant (dst, 4)); in_words_to_go--; if (in_words_to_go) /* Sanity check */ @@ -5413,10 +5398,7 @@ arm_gen_movstrqi (rtx *operands) if (in_words_to_go < 0) abort (); - mem = gen_rtx_MEM (SImode, src); - RTX_UNCHANGING_P (mem) = src_unchanging_p; - MEM_IN_STRUCT_P (mem) = src_in_struct_p; - MEM_SCALAR_P (mem) = src_scalar_p; + mem = adjust_automodify_address (srcbase, SImode, src, srcoffset); part_bytes_reg = copy_to_mode_reg (SImode, mem); } @@ -5434,10 +5416,9 @@ arm_gen_movstrqi (rtx *operands) while (last_bytes) { - mem = gen_rtx_MEM (QImode, plus_constant (dst, last_bytes - 1)); - RTX_UNCHANGING_P (mem) = dst_unchanging_p; - MEM_IN_STRUCT_P (mem) = dst_in_struct_p; - MEM_SCALAR_P (mem) = dst_scalar_p; + mem = adjust_automodify_address (dstbase, QImode, + plus_constant (dst, last_bytes - 1), + dstoffset + last_bytes - 1); emit_move_insn (mem, gen_lowpart (QImode, part_bytes_reg)); if (--last_bytes) @@ -5453,10 +5434,7 @@ arm_gen_movstrqi (rtx *operands) { if (last_bytes > 1) { - mem = gen_rtx_MEM (HImode, dst); - RTX_UNCHANGING_P (mem) = dst_unchanging_p; - MEM_IN_STRUCT_P (mem) = dst_in_struct_p; - MEM_SCALAR_P (mem) = dst_scalar_p; + mem = adjust_automodify_address (dstbase, HImode, dst, dstoffset); emit_move_insn (mem, gen_lowpart (HImode, part_bytes_reg)); last_bytes -= 2; if (last_bytes) @@ -5466,15 +5444,13 @@ arm_gen_movstrqi (rtx *operands) emit_insn (gen_addsi3 (dst, dst, GEN_INT (2))); emit_insn (gen_lshrsi3 (tmp, part_bytes_reg, GEN_INT (16))); part_bytes_reg = tmp; + dstoffset += 2; } } if (last_bytes) { - mem = gen_rtx_MEM (QImode, dst); - RTX_UNCHANGING_P (mem) = dst_unchanging_p; - MEM_IN_STRUCT_P (mem) = dst_in_struct_p; - MEM_SCALAR_P (mem) = dst_scalar_p; + mem = adjust_automodify_address (dstbase, QImode, dst, dstoffset); emit_move_insn (mem, gen_lowpart (QImode, part_bytes_reg)); } } diff --git a/contrib/gcc/config/arm/arm.md b/contrib/gcc/config/arm/arm.md index 57926ba..0a5e647 100644 --- a/contrib/gcc/config/arm/arm.md +++ b/contrib/gcc/config/arm/arm.md @@ -5043,7 +5043,9 @@ (match_operand:SI 1 "" "")) (use (match_operand:SI 2 "" ""))])] "TARGET_ARM" - " +{ + HOST_WIDE_INT offset = 0; + /* Support only fixed point registers. */ if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 14 @@ -5057,11 +5059,9 @@ operands[3] = arm_gen_load_multiple (REGNO (operands[0]), INTVAL (operands[2]), force_reg (SImode, XEXP (operands[1], 0)), - TRUE, FALSE, RTX_UNCHANGING_P(operands[1]), - MEM_IN_STRUCT_P(operands[1]), - MEM_SCALAR_P (operands[1])); - " -) + TRUE, FALSE, operands[1], &offset); + +}) ;; Load multiple with write-back @@ -5165,7 +5165,9 @@ (match_operand:SI 1 "" "")) (use (match_operand:SI 2 "" ""))])] "TARGET_ARM" - " +{ + HOST_WIDE_INT offset = 0; + /* Support only fixed point registers. */ if (GET_CODE (operands[2]) != CONST_INT || INTVAL (operands[2]) > 14 @@ -5179,11 +5181,8 @@ operands[3] = arm_gen_store_multiple (REGNO (operands[1]), INTVAL (operands[2]), force_reg (SImode, XEXP (operands[0], 0)), - TRUE, FALSE, RTX_UNCHANGING_P (operands[0]), - MEM_IN_STRUCT_P(operands[0]), - MEM_SCALAR_P (operands[0])); - " -) + TRUE, FALSE, operands[0], &offset); +}) ;; Store multiple with write-back diff --git a/contrib/gcc/config/host-linux.c b/contrib/gcc/config/host-linux.c new file mode 100644 index 0000000..d5fea9d --- /dev/null +++ b/contrib/gcc/config/host-linux.c @@ -0,0 +1,219 @@ +/* Linux host-specific hook definitions. + Copyright (C) 2004, 2005 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 2, 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. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include <sys/mman.h> +#include <limits.h> +#include "hosthooks.h" +#include "hosthooks-def.h" + + +/* Linux has a feature called exec-shield-randomize that perturbs the + address of non-fixed mapped segments by a (relatively) small amount. + The feature is intended to make it harder to attack the system with + buffer overflow attacks, since every invocation of a program will + have its libraries and data segments at slightly different addresses. + + This feature causes us problems with PCH because it makes it that + much harder to acquire a stable location at which to map our PCH + data file. + + [ The feature causes other points of non-determinism within the + compiler as well, so we'd *really* like to be able to have the + driver disable exec-shield-randomize for the process group, but + that isn't possible at present. ] + + We're going to try several things: + + * Select an architecture specific address as "likely" and see + if that's free. For our 64-bit hosts, we can easily choose + an address in Never Never Land. + + * If exec-shield-randomize is disabled, then just use the + address chosen by mmap in step one. + + * If exec-shield-randomize is enabled, then temporarily allocate + 32M of memory as a buffer, then allocate PCH memory, then + free the buffer. The theory here is that the perturbation is + no more than 16M, and so by allocating our buffer larger than + that we make it considerably more likely that the address will + be free when we want to load the data back. +*/ + +#undef HOST_HOOKS_GT_PCH_GET_ADDRESS +#define HOST_HOOKS_GT_PCH_GET_ADDRESS linux_gt_pch_get_address + +#undef HOST_HOOKS_GT_PCH_USE_ADDRESS +#define HOST_HOOKS_GT_PCH_USE_ADDRESS linux_gt_pch_use_address + +/* For various ports, try to guess a fixed spot in the vm space + that's probably free. */ +#if defined(__alpha) +# define TRY_EMPTY_VM_SPACE 0x10000000000 +#elif defined(__ia64) +# define TRY_EMPTY_VM_SPACE 0x2000000100000000 +#elif defined(__x86_64) +# define TRY_EMPTY_VM_SPACE 0x1000000000 +#elif defined(__i386) +# define TRY_EMPTY_VM_SPACE 0x60000000 +#elif defined(__powerpc__) +# define TRY_EMPTY_VM_SPACE 0x60000000 +#elif defined(__s390x__) +# define TRY_EMPTY_VM_SPACE 0x8000000000 +#elif defined(__s390__) +# define TRY_EMPTY_VM_SPACE 0x60000000 +#elif defined(__sparc__) && defined(__LP64__) +# define TRY_EMPTY_VM_SPACE 0x8000000000 +#elif defined(__sparc__) +# define TRY_EMPTY_VM_SPACE 0x60000000 +#else +# define TRY_EMPTY_VM_SPACE 0 +#endif + +/* Determine a location where we might be able to reliably allocate SIZE + bytes. FD is the PCH file, though we should return with the file + unmapped. */ + +static void * +linux_gt_pch_get_address (size_t size, int fd) +{ + size_t buffer_size = 32 * 1024 * 1024; + void *addr, *buffer; + FILE *f; + bool randomize_on; + + addr = mmap ((void *)TRY_EMPTY_VM_SPACE, size, PROT_READ | PROT_WRITE, + MAP_PRIVATE, fd, 0); + + /* If we failed the map, that means there's *no* free space. */ + if (addr == (void *) MAP_FAILED) + return NULL; + /* Unmap the area before returning. */ + munmap (addr, size); + + /* If we got the exact area we requested, then that's great. */ + if (TRY_EMPTY_VM_SPACE && addr == (void *) TRY_EMPTY_VM_SPACE) + return addr; + + /* If we didn't, then we need to look to see if virtual address + randomization is on. That is recorded in + kernel.randomize_va_space. An older implementation used + kernel.exec-shield-randomize. */ + f = fopen ("/proc/sys/kernel/randomize_va_space", "r"); + if (f == NULL) + f = fopen ("/proc/sys/kernel/exec-shield-randomize", "r"); + randomize_on = false; + if (f != NULL) + { + char buf[100]; + size_t c; + + c = fread (buf, 1, sizeof buf - 1, f); + if (c > 0) + { + buf[c] = '\0'; + randomize_on = (atoi (buf) > 0); + } + fclose (f); + } + + /* If it isn't, then accept the address that mmap selected as fine. */ + if (!randomize_on) + return addr; + + /* Otherwise, we need to try again with buffer space. */ + buffer = mmap (0, buffer_size, PROT_NONE, MAP_PRIVATE | MAP_ANON, -1, 0); + addr = mmap (0, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + if (buffer != (void *) MAP_FAILED) + munmap (buffer, buffer_size); + if (addr == (void *) MAP_FAILED) + return NULL; + munmap (addr, size); + + return addr; +} + +/* Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at + mapping the data at BASE, -1 if we couldn't. + + It's not possibly to reliably mmap a file using MAP_PRIVATE to + a specific START address on either hpux or linux. First we see + if mmap with MAP_PRIVATE works. If it does, we are off to the + races. If it doesn't, we try an anonymous private mmap since the + kernel is more likely to honor the BASE address in anonymous maps. + We then copy the data to the anonymous private map. This assumes + of course that we don't need to change the data in the PCH file + after it is created. + + This approach obviously causes a performance penalty but there is + little else we can do given the current PCH implementation. */ + +static int +linux_gt_pch_use_address (void *base, size_t size, int fd, size_t offset) +{ + void *addr; + + /* We're called with size == 0 if we're not planning to load a PCH + file at all. This allows the hook to free any static space that + we might have allocated at link time. */ + if (size == 0) + return -1; + + /* Try to map the file with MAP_PRIVATE. */ + addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, offset); + + if (addr == base) + return 1; + + if (addr != (void *) MAP_FAILED) + munmap (addr, size); + + /* Try to make an anonymous private mmap at the desired location. */ + addr = mmap (base, size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + + if (addr != base) + { + if (addr != (void *) MAP_FAILED) + munmap (addr, size); + return -1; + } + + if (lseek (fd, offset, SEEK_SET) == (off_t)-1) + return -1; + + while (size) + { + ssize_t nbytes; + + nbytes = read (fd, base, MIN (size, SSIZE_MAX)); + if (nbytes <= 0) + return -1; + base = (char *) base + nbytes; + size -= nbytes; + } + + return 1; +} + + +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/contrib/gcc/config/host-solaris.c b/contrib/gcc/config/host-solaris.c new file mode 100644 index 0000000..4fa7a5b --- /dev/null +++ b/contrib/gcc/config/host-solaris.c @@ -0,0 +1,79 @@ +/* Solaris host-specific hook definitions. + Copyright (C) 2004 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 2, 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. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include <sys/mman.h> +#include "hosthooks.h" +#include "hosthooks-def.h" + + +#undef HOST_HOOKS_GT_PCH_USE_ADDRESS +#define HOST_HOOKS_GT_PCH_USE_ADDRESS sol_gt_pch_use_address + +/* Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at + mapping the data at BASE, -1 if we couldn't. */ + +static int +sol_gt_pch_use_address (void *base, size_t size, int fd, size_t offset) +{ + void *addr; + + /* We're called with size == 0 if we're not planning to load a PCH + file at all. This allows the hook to free any static space that + we might have allocated at link time. */ + if (size == 0) + return -1; + + addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, + fd, offset); + + /* Solaris isn't good about honoring the mmap START parameter + without MAP_FIXED set. Before we give up, search the desired + address space with mincore to see if the space is really free. */ + if (addr != base) + { + size_t page_size = getpagesize(); + char one_byte; + size_t i; + + if (addr != (void *) MAP_FAILED) + munmap (addr, size); + + errno = 0; + for (i = 0; i < size; i += page_size) + if (mincore ((char *)base + i, page_size, (void *)&one_byte) == -1 + && errno == ENOMEM) + continue; /* The page is not mapped. */ + else + break; + + if (i >= size) + addr = mmap (base, size, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, + fd, offset); + } + + return addr == base ? 1 : -1; +} + + +const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/contrib/gcc/config/ia64/hpux.h b/contrib/gcc/config/ia64/hpux.h index f76cbd2..09fb53f 100644 --- a/contrib/gcc/config/ia64/hpux.h +++ b/contrib/gcc/config/ia64/hpux.h @@ -84,13 +84,6 @@ do { \ %{mlp64:-L/usr/lib/hpux64/libp} -lgprof} \ %{!symbolic:-lc}}" -#ifndef CROSS_COMPILE -#undef LIBGCC_SPEC -#define LIBGCC_SPEC \ - "%{shared-libgcc:%{!mlp64:-lgcc_s}%{mlp64:-lgcc_s_hpux64} -lgcc} \ - %{!shared-libgcc:-lgcc}" -#endif - #undef SUBTARGET_SWITCHES #define SUBTARGET_SWITCHES \ { "ilp32", MASK_ILP32, "Generate ILP32 code" }, \ diff --git a/contrib/gcc/config/rs6000/aix51.h b/contrib/gcc/config/rs6000/aix51.h index 278b6a4..863b97f 100644 --- a/contrib/gcc/config/rs6000/aix51.h +++ b/contrib/gcc/config/rs6000/aix51.h @@ -197,7 +197,3 @@ do { \ #undef LD_INIT_SWITCH #define LD_INIT_SWITCH "-binitfini" -/* AIX 5.1 has the float and long double forms of math functions. */ -#undef TARGET_C99_FUNCTIONS -#define TARGET_C99_FUNCTIONS 1 - diff --git a/contrib/gcc/config/rs6000/host-darwin.c b/contrib/gcc/config/rs6000/host-darwin.c index 7e80556..d04270c 100644 --- a/contrib/gcc/config/rs6000/host-darwin.c +++ b/contrib/gcc/config/rs6000/host-darwin.c @@ -1,5 +1,5 @@ /* Darwin/powerpc host-specific hook definitions. - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -137,22 +137,18 @@ darwin_rs6000_extra_signals (void) fatal_error ("While setting up signal handler: %m"); } -static void * darwin_rs6000_gt_pch_get_address (size_t); -static bool darwin_rs6000_gt_pch_use_address (void *, size_t); - #undef HOST_HOOKS_GT_PCH_GET_ADDRESS #define HOST_HOOKS_GT_PCH_GET_ADDRESS darwin_rs6000_gt_pch_get_address #undef HOST_HOOKS_GT_PCH_USE_ADDRESS #define HOST_HOOKS_GT_PCH_USE_ADDRESS darwin_rs6000_gt_pch_use_address - /* Yes, this is really supposed to work. */ static char pch_address_space[1024*1024*1024] __attribute__((aligned (4096))); /* Return the address of the PCH address space, if the PCH will fit in it. */ static void * -darwin_rs6000_gt_pch_get_address (size_t sz) +darwin_rs6000_gt_pch_get_address (size_t sz, int fd ATTRIBUTE_UNUSED) { if (sz <= sizeof (pch_address_space)) return pch_address_space; @@ -163,18 +159,19 @@ darwin_rs6000_gt_pch_get_address (size_t sz) /* Check ADDR and SZ for validity, and deallocate (using munmap) that part of pch_address_space beyond SZ. */ -static bool -darwin_rs6000_gt_pch_use_address (void *addr, size_t sz) +static int +darwin_rs6000_gt_pch_use_address (void *addr, size_t sz, int fd, size_t off) { const size_t pagesize = getpagesize(); - bool result; + void *mmap_result; + int ret; if ((size_t)pch_address_space % pagesize != 0 || sizeof (pch_address_space) % pagesize != 0) abort (); - result = (addr == pch_address_space && sz <= sizeof (pch_address_space)); - if (! result) + ret = (addr == pch_address_space && sz <= sizeof (pch_address_space)); + if (! ret) sz = 0; /* Round the size to a whole page size. Normally this is a no-op. */ @@ -183,7 +180,22 @@ darwin_rs6000_gt_pch_use_address (void *addr, size_t sz) if (munmap (pch_address_space + sz, sizeof (pch_address_space) - sz) != 0) fatal_error ("couldn't unmap pch_address_space: %m\n"); - return result; + if (ret) + { + mmap_result = mmap (addr, sz, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, + fd, off); + + /* The file might not be mmap-able. */ + ret = mmap_result != (void *) MAP_FAILED; + + /* Sanity check for broken MAP_FIXED. */ + if (ret && mmap_result != addr) + abort (); + } + + return ret; } + const struct host_hooks host_hooks = HOST_HOOKS_INITIALIZER; diff --git a/contrib/gcc/config/rs6000/linux64.h b/contrib/gcc/config/rs6000/linux64.h index 013e23a..84e13a1 100644 --- a/contrib/gcc/config/rs6000/linux64.h +++ b/contrib/gcc/config/rs6000/linux64.h @@ -244,6 +244,12 @@ ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \ : MAX ((COMPUTED), (SPECIFIED))) +/* Use the default for compiling target libs. */ +#ifdef IN_TARGET_LIBS +#undef TARGET_ALIGN_NATURAL +#define TARGET_ALIGN_NATURAL 1 +#endif + /* Indicate that jump tables go in the text section. */ #undef JUMP_TABLES_IN_TEXT_SECTION #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT diff --git a/contrib/gcc/config/rs6000/rs6000-protos.h b/contrib/gcc/config/rs6000/rs6000-protos.h index 3d17162..3303ecd 100644 --- a/contrib/gcc/config/rs6000/rs6000-protos.h +++ b/contrib/gcc/config/rs6000/rs6000-protos.h @@ -105,7 +105,7 @@ extern int registers_ok_for_quad_peep (rtx, rtx); extern int addrs_ok_for_quad_peep (rtx, rtx); extern bool gpr_or_gpr_p (rtx, rtx); extern enum reg_class secondary_reload_class (enum reg_class, - enum machine_mode, rtx, int); + enum machine_mode, rtx); extern int ccr_bit (rtx, int); extern int extract_MB (rtx); extern int extract_ME (rtx); diff --git a/contrib/gcc/config/rs6000/rs6000.c b/contrib/gcc/config/rs6000/rs6000.c index 1ffd4da..ea35843 100644 --- a/contrib/gcc/config/rs6000/rs6000.c +++ b/contrib/gcc/config/rs6000/rs6000.c @@ -2497,43 +2497,6 @@ word_offset_memref_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) return (off % 4) == 0; } -/* Return true if operand is a (MEM (PLUS (REG) (offset))) where offset - is not divisible by four. */ - -int -invalid_gpr_mem (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) -{ - rtx addr; - long off; - - if (GET_CODE (op) != MEM) - return 0; - - addr = XEXP (op, 0); - if (GET_CODE (addr) != PLUS - || GET_CODE (XEXP (addr, 0)) != REG - || GET_CODE (XEXP (addr, 1)) != CONST_INT) - return 0; - - off = INTVAL (XEXP (addr, 1)); - return (off & 3) != 0; -} - -/* Return true if operand is a hard register that can be used as a base - register. */ - -int -base_reg_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED) -{ - unsigned int regno; - - if (!REG_P (op)) - return 0; - - regno = REGNO (op); - return regno != 0 && regno <= 31; -} - /* Return true if either operand is a general purpose register. */ bool @@ -2658,16 +2621,18 @@ legitimate_offset_address_p (enum machine_mode mode, rtx x, int strict) case DFmode: case DImode: - /* Both DFmode and DImode may end up in gprs. If gprs are 32-bit, - then we need to load/store at both offset and offset+4. */ - if (!TARGET_POWERPC64) + if (mode == DFmode || !TARGET_POWERPC64) extra = 4; + else if (offset & 3) + return false; break; case TFmode: case TImode: - if (!TARGET_POWERPC64) + if (mode == TFmode || !TARGET_POWERPC64) extra = 12; + else if (offset & 3) + return false; else extra = 8; break; @@ -2989,7 +2954,7 @@ rs6000_legitimize_tls_address (rtx addr, enum tls_model model) rtx r3, got, tga, tmp1, tmp2, eqv; if (TARGET_64BIT) - got = gen_rtx_REG (Pmode, TOC_REGISTER); + got = gen_rtx_REG (Pmode, 2); else { if (flag_pic == 1) @@ -3206,6 +3171,26 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, return x; } #endif + + /* Force ld/std non-word aligned offset into base register by wrapping + in offset 0. */ + if (GET_CODE (x) == PLUS + && GET_CODE (XEXP (x, 0)) == REG + && REGNO (XEXP (x, 0)) < 32 + && REG_MODE_OK_FOR_BASE_P (XEXP (x, 0), mode) + && GET_CODE (XEXP (x, 1)) == CONST_INT + && (INTVAL (XEXP (x, 1)) & 3) != 0 + && GET_MODE_SIZE (mode) >= UNITS_PER_WORD + && TARGET_POWERPC64) + { + x = gen_rtx_PLUS (GET_MODE (x), x, GEN_INT (0)); + push_reload (XEXP (x, 0), NULL_RTX, &XEXP (x, 0), NULL, + BASE_REG_CLASS, GET_MODE (x), VOIDmode, 0, 0, + opnum, (enum reload_type) type); + *win = 1; + return x; + } + if (GET_CODE (x) == PLUS && GET_CODE (XEXP (x, 0)) == REG && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER @@ -3240,6 +3225,7 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, *win = 1; return x; } + #if TARGET_MACHO if (GET_CODE (x) == SYMBOL_REF && DEFAULT_ABI == ABI_DARWIN @@ -3269,6 +3255,7 @@ rs6000_legitimize_reload_address (rtx x, enum machine_mode mode, return x; } #endif + if (TARGET_TOC && constant_pool_expr_p (x) && ASM_OUTPUT_SPECIAL_POOL_ENTRY_P (get_pool_constant (x), mode)) @@ -4369,9 +4356,10 @@ function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, if (mode == VOIDmode) { if (abi == ABI_V4 - && cum->nargs_prototype < 0 && (cum->call_cookie & CALL_LIBCALL) == 0 - && (cum->prototype || TARGET_NO_PROTOTYPE)) + && (cum->stdarg + || (cum->nargs_prototype < 0 + && (cum->prototype || TARGET_NO_PROTOTYPE)))) { /* For the SPE, we need to crxor CR6 always. */ if (TARGET_SPE_ABI) @@ -7856,7 +7844,7 @@ expand_block_move (rtx operands[]) mode = SImode; gen_func.mov = gen_movsi; } - else if (bytes == 2 && (align >= 2 || ! STRICT_ALIGNMENT)) + else if (bytes >= 2 && (align >= 2 || ! STRICT_ALIGNMENT)) { /* move 2 bytes */ move_bytes = 2; mode = HImode; @@ -8725,14 +8713,12 @@ addrs_ok_for_quad_peep (rtx addr1, rtx addr2) /* Return the register class of a scratch register needed to copy IN into or out of a register in CLASS in MODE. If it can be done directly, - NO_REGS is returned. INP is nonzero if we are loading the reg, zero - for storing. */ + NO_REGS is returned. */ enum reg_class secondary_reload_class (enum reg_class class, enum machine_mode mode, - rtx in, - int inp) + rtx in) { int regno; @@ -8757,14 +8743,6 @@ secondary_reload_class (enum reg_class class, return BASE_REGS; } - /* A 64-bit gpr load or store using an offset that isn't a multiple of - four needs a secondary reload. */ - if (TARGET_POWERPC64 - && GET_MODE_UNIT_SIZE (mode) >= 8 - && (!inp || class != BASE_REGS) - && invalid_gpr_mem (in, mode)) - return BASE_REGS; - if (GET_CODE (in) == REG) { regno = REGNO (in); @@ -11620,6 +11598,8 @@ uses_TOC (void) rtx create_TOC_reference (rtx symbol) { + if (no_new_pseudos) + regs_ever_live[TOC_REGISTER] = 1; return gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, TOC_REGISTER), gen_rtx_CONST (Pmode, diff --git a/contrib/gcc/config/rs6000/rs6000.h b/contrib/gcc/config/rs6000/rs6000.h index f1ad896..01a97da 100644 --- a/contrib/gcc/config/rs6000/rs6000.h +++ b/contrib/gcc/config/rs6000/rs6000.h @@ -1492,11 +1492,8 @@ enum reg_class or out of a register in CLASS in MODE. If it can be done directly, NO_REGS is returned. */ -#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, IN) \ - secondary_reload_class (CLASS, MODE, IN, 1) - -#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, IN) \ - secondary_reload_class (CLASS, MODE, IN, 0) +#define SECONDARY_RELOAD_CLASS(CLASS, MODE, IN) \ + secondary_reload_class (CLASS, MODE, IN) /* If we are copying between FP or AltiVec registers and anything else, we need a memory location. */ @@ -2671,8 +2668,6 @@ extern char rs6000_reg_names[][8]; /* register names (0 vs. %r0). */ {"lwa_operand", {SUBREG, MEM, REG}}, \ {"volatile_mem_operand", {MEM}}, \ {"offsettable_mem_operand", {MEM}}, \ - {"invalid_gpr_mem", {MEM}}, \ - {"base_reg_operand", {REG}}, \ {"mem_or_easy_const_operand", {SUBREG, MEM, CONST_DOUBLE}}, \ {"add_operand", {SUBREG, REG, CONST_INT}}, \ {"non_add_cint_operand", {CONST_INT}}, \ diff --git a/contrib/gcc/config/rs6000/rs6000.md b/contrib/gcc/config/rs6000/rs6000.md index 3b062ce..0e242d4 100644 --- a/contrib/gcc/config/rs6000/rs6000.md +++ b/contrib/gcc/config/rs6000/rs6000.md @@ -5236,7 +5236,7 @@ (set (match_dup 0) (plus:DI (match_dup 0) (const_int 2047))) (set (match_dup 4) (compare:CCUNS (match_dup 3) - (const_int 3))) + (const_int 2))) (set (match_dup 0) (ior:DI (match_dup 0) (match_dup 1))) (parallel [(set (match_dup 0) (and:DI (match_dup 0) @@ -7839,8 +7839,8 @@ }") (define_insn "*movsf_hardfloat" - [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!r,!r") - (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,G,Fn"))] + [(set (match_operand:SF 0 "nonimmediate_operand" "=!r,!r,m,f,f,m,!cl,!q,!r,!h,!r,!r") + (match_operand:SF 1 "input_operand" "r,m,r,f,m,f,r,r,h,0,G,Fn"))] "(gpc_reg_operand (operands[0], SFmode) || gpc_reg_operand (operands[1], SFmode)) && (TARGET_HARD_FLOAT && TARGET_FPRS)" @@ -7854,10 +7854,11 @@ mt%0 %1 mt%0 %1 mf%1 %0 + {cror 0,0,0|nop} # #" - [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*") - (set_attr "length" "4,4,4,4,4,4,4,4,4,4,8")]) + [(set_attr "type" "*,load,store,fp,fpload,fpstore,*,mtjmpr,*,*,*,*") + (set_attr "length" "4,4,4,4,4,4,4,4,4,4,4,8")]) (define_insn "*movsf_softfloat" [(set (match_operand:SF 0 "nonimmediate_operand" "=r,cl,q,r,r,m,r,r,r,r,r,*h") @@ -8114,67 +8115,26 @@ ; 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,b,!r,f,f,m,!cl,!r,!r,!r,!r") - (match_operand:DF 1 "input_operand" "r,Y,m,r,f,m,f,r,h,G,H,F"))] + [(set (match_operand:DF 0 "nonimmediate_operand" "=Y,r,!r,f,f,m,!cl,!r,!h,!r,!r,!r") + (match_operand:DF 1 "input_operand" "r,Y,r,f,m,f,r,h,0,G,H,F"))] "TARGET_POWERPC64 && TARGET_HARD_FLOAT && TARGET_FPRS && (gpc_reg_operand (operands[0], DFmode) || gpc_reg_operand (operands[1], DFmode))" "@ std%U0%X0 %1,%0 ld%U1%X1 %0,%1 - # mr %0,%1 fmr %0,%1 lfd%U1%X1 %0,%1 stfd%U0%X0 %1,%0 mt%0 %1 mf%1 %0 + {cror 0,0,0|nop} # # #" - [(set_attr "type" "store,load,load,*,fp,fpload,fpstore,mtjmpr,*,*,*,*") - (set_attr "length" "4,4,8,4,4,4,4,4,4,8,12,16")]) - -(define_split - [(set (match_operand:DF 0 "base_reg_operand" "") - (match_operand:DF 1 "invalid_gpr_mem" ""))] - "TARGET_POWERPC64 && no_new_pseudos" - [(set (match_dup 2) (match_dup 3)) - (set (match_dup 0) (match_dup 4))] - " -{ - operands[2] = gen_rtx_REG (Pmode, REGNO (operands[0])); - operands[3] = XEXP (operands[1], 0); - operands[4] = replace_equiv_address (operands[1], operands[2]); -}") - -(define_expand "reload_outdf" - [(parallel [(match_operand:DF 0 "invalid_gpr_mem" "") - (match_operand:DF 1 "register_operand" "") - (match_operand:DI 2 "register_operand" "=&b")])] - "TARGET_POWERPC64" -{ - if (!TARGET_64BIT) - operands[2] = gen_rtx_REG (SImode, REGNO (operands[2])); - emit_move_insn (operands[2], XEXP (operands[0], 0)); - operands[0] = replace_equiv_address (operands[0], operands[2]); - emit_move_insn (operands[0], operands[1]); - DONE; -}) - -(define_expand "reload_indf" - [(parallel [(match_operand:DF 0 "register_operand" "") - (match_operand:DF 1 "invalid_gpr_mem" "") - (match_operand:DI 2 "register_operand" "=&b")])] - "TARGET_POWERPC64" -{ - if (!TARGET_64BIT) - operands[2] = gen_rtx_REG (SImode, REGNO (operands[2])); - emit_move_insn (operands[2], XEXP (operands[1], 0)); - operands[1] = replace_equiv_address (operands[1], operands[2]); - emit_move_insn (operands[0], operands[1]); - DONE; -}) + [(set_attr "type" "store,load,*,fp,fpload,fpstore,mtjmpr,*,*,*,*,*") + (set_attr "length" "4,4,4,4,4,4,4,4,4,8,12,16")]) (define_insn "*movdf_softfloat64" [(set (match_operand:DF 0 "nonimmediate_operand" "=r,Y,r,cl,r,r,r,r,*h") @@ -8191,7 +8151,7 @@ # # # - nop" + {cror 0,0,0|nop}" [(set_attr "type" "load,store,*,*,*,*,*,*,*") (set_attr "length" "4,4,4,4,4,8,12,16,4")]) @@ -8519,15 +8479,14 @@ }") (define_insn "*movdi_internal64" - [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,b,r,r,r,r,r,??f,f,m,r,*h,*h") - (match_operand:DI 1 "input_operand" "r,Y,m,r,I,L,nF,R,f,m,f,*h,r,0"))] + [(set (match_operand:DI 0 "nonimmediate_operand" "=Y,r,r,r,r,r,r,??f,f,m,r,*h,*h") + (match_operand:DI 1 "input_operand" "r,Y,r,I,L,nF,R,f,m,f,*h,r,0"))] "TARGET_POWERPC64 && (gpc_reg_operand (operands[0], DImode) || gpc_reg_operand (operands[1], DImode))" "@ std%U0%X0 %1,%0 ld%U1%X1 %0,%1 - # mr %0,%1 li %0,%1 lis %0,%v1 @@ -8539,51 +8498,8 @@ mf%1 %0 mt%0 %1 {cror 0,0,0|nop}" - [(set_attr "type" "store,load,load,*,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*") - (set_attr "length" "4,4,8,4,4,4,20,4,4,4,4,4,4,4")]) - -(define_split - [(set (match_operand:DI 0 "base_reg_operand" "") - (match_operand:DI 1 "invalid_gpr_mem" ""))] - "TARGET_POWERPC64 && no_new_pseudos" - [(set (match_dup 2) (match_dup 3)) - (set (match_dup 0) (match_dup 4))] - " -{ - operands[2] = operands[0]; - if (!TARGET_64BIT) - operands[2] = gen_rtx_REG (SImode, REGNO (operands[0])); - operands[3] = XEXP (operands[1], 0); - operands[4] = replace_equiv_address (operands[1], operands[2]); -}") - -(define_expand "reload_outdi" - [(parallel [(match_operand:DI 0 "invalid_gpr_mem" "") - (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "register_operand" "=&b")])] - "TARGET_POWERPC64" -{ - if (!TARGET_64BIT) - operands[2] = gen_rtx_REG (SImode, REGNO (operands[2])); - emit_move_insn (operands[2], XEXP (operands[0], 0)); - operands[0] = replace_equiv_address (operands[0], operands[2]); - emit_move_insn (operands[0], operands[1]); - DONE; -}) - -(define_expand "reload_indi" - [(parallel [(match_operand:DI 0 "register_operand" "") - (match_operand:DI 1 "invalid_gpr_mem" "") - (match_operand:DI 2 "register_operand" "=&b")])] - "TARGET_POWERPC64" -{ - if (!TARGET_64BIT) - operands[2] = gen_rtx_REG (SImode, REGNO (operands[2])); - emit_move_insn (operands[2], XEXP (operands[1], 0)); - operands[1] = replace_equiv_address (operands[1], operands[2]); - emit_move_insn (operands[0], operands[1]); - DONE; -}) + [(set_attr "type" "store,load,*,*,*,*,*,fp,fpload,fpstore,mfjmpr,mtjmpr,*") + (set_attr "length" "4,4,4,4,4,20,4,4,4,4,4,4,4")]) ;; immediate value valid for a single instruction hiding in a const_double (define_insn "" diff --git a/contrib/gcc/config/rs6000/sysv4.h b/contrib/gcc/config/rs6000/sysv4.h index 57af869..d367aa8 100644 --- a/contrib/gcc/config/rs6000/sysv4.h +++ b/contrib/gcc/config/rs6000/sysv4.h @@ -1,6 +1,6 @@ /* Target definitions for GNU compiler for PowerPC running System V.4 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005 Free Software Foundation, Inc. Contributed by Cygnus Support. This file is part of GCC. @@ -123,8 +123,10 @@ extern const char *rs6000_tls_size_string; /* For -mtls-size= */ { "no-toc", 0, N_("no description yet") }, \ { "toc", MASK_MINIMAL_TOC, N_("no description yet") }, \ { "full-toc", MASK_MINIMAL_TOC, N_("no description yet") }, \ - { "prototype", MASK_PROTOTYPE, N_("no description yet") }, \ - { "no-prototype", -MASK_PROTOTYPE, N_("no description yet") }, \ + { "prototype", MASK_PROTOTYPE, \ + N_("Assume all variable arg functions are prototyped") }, \ + { "no-prototype", -MASK_PROTOTYPE, \ + N_("Non-prototyped functions might take a variable number of args") }, \ { "no-traceback", 0, N_("no description yet") }, \ { "eabi", MASK_EABI, N_("Use EABI") }, \ { "no-eabi", -MASK_EABI, N_("Don't use EABI") }, \ @@ -1354,8 +1356,6 @@ ncrtn.o%s" ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \ : DW_EH_PE_absptr) -#define TARGET_ASM_EXCEPTION_SECTION readonly_data_section - #define DOUBLE_INT_ASM_OP "\t.quad\t" /* Generate entries in .fixup for relocatable addresses. */ diff --git a/contrib/gcc/config/sparc/gmon-sol2.c b/contrib/gcc/config/sparc/gmon-sol2.c index 9f9f019..aeead89 100644 --- a/contrib/gcc/config/sparc/gmon-sol2.c +++ b/contrib/gcc/config/sparc/gmon-sol2.c @@ -267,8 +267,7 @@ _mcleanup(void) * -- [eichin:19920702.1107EST] */ -static void internal_mcount (char *, unsigned short *) - __attribute__ ((__unused__)); +static void internal_mcount (char *, unsigned short *) __attribute__ ((used)); /* i7 == last ret, -> frompcindex */ /* o7 == current ret, -> selfpc */ diff --git a/contrib/gcc/config/sparc/sol2-gas-bi.h b/contrib/gcc/config/sparc/sol2-gas-bi.h index 88b3954..bea2b3c 100644 --- a/contrib/gcc/config/sparc/sol2-gas-bi.h +++ b/contrib/gcc/config/sparc/sol2-gas-bi.h @@ -3,3 +3,9 @@ #undef AS_SPARC64_FLAG #define AS_SPARC64_FLAG "-TSO -64 -Av9" + +/* Emit a DTP-relative reference to a TLS variable. */ +#ifdef HAVE_AS_TLS +#define ASM_OUTPUT_DWARF_DTPREL(FILE, SIZE, X) \ + sparc_output_dwarf_dtprel (FILE, SIZE, X) +#endif diff --git a/contrib/gcc/config/sparc/sol2.h b/contrib/gcc/config/sparc/sol2.h index cbf914e..e5ed818 100644 --- a/contrib/gcc/config/sparc/sol2.h +++ b/contrib/gcc/config/sparc/sol2.h @@ -84,7 +84,7 @@ Boston, MA 02111-1307, USA. */ #undef ASM_GENERATE_INTERNAL_LABEL #define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \ - sprintf ((LABEL), "*.L%s%ld", (PREFIX), (long)(NUM)) + sprintf ((LABEL), "*.L%s%lu", (PREFIX), (unsigned long)(NUM)) /* The native TLS-enabled assembler requires the directive #tls_object to be put on objects in TLS sections (as of v7.1). This is not @@ -113,6 +113,12 @@ Boston, MA 02111-1307, USA. */ } \ while (0) +/* The Solaris assembler cannot grok r_tls_dtpoff. This is + a kludge as ASM_OUTPUT_DWARF_DTPREL is defined in sparc.h, + undefined here and defined again in sol2-gas-bi.h. */ +#ifdef HAVE_AS_TLS +#undef ASM_OUTPUT_DWARF_DTPREL +#endif #undef ENDFILE_SPEC diff --git a/contrib/gcc/config/sparc/sparc.c b/contrib/gcc/config/sparc/sparc.c index 0b07e46..86524cc 100644 --- a/contrib/gcc/config/sparc/sparc.c +++ b/contrib/gcc/config/sparc/sparc.c @@ -2946,26 +2946,34 @@ eligible_for_epilogue_delay (rtx trial, int slot) int tls_call_delay (rtx trial) { - rtx pat, unspec; + rtx pat; /* Binutils allows - call __tls_get_addr, %tgd_call (foo) - add %l7, %o0, %o0, %tgd_add (foo) + call __tls_get_addr, %tgd_call (foo) + add %l7, %o0, %o0, %tgd_add (foo) while Sun as/ld does not. */ if (TARGET_GNU_TLS || !TARGET_TLS) return 1; pat = PATTERN (trial); - if (GET_CODE (pat) != SET || GET_CODE (SET_DEST (pat)) != PLUS) - return 1; - unspec = XEXP (SET_DEST (pat), 1); - if (GET_CODE (unspec) != UNSPEC - || (XINT (unspec, 1) != UNSPEC_TLSGD - && XINT (unspec, 1) != UNSPEC_TLSLDM)) - return 1; + /* We must reject tgd_add{32|64}, i.e. + (set (reg) (plus (reg) (unspec [(reg) (symbol_ref)] UNSPEC_TLSGD))) + and tldm_add{32|64}, i.e. + (set (reg) (plus (reg) (unspec [(reg) (symbol_ref)] UNSPEC_TLSLDM))) + for Sun as/ld. */ + if (GET_CODE (pat) == SET + && GET_CODE (SET_SRC (pat)) == PLUS) + { + rtx unspec = XEXP (SET_SRC (pat), 1); - return 0; + if (GET_CODE (unspec) == UNSPEC + && (XINT (unspec, 1) == UNSPEC_TLSGD + || XINT (unspec, 1) == UNSPEC_TLSLDM)) + return 0; + } + + return 1; } /* Return nonzero if TRIAL can go into the sibling call diff --git a/contrib/gcc/config/sparc/sparc.h b/contrib/gcc/config/sparc/sparc.h index 3202359..9f72bc8 100644 --- a/contrib/gcc/config/sparc/sparc.h +++ b/contrib/gcc/config/sparc/sparc.h @@ -1892,7 +1892,7 @@ extern GTY(()) rtx sparc_compare_op1; case of a global register variable occupying more than one register we prefix the second and following registers with .gnu.part1. etc. */ -extern char sparc_hard_reg_printed[8]; +extern GTY(()) char sparc_hard_reg_printed[8]; #ifdef HAVE_AS_REGISTER_PSEUDO_OP #define ASM_DECLARE_REGISTER_GLOBAL(FILE, DECL, REGNO, NAME) \ diff --git a/contrib/gcc/config/x-solaris b/contrib/gcc/config/x-solaris new file mode 100644 index 0000000..782f4a3 --- /dev/null +++ b/contrib/gcc/config/x-solaris @@ -0,0 +1,4 @@ +host-solaris.o : $(srcdir)/config/host-solaris.c $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h hosthooks.h hosthooks-def.h + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/host-solaris.c diff --git a/contrib/gcc/configure.ac b/contrib/gcc/configure.ac index 37f2dee..d9151dd 100644 --- a/contrib/gcc/configure.ac +++ b/contrib/gcc/configure.ac @@ -2327,6 +2327,14 @@ case "$target" in lda $29, 0($29) !gpdisp!3],, [AC_DEFINE(HAVE_AS_EXPLICIT_RELOCS, 1, [Define if your assembler supports explicit relocations.])]) + gcc_GAS_CHECK_FEATURE([jsrdirect relocation support], + gcc_cv_as_alpha_jsrdirect_relocs, [2,16,90],, +[ .set nomacro + .text + ldq $27, a($29) !literal!1 + jsr $26, ($27), a !lituse_jsrdirect!1],, + [AC_DEFINE(HAVE_AS_JSRDIRECT_RELOCS, 1, + [Define if your assembler supports the lituse_jsrdirect relocation.])]) ;; cris-*-*) diff --git a/contrib/gcc/coverage.c b/contrib/gcc/coverage.c index 395c1e4..85ba608 100644 --- a/contrib/gcc/coverage.c +++ b/contrib/gcc/coverage.c @@ -172,8 +172,8 @@ read_counts_file (void) GCOV_UNSIGNED2STRING (v, tag); GCOV_UNSIGNED2STRING (e, GCOV_VERSION); - warning ("`%s' is version `%.4s', expected version `%.4s'", - da_file_name, v, e); + warning ("`%s' is version `%.*s', expected version `%.*s'", + da_file_name, 4, v, 4, e); gcov_close (); return; } diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog index a40a034..198fc90 100644 --- a/contrib/gcc/cp/ChangeLog +++ b/contrib/gcc/cp/ChangeLog @@ -1,3 +1,466 @@ +2006-03-05 Release Manager + + * GCC 3.4.6 released. + +2006-02-23 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/26291 + * decl.c (grok_op_properties): Check for ellipsis in arguments of + operators. + +2006-02-08 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/26070 + * decl.c (grokdeclarator): Clear RID_STATIC together with staticp. + +2006-02-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-12-22 Mark Mitchell <mark@codesourcery.com> + + PR c++/25369 + * pt.c (tsubst_copy): Call mark_used on the member referenced by an + OFFSET_REF. + * decl2.c (mark_used): Accept BASELINKs. + +2006-02-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-12-19 Mark Mitchell <mark@codesourcery.com> + + PR c++/24915 + * class.c (add_method): Do not treat templates as identical unless + their return types are the same. + +2006-02-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-12-19 Mark Mitchell <mark@codesourcery.com> + + PR c++/24278 + * init.c (expand_member_init): Print messages about baseclasses + using %T rather than %D. + +2006-01-24 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/16829 + * decl.c (start_preparsed_function): Check default arguments + unconditionally. + * name-lookup.c (pushdecl_maybe_friend): Check default arguments + of all functions and function templates. + * parser.c (cp_parser_late_parsing_default_args): Check default + arguments. + * decl2.c (check_default_args): Set missing default arguments to + error_mark_node. + +2006-01-19 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/25854 + * pt.c (maybe_process_partial_specialization): Return early on + error_mark_node. + +2005-12-19 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/20552 + Backport: + 2004-03-08 Mark Mitchell <mark@codesourcery.com> + + * decl.c (duplicate_decls): Don't check IDENTIFIER_ERROR_LOCUS. + +2005-12-07 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/19397 + PR c++/19762 + PR c++/19764 + * parser.c (cp_parser_declarator_id): Check for error_mark_node + before building a SCOPE_REF. + +2005-12-07 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-10-20 Mark Mitchell <mark@codesourcery.com> + + PR c++/22618 + * search.c (accessible_p): Check access in the outermost set of + template parameters. + +2005-12-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-10-18 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/21383 + * name-lookup.c (arg_assoc): Template args can be null in a + template-id-expr. + +2005-12-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-10-13 Mark Mitchell <mark@codesourcery.com> + + PR c++/22352 + * pt.c (tsubst_template_parms): Set processing_template_decl while + processing the parameters. + (tsubst_decl): Set processing_template_decl when substituting into + a TEMPLATE_DECL. + +2005-12-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-10-13 Mark Mitchell <mark@codesourcery.com> + + PR c++/22464 + * semantics.c (finish_id_expression): Issue errors about uses of + local variables in containing functions even in templates. + +2005-12-05 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2005-10-13 Mark Mitchell <mark@codesourcery.com> + + PR c++/23307 + * pt.c (push_template_decl_real): Complain about attempts to + declare template variables. + +2005-11-30 Release Manager + + * GCC 3.4.5 released. + +2005-11-23 Jakub Jelinek <jakub@redhat.com> + + PR c++/21983 + * class.c (find_final_overrider): Move diagnostic about no unique final + overrider to... + (update_vtable_entry_for_fn): ... here. + +2005-11-15 Jason Merrill <jason@redhat.com> + + PR c++/24580 + * method.c (locate_copy): Also use skip_artificial_parms here. + (synthesize_exception_spec): Use CLASS_TYPE_P rather than checking + for RECORD_TYPE. + +2005-11-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport from mainline: + 2005-10-12 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/23797 + * parser.c (cp_parser_functional_cast): Cope when TYPE is not a + TYPE_DECL. Use dependent_type_p to check type. + * pt.c (uses_template_parms_p): Use dependent_type_p for a + TYPE_DECL. + (type_dependent_expression_p): Assert we've not been given a + TYPE_DECL. + +2005-11-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/19253 + PR c++/22172 + Backport from mainline: + 2005-11-02 Mark Mitchell <mark@codesourcery.com> + + * parser.c (cp_parser_postfix_expression): Use + cp_parser_elaborated_type_specifier to handle typename-types in + functional casts. + (cp_parser_enclosed_argument_list): Skip ahead to the end of the + template argument list if the closing ">" is not found. + +2005-11-14 Jason Merrill <jason@redhat.com> + + PR c++/24580 + * method.c (locate_ctor): Skip all artificial parms, not just + 'this'. + +2005-10-28 Josh Conner <jconner@apple.com> + + PR c++/22153 + * parser.c (cp_parser_member_declaration): Detect and handle + a template specialization. + +2005-10-20 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/22508 + * init.c (build_new_1): Remove misleading comment. + +2005-10-12 Paolo Bonzini <bonzini@gnu.org> + + PR c++/24052 + * error.c (dump_expr): Pass LABEL_DECL to dump_decl. Print + an ADDR_EXPR of a LABEL_DECL as &&. + +2005-10-11 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + 2004-09-23 Andrew Pinski <pinskia@physics.uc.edu> + PR c++/17618 + * cvt.c (cp_convert_to_pointer): Return early when the type is + an error_mark_node. + + 2004-05-22 Roger Sayle <roger@eyesopen.com> + * name-lookup.c (check_for_out_of_scope_variable): Avoid ICE by + returning when TREE_TYPE is error_mark_node. + * typeck.c (require_complete_type): Return error_mark_node if + value's type is an error_mark_node. + + 2004-11-02 Mark Mitchell <mark@codesourcery.com> + PR c++/18177 + * typeck.c (build_const_cast): Use error_operand_p. + +2005-10-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + * call.c (resolve_args): Remove redundant test. + +2005-09-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/23965 + * call.c (resolve_args): Return error_mark_node on arguments + whose TREE_TYPE is error_mark_node. + +2005-09-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/17609 + Backport: + + 2004-03-08 Mark Mitchell <mark@codesourcery.com> + * lex.c (unqualified_name_lookup_error): Create a dummy VAR_DECL + in the innermost scope, rather than at namespace scope. + * name-lookup.c (push_local_binding): Give it external linkage. + * name-lookup.h (push_local_binding): Declare it. + +2005-09-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2004-11-27 Mark Mitchell <mark@codesourcery.com> + PR c++/18368 + * parser.c (cp_parser_check_for_definition_in_return_type): Take + the defined type as a parameter, and inform the user about the + possibility of a missing semicolon. + (cp_parser_explicit_instantiation): Adjust call to + cp_parser_check_for_definition_in_return_type. + (cp_parser_init_declarator): Likewise. + (cp_parser_member_declaration): Likewise. + +2005-09-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/18803 + Revert: + + 2005-09-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + PR c++/18445 + * class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with + unknown_type as non matching. + * pt.c (build_non_dependent_expr): Do not build a + NON_DEPENDENT_EXPR for a VAR_DECL. + +2005-09-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2004-12-14 Mark Mitchell <mark@codesourcery.com> + PR c++/18738 + * decl.c (make_typename_type): Do not handle namespace-scoped + names here. + (tag_name): Handle typename_type. + (check_elaborated_type_specifier): Handle typenames. + * parser.c (cp_parser_diagnose_invalid_type_name): Do not call + make_typename_type for namespace-scoped names here. + (cp_parser_elaborated_type_specifier): Use + cp_parser_diagnose_invalid_type_name. + +2005-09-03 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2005-08-26 Mark Mitchell <mark@codesourcery.com> + PR c++/19004 + * pt.c (uses_template_parms): Handle IDENTIFIER_NODE. + (type_dependent_expression_p): Allow BASELINKs whose associated + functions are simply a FUNCTION_DECL. + +2005-09-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/22233 + * pt.c (push_template_decl_real): Return error_mark_node if the + number of template parameters does not match previous definition. + * decl.c (start_function): Handle error_mark_node returned by + push_template_decl. + +2005-09-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2004-11-25 Mark Mitchell <mark@codesourcery.com> + PR c++/18466 + * decl.c (grokvardecl): Keep track of whether or not a there was + explicit qualification. + * name-lookup.c (set_decl_namespace): Complain about explicit + qualification of a name within its own namespace. + +2005-09-02 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2004-11-25 Mark Mitchell <mark@codesourcery.com> + PR c++/18445 + * class.c (instantiate_type): Treat NON_DEPENDENT_EXPRs with + unknown_type as non matching. + * pt.c (build_non_dependent_expr): Do not build a + NON_DEPENDENT_EXPR for a VAR_DECL. + +2005-09-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2004-11-27 Mark Mitchell <mark@codesourcery.com> + PR c++/18512 + * parser.c (cp_parser_postfix_expression): Robustify. + +2005-09-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2004-11-25 Mark Mitchell <mark@codesourcery.com> + PR c++/18545 + * typeck.c (check_return_expr): Robustify. + +2005-09-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + Backport: + + 2005-02-22 Mark Mitchell <mark@codesourcery.com> + PR c++/20153 + * decl2.c (build_anon_union_vars): Add type parameter. + (finish_anon_union): Pass it. + + 2005-07-28 Mark Mitchell <mark@codesourcery.com> + PR c++/22545 + * call.c (add_builtin_candidate): Adjust for changes in + representation of pointer-to-member types. + +2005-09-01 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/13377 + * parser.c (cp_parser_lookup_name): Pass LOOKUP_COMPLAIN to + lookup_name_real on final parse. + +2005-08-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/23586 + * parser.c (cp_parser_namespace_name): Move diagnostic for + invalid namespace-name to here from ... + * name-lookup.c (do_namespace_alias): ... here and ... + (do_using_directive): ... here. Remove dead code. + +2005-08-31 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/23639 + * semantics.c (qualified_name_lookup_error): Do not complain again + on invalid scope. + +2005-07-28 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + Backport: + + 2004-09-16 Mark Mitchell <mark@codesourcery.com> + PR c++/16002 + * parser.c (cp_parser_simple_declaration): Commit to tentative + parses after seeing a decl-specifier. + (cp_parser_simple_declaration): Eliminate spurious message. + (cp_parser_init_declarator): Adjust error message. + + 2005-06-17 Geoffrey Keating <geoffk@apple.com> + PR c++/17413 + * pt.c (type_unification_real): Apply template type deduction even + to procedure parameters that are not dependent on a template + parameter. + + 2004-11-02 Mark Mitchell <mark@codesourcery.com> + PR c++/18124 + * parser.c (cp_parser_type_parameter): Robustify. + PR c++/18155 + * parser.c (cp_parser_single_declaration): Disallow template + typedefs. + (cp_parser_typedef_p): New function. + + 2004-12-21 Mark Mitchell <mark@codesourcery.com> + PR c++/18378 + * call.c (convert_like_real): Do not permit the use of a copy + constructor to copy a packed field. + +2005-07-25 Giovanni Bajo <giovannibajo@gcc.gnu.org> + + PR c++/19208 + * pt.c (tsubst): Use fold_non_dependent_expr to fold array domains. + +2005-06-14 Mark Mitchell <mark@codesourcery.com> + + PR c++/21987 + * decl.c (grok_op_properties): Add missing warn_conversion check. + +2005-06-13 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/20789 + * decl.c (cp_finish_decl): Clear runtime runtime initialization if + in-class decl's initializer is bad. + +2005-06-10 Aldy Hernandez <aldyh@redhat.com> + + PR c++/10611 + * cvt.c (build_expr_type_conversion): Same. + * typeck.c (build_binary_op): Handle vectors. + (common_type): Same. + (type_after_usual_arithmetic_conversions): Same. + * testsuite/g++.dg/conversion/simd2.C: New. + +2005-06-08 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/21903 + * cp-tree.def (DEFAULT_ARG): Document TREE_CHAIN use. + * parser.c (cp_parser_late_parsing_default_args): Propagate parsed + argument to any early instantiations. + * pt.c (tsubst_arg_types): Chain early instantiation of default + arg. + + PR c++/19884 + * pt.c (check_explicit_specialization): Make sure namespace + binding lookup found an overloaded function. + (lookup_template_function): Just assert FNS is an overloaded + function. + + PR c++/19608 + * parser.c (cp_parser_late_parsing_for_member): Use + current_function_decl as scope to push to and from. + testsuite: + +2005-06-08 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/20563 + * parser.c (cp_parser_label_declaration): Deal with invalid/missing + identifiers. + +2005-06-03 Mark Mitchell <mark@codesourcery.com> + + PR c++/21853 + * typeck.c (casts_away_constness_r): Do not drop cv-qualifiers on + the pointed-to type for a pointer-to-member. + +2005-06-03 Mark Mitchell <mark@codesourcery.com> + + PR c++/21336 + * cp-tree.h (grok_op_properties): Remove friendp parameter. + * decl.c (grokfndecl): Adjust call. + (grok_op_properties): Determine the class of which the function is + a member by looking at its DECL_CONTEXT, not current_class_type. + * pt.c (tsubst_decl): Adjust call to grok_op_properties. + +2005-05-26 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/21768 + * pt.c (redeclare_class_template): Change error message according + to coding conventions. + 2005-05-19 Release Manager * GCC 3.4.4 released. diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c index aeed315..01c8926 100644 --- a/contrib/gcc/cp/call.c +++ b/contrib/gcc/cp/call.c @@ -1556,7 +1556,7 @@ add_builtin_candidate (struct z_candidate **candidates, enum tree_code code, if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1) && (TYPE_PTRMEMFUNC_P (type2) - || is_complete (TREE_TYPE (TREE_TYPE (type2))))) + || is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2)))) break; } return; @@ -2544,7 +2544,7 @@ resolve_args (tree args) { tree arg = TREE_VALUE (t); - if (arg == error_mark_node) + if (error_operand_p (arg)) return error_mark_node; else if (VOID_TYPE_P (TREE_TYPE (arg))) { @@ -4080,13 +4080,12 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner, if (NEED_TEMPORARY_P (convs) || !lvalue_p (expr)) { tree type = TREE_TYPE (TREE_OPERAND (convs, 0)); + cp_lvalue_kind lvalue = real_lvalue_p (expr); if (!CP_TYPE_CONST_NON_VOLATILE_P (TREE_TYPE (ref_type))) { /* If the reference is volatile or non-const, we cannot create a temporary. */ - cp_lvalue_kind lvalue = real_lvalue_p (expr); - if (lvalue & clk_bitfield) error ("cannot bind bitfield `%E' to `%T'", expr, ref_type); @@ -4097,6 +4096,20 @@ convert_like_real (tree convs, tree expr, tree fn, int argnum, int inner, error ("cannot bind rvalue `%E' to `%T'", expr, ref_type); return error_mark_node; } + /* If the source is a packed field, and we must use a copy + constructor, then building the target expr will require + binding the field to the reference parameter to the + copy constructor, and we'll end up with an infinite + loop. If we can use a bitwise copy, then we'll be + OK. */ + if ((lvalue & clk_packed) + && CLASS_TYPE_P (type) + && !TYPE_HAS_TRIVIAL_INIT_REF (type)) + { + error ("cannot bind packed field `%E' to `%T'", + expr, ref_type); + return error_mark_node; + } expr = build_target_expr_with_type (expr, type); } diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c index 09daf11..c14313c 100644 --- a/contrib/gcc/cp/class.c +++ b/contrib/gcc/cp/class.c @@ -879,9 +879,10 @@ add_method (tree type, tree method, int error_p) fns = OVL_NEXT (fns)) { tree fn = OVL_CURRENT (fns); + tree fn_type; + tree method_type; tree parms1; tree parms2; - bool same = 1; if (TREE_CODE (fn) != TREE_CODE (method)) continue; @@ -896,8 +897,10 @@ add_method (tree type, tree method, int error_p) functions in the derived class override and/or hide member functions with the same name and parameter types in a base class (rather than conflicting). */ - parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn)); - parms2 = TYPE_ARG_TYPES (TREE_TYPE (method)); + fn_type = TREE_TYPE (fn); + method_type = TREE_TYPE (method); + parms1 = TYPE_ARG_TYPES (fn_type); + parms2 = TYPE_ARG_TYPES (method_type); /* Compare the quals on the 'this' parm. Don't compare the whole types, as used functions are treated as @@ -906,23 +909,25 @@ add_method (tree type, tree method, int error_p) && ! DECL_STATIC_FUNCTION_P (method) && (TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms1))) != TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms2))))) - same = 0; + continue; /* For templates, the template parms must be identical. */ if (TREE_CODE (fn) == TEMPLATE_DECL - && !comp_template_parms (DECL_TEMPLATE_PARMS (fn), - DECL_TEMPLATE_PARMS (method))) - same = 0; + && (!same_type_p (TREE_TYPE (fn_type), + TREE_TYPE (method_type)) + || !comp_template_parms (DECL_TEMPLATE_PARMS (fn), + DECL_TEMPLATE_PARMS (method)))) + continue; if (! DECL_STATIC_FUNCTION_P (fn)) parms1 = TREE_CHAIN (parms1); if (! DECL_STATIC_FUNCTION_P (method)) parms2 = TREE_CHAIN (parms2); - if (same && compparms (parms1, parms2) + if (compparms (parms1, parms2) && (!DECL_CONV_FN_P (fn) - || same_type_p (TREE_TYPE (TREE_TYPE (fn)), - TREE_TYPE (TREE_TYPE (method))))) + || same_type_p (TREE_TYPE (fn_type), + TREE_TYPE (method_type)))) { if (using && DECL_CONTEXT (fn) == type) /* Defer to the local function. */ @@ -2035,11 +2040,7 @@ find_final_overrider (tree derived, tree binfo, tree fn) /* If there was no winner, issue an error message. */ if (!ffod.candidates || TREE_CHAIN (ffod.candidates)) - { - error ("no unique final overrider for `%D' in `%T'", fn, - BINFO_TYPE (derived)); - return error_mark_node; - } + return error_mark_node; return ffod.candidates; } @@ -2099,7 +2100,10 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals, /* Find the final overrider. */ overrider = find_final_overrider (TYPE_BINFO (t), b, target_fn); if (overrider == error_mark_node) - return; + { + error ("no unique final overrider for `%D' in `%T'", target_fn, t); + return; + } overrider_target = overrider_fn = TREE_PURPOSE (overrider); /* Check for adjusting covariant return types. */ diff --git a/contrib/gcc/cp/cp-tree.def b/contrib/gcc/cp/cp-tree.def index 36b7aaa..f6a2bee 100644 --- a/contrib/gcc/cp/cp-tree.def +++ b/contrib/gcc/cp/cp-tree.def @@ -203,7 +203,9 @@ DEFTREECODE (USING_DECL, "using_decl", 'd', 0) /* A using directive. The operand is USING_STMT_NAMESPACE. */ DEFTREECODE (USING_STMT, "using_directive", 'e', 1) -/* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */ +/* An un-parsed default argument. + TREE_CHAIN is used to hold instantiations of functions that had to + be instantiated before the argument was parsed. */ DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 0) /* A template-id, like foo<int>. The first operand is the template. diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h index ed33f32..cc1f937 100644 --- a/contrib/gcc/cp/cp-tree.h +++ b/contrib/gcc/cp/cp-tree.h @@ -3683,7 +3683,7 @@ extern int copy_fn_p (tree); extern tree get_scope_of_declarator (tree); extern void grok_special_member_properties (tree); extern int grok_ctor_properties (tree, tree); -extern bool grok_op_properties (tree, int, bool); +extern bool grok_op_properties (tree, bool); extern tree xref_tag (enum tag_types, tree, bool, bool); extern tree xref_tag_from_type (tree, tree, int); extern void xref_basetypes (tree, tree); diff --git a/contrib/gcc/cp/cvt.c b/contrib/gcc/cp/cvt.c index 95fce07..2071c26 100644 --- a/contrib/gcc/cp/cvt.c +++ b/contrib/gcc/cp/cvt.c @@ -79,6 +79,8 @@ cp_convert_to_pointer (tree type, tree expr, bool force) tree intype = TREE_TYPE (expr); enum tree_code form; tree rval; + if (intype == error_mark_node) + return error_mark_node; if (IS_AGGR_TYPE (intype)) { @@ -1029,6 +1031,7 @@ build_expr_type_conversion (int desires, tree expr, bool complain) return expr; /* else fall through... */ + case VECTOR_TYPE: case BOOLEAN_TYPE: return (desires & WANT_INT) ? expr : NULL_TREE; case ENUMERAL_TYPE: diff --git a/contrib/gcc/cp/decl2.c b/contrib/gcc/cp/decl2.c index 09fe5dd..abd86f7 100644 --- a/contrib/gcc/cp/decl2.c +++ b/contrib/gcc/cp/decl2.c @@ -64,7 +64,6 @@ typedef struct priority_info_s { static void mark_vtable_entries (tree); static void grok_function_init (tree, tree); static bool maybe_emit_vtables (tree); -static tree build_anon_union_vars (tree); static bool acceptable_java_type (tree); static tree start_objects (int, int); static void finish_objects (int, int, tree); @@ -1131,14 +1130,13 @@ defer_fn (tree fn) VARRAY_PUSH_TREE (deferred_fns, fn); } -/* Walks through the namespace- or function-scope anonymous union OBJECT, - building appropriate ALIAS_DECLs. Returns one of the fields for use in - the mangled name. */ +/* Walks through the namespace- or function-scope anonymous union + OBJECT, with the indicated TYPE, building appropriate ALIAS_DECLs. + Returns one of the fields for use in the mangled name. */ static tree -build_anon_union_vars (tree object) +build_anon_union_vars (tree type, tree object) { - tree type = TREE_TYPE (object); tree main_decl = NULL_TREE; tree field; @@ -1185,7 +1183,7 @@ build_anon_union_vars (tree object) decl = pushdecl (decl); } else if (ANON_AGGR_TYPE_P (TREE_TYPE (field))) - decl = build_anon_union_vars (ref); + decl = build_anon_union_vars (TREE_TYPE (field), ref); else decl = 0; @@ -1225,7 +1223,7 @@ finish_anon_union (tree anon_union_decl) return; } - main_decl = build_anon_union_vars (anon_union_decl); + main_decl = build_anon_union_vars (type, anon_union_decl); if (main_decl == NULL_TREE) { warning ("anonymous union with no members"); @@ -2961,7 +2959,7 @@ check_default_args (tree x) { cp_error_at ("default argument missing for parameter %P of `%+#D'", i, x); - break; + TREE_PURPOSE (arg) = error_mark_node; } } } @@ -2969,6 +2967,18 @@ check_default_args (tree x) void mark_used (tree decl) { + /* If DECL is a BASELINK for a single function, then treat it just + like the DECL for the function. Otherwise, if the BASELINK is + for an overloaded function, we don't know which function was + actually used until after overload resolution. */ + if (TREE_CODE (decl) == BASELINK) + { + decl = BASELINK_FUNCTIONS (decl); + if (really_overloaded_fn (decl)) + return; + decl = OVL_CURRENT (decl); + } + TREE_USED (decl) = 1; if (processing_template_decl || skip_evaluation) return; diff --git a/contrib/gcc/cp/error.c b/contrib/gcc/cp/error.c index 5b83c60..381b5be 100644 --- a/contrib/gcc/cp/error.c +++ b/contrib/gcc/cp/error.c @@ -1307,6 +1307,7 @@ dump_expr (tree t, int flags) case FUNCTION_DECL: case TEMPLATE_DECL: case NAMESPACE_DECL: + case LABEL_DECL: case OVERLOAD: case IDENTIFIER_NODE: dump_decl (t, (flags & ~TFF_DECL_SPECIFIERS) | TFF_NO_FUNCTION_ARGUMENTS); @@ -1547,6 +1548,8 @@ dump_expr (tree t, int flags) || (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)) dump_expr (TREE_OPERAND (t, 0), flags | TFF_EXPR_IN_PARENS); + else if (TREE_CODE (TREE_OPERAND (t, 0)) == LABEL_DECL) + dump_unary_op ("&&", t, flags); else dump_unary_op ("&", t, flags); break; diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c index 732d4a0..4e3cd4b 100644 --- a/contrib/gcc/cp/init.c +++ b/contrib/gcc/cp/init.c @@ -1015,11 +1015,11 @@ expand_member_init (tree name) if (!direct_binfo && !virtual_binfo) { if (TYPE_USES_VIRTUAL_BASECLASSES (current_class_type)) - error ("type `%D' is not a direct or virtual base of `%T'", - name, current_class_type); + error ("type `%T' is not a direct or virtual base of `%T'", + basetype, current_class_type); else - error ("type `%D' is not a direct base of `%T'", - name, current_class_type); + error ("type `%T' is not a direct base of `%T'", + basetype, current_class_type); return NULL_TREE; } @@ -2075,9 +2075,6 @@ build_new_1 (tree exp) fns = lookup_fnfields (true_type, fnname, /*protect=*/2); if (!fns) { - /* See PR 15967. This should never happen (and it is - fixed correctly in mainline), but on the release branch - we prefer this less-intrusive approacch. */ error ("no suitable or ambiguous `%D' found in class `%T'", fnname, true_type); return error_mark_node; diff --git a/contrib/gcc/cp/lex.c b/contrib/gcc/cp/lex.c index 2239c76..66e45ed 100644 --- a/contrib/gcc/cp/lex.c +++ b/contrib/gcc/cp/lex.c @@ -627,26 +627,18 @@ unqualified_name_lookup_error (tree name) if (name != ansi_opname (ERROR_MARK)) error ("`%D' not defined", name); } - else if (current_function_decl == 0) - error ("`%D' was not declared in this scope", name); else { - if (IDENTIFIER_NAMESPACE_VALUE (name) != error_mark_node - || IDENTIFIER_ERROR_LOCUS (name) != current_function_decl) + error ("`%D' was not declared in this scope", name); + /* Prevent repeated error messages by creating a VAR_DECL with + this NAME in the innermost block scope. */ + if (current_function_decl) { - static int undeclared_variable_notice; - - error ("`%D' undeclared (first use this function)", name); - - if (! undeclared_variable_notice) - { - error ("(Each undeclared identifier is reported only once for each function it appears in.)"); - undeclared_variable_notice = 1; - } + tree decl; + decl = build_decl (VAR_DECL, name, error_mark_node); + DECL_CONTEXT (decl) = current_function_decl; + push_local_binding (name, decl, 0); } - /* Prevent repeated error messages. */ - SET_IDENTIFIER_NAMESPACE_VALUE (name, error_mark_node); - SET_IDENTIFIER_ERROR_LOCUS (name, current_function_decl); } return error_mark_node; diff --git a/contrib/gcc/cp/method.c b/contrib/gcc/cp/method.c index ef69c37..9f3e72e 100644 --- a/contrib/gcc/cp/method.c +++ b/contrib/gcc/cp/method.c @@ -851,7 +851,7 @@ synthesize_exception_spec (tree type, tree (*extractor) (tree, void*), continue; while (TREE_CODE (type) == ARRAY_TYPE) type = TREE_TYPE (type); - if (TREE_CODE (type) != RECORD_TYPE) + if (!CLASS_TYPE_P (type)) continue; fn = (*extractor) (type, client); @@ -896,7 +896,9 @@ locate_ctor (tree type, void *client ATTRIBUTE_UNUSED) tree fn = OVL_CURRENT (fns); tree parms = TYPE_ARG_TYPES (TREE_TYPE (fn)); - if (sufficient_parms_p (TREE_CHAIN (parms))) + parms = skip_artificial_parms_for (fn, parms); + + if (sufficient_parms_p (parms)) return fn; } return NULL_TREE; @@ -940,7 +942,7 @@ locate_copy (tree type, void *client_) int excess; int quals; - parms = TREE_CHAIN (parms); + parms = skip_artificial_parms_for (fn, parms); if (!parms) continue; src_type = non_reference (TREE_VALUE (parms)); diff --git a/contrib/gcc/cp/name-lookup.c b/contrib/gcc/cp/name-lookup.c index 3e79d3e..870eaab 100644 --- a/contrib/gcc/cp/name-lookup.c +++ b/contrib/gcc/cp/name-lookup.c @@ -35,7 +35,6 @@ static cxx_scope *innermost_nonclass_level (void); static tree select_decl (cxx_binding *, int); static cxx_binding *binding_for_name (cxx_scope *, tree); static tree lookup_name_current_level (tree); -static void push_local_binding (tree, tree, int); static tree push_overloaded_decl (tree, int); static bool lookup_using_namespace (tree, cxx_binding *, tree, tree, int); @@ -607,6 +606,9 @@ pushdecl (tree x) { int different_binding_level = 0; + if (TREE_CODE (x) == FUNCTION_DECL || DECL_FUNCTION_TEMPLATE_P (x)) + check_default_args (x); + if (TREE_CODE (name) == TEMPLATE_ID_EXPR) name = TREE_OPERAND (name, 0); @@ -718,8 +720,6 @@ pushdecl (tree x) { if (TREE_CODE (t) == TYPE_DECL) SET_IDENTIFIER_TYPE_VALUE (name, TREE_TYPE (t)); - else if (TREE_CODE (t) == FUNCTION_DECL) - check_default_args (t); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t); } @@ -1002,9 +1002,6 @@ pushdecl (tree x) } } - if (TREE_CODE (x) == FUNCTION_DECL) - check_default_args (x); - if (TREE_CODE (x) == VAR_DECL) maybe_register_incomplete_var (x); } @@ -1052,7 +1049,7 @@ maybe_push_decl (tree decl) doesn't really belong to this binding level, that it got here through a using-declaration. */ -static void +void push_local_binding (tree id, tree decl, int flags) { struct cp_binding_level *b; @@ -1180,6 +1177,10 @@ check_for_out_of_scope_variable (tree decl) return decl; DECL_ERROR_REPORTED (decl) = 1; + + if (TREE_TYPE (decl) == error_mark_node) + return decl; + if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TREE_TYPE (decl))) { error ("name lookup of `%D' changed for new ISO `for' scoping", @@ -3021,7 +3022,13 @@ set_decl_namespace (tree decl, tree scope, bool friendp) return; } else - return; + { + /* Writing "int N::i" to declare a variable within "N" is invalid. */ + if (at_namespace_scope_p ()) + error ("explicit qualification in declaration of `%D'", decl); + return; + } + complain: error ("`%D' should have been declared inside `%D'", decl, scope); @@ -3199,12 +3206,10 @@ namespace_ancestor (tree ns1, tree ns2) void do_namespace_alias (tree alias, tree namespace) { - if (TREE_CODE (namespace) != NAMESPACE_DECL) - { - /* The parser did not find it, so it's not there. */ - error ("unknown namespace `%D'", namespace); - return; - } + if (namespace == error_mark_node) + return; + + my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 20050830); namespace = ORIGINAL_NAMESPACE (namespace); @@ -3345,26 +3350,15 @@ do_toplevel_using_decl (tree decl, tree scope, tree name) void do_using_directive (tree namespace) { + if (namespace == error_mark_node) + return; + + my_friendly_assert (TREE_CODE (namespace) == NAMESPACE_DECL, 20050830); + if (building_stmt_tree ()) add_stmt (build_stmt (USING_STMT, namespace)); - - /* using namespace A::B::C; */ - if (TREE_CODE (namespace) == SCOPE_REF) - namespace = TREE_OPERAND (namespace, 1); - if (TREE_CODE (namespace) == IDENTIFIER_NODE) - { - /* Lookup in lexer did not find a namespace. */ - if (!processing_template_decl) - error ("namespace `%T' undeclared", namespace); - return; - } - if (TREE_CODE (namespace) != NAMESPACE_DECL) - { - if (!processing_template_decl) - error ("`%T' is not a namespace", namespace); - return; - } namespace = ORIGINAL_NAMESPACE (namespace); + if (!toplevel_bindings_p ()) push_using_directive (namespace); else @@ -4437,9 +4431,10 @@ arg_assoc (struct arg_lookup *k, tree n) return true; /* Now the arguments. */ - for (ix = TREE_VEC_LENGTH (args); ix--;) - if (arg_assoc_template_arg (k, TREE_VEC_ELT (args, ix)) == 1) - return true; + if (args) + for (ix = TREE_VEC_LENGTH (args); ix--;) + if (arg_assoc_template_arg (k, TREE_VEC_ELT (args, ix)) == 1) + return true; } else if (TREE_CODE (n) == OVERLOAD) { diff --git a/contrib/gcc/cp/name-lookup.h b/contrib/gcc/cp/name-lookup.h index 8377575..1ade1a9 100644 --- a/contrib/gcc/cp/name-lookup.h +++ b/contrib/gcc/cp/name-lookup.h @@ -287,6 +287,7 @@ extern tree lookup_namespace_name (tree, tree); extern tree lookup_qualified_name (tree, tree, bool, bool); extern tree lookup_name_nonclass (tree); extern tree lookup_function_nonclass (tree, tree); +extern void push_local_binding (tree, tree, int); extern int push_class_binding (tree, tree); extern bool pushdecl_class_level (tree); extern tree pushdecl_namespace_level (tree); diff --git a/contrib/gcc/cp/parser.c b/contrib/gcc/cp/parser.c index fb0d1e3..032cbd7 100644 --- a/contrib/gcc/cp/parser.c +++ b/contrib/gcc/cp/parser.c @@ -1672,6 +1672,8 @@ static bool cp_parser_declares_only_class_p (cp_parser *); static bool cp_parser_friend_p (tree); +static bool cp_parser_typedef_p + (tree); static cp_token *cp_parser_require (cp_parser *, enum cpp_ttype, const char *); static cp_token *cp_parser_require_keyword @@ -1717,7 +1719,7 @@ static bool cp_parser_simulate_error static void cp_parser_check_type_definition (cp_parser *); static void cp_parser_check_for_definition_in_return_type - (tree, int); + (tree, tree); static void cp_parser_check_for_invalid_template_id (cp_parser *, tree); static bool cp_parser_non_integral_constant_expression @@ -1849,14 +1851,13 @@ cp_parser_check_type_definition (cp_parser* parser) error ("%s", parser->type_definition_forbidden_message); } -/* This function is called when a declaration is parsed. If - DECLARATOR is a function declarator and DECLARES_CLASS_OR_ENUM - indicates that a type was defined in the decl-specifiers for DECL, - then an error is issued. */ +/* This function is called when the DECLARATOR is processed. The TYPE + was a type defined in the decl-specifiers. If it is invalid to + define a type in the decl-specifiers for DECLARATOR, an error is + issued. */ static void -cp_parser_check_for_definition_in_return_type (tree declarator, - int declares_class_or_enum) +cp_parser_check_for_definition_in_return_type (tree declarator, tree type) { /* [dcl.fct] forbids type definitions in return types. Unfortunately, it's not easy to know whether or not we are @@ -1866,9 +1867,12 @@ cp_parser_check_for_definition_in_return_type (tree declarator, || TREE_CODE (declarator) == ADDR_EXPR)) declarator = TREE_OPERAND (declarator, 0); if (declarator - && TREE_CODE (declarator) == CALL_EXPR - && declares_class_or_enum & 2) - error ("new types may not be defined in a return type"); + && TREE_CODE (declarator) == CALL_EXPR) + { + error ("new types may not be defined in a return type"); + inform ("(perhaps a semicolon is missing after the definition of `%T')", + type); + } } /* A type-specifier (TYPE) has been parsed which cannot be followed by @@ -3548,52 +3552,13 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p) case RID_TYPENAME: { - bool template_p = false; - tree id; tree type; - tree scope; - - /* Consume the `typename' token. */ - cp_lexer_consume_token (parser->lexer); - /* Look for the optional `::' operator. */ - cp_parser_global_scope_opt (parser, - /*current_scope_valid_p=*/false); - /* Look for the nested-name-specifier. In case of error here, - consume the trailing id to avoid subsequent error messages - for usual cases. */ - scope = cp_parser_nested_name_specifier (parser, - /*typename_keyword_p=*/true, - /*check_dependency_p=*/true, - /*type_p=*/true, - /*is_declaration=*/true); - - /* Look for the optional `template' keyword. */ - template_p = cp_parser_optional_template_keyword (parser); - /* We don't know whether we're looking at a template-id or an - identifier. */ - cp_parser_parse_tentatively (parser); - /* Try a template-id. */ - id = cp_parser_template_id (parser, template_p, - /*check_dependency_p=*/true, - /*is_declaration=*/true); - /* If that didn't work, try an identifier. */ - if (!cp_parser_parse_definitely (parser)) - id = cp_parser_identifier (parser); - - /* Don't process id if nested name specifier is invalid. */ - if (scope == error_mark_node) - return error_mark_node; - /* If we look up a template-id in a non-dependent qualifying - scope, there's no need to create a dependent type. */ - else if (TREE_CODE (id) == TYPE_DECL - && !dependent_type_p (parser->scope)) - type = TREE_TYPE (id); - /* Create a TYPENAME_TYPE to represent the type to which the - functional cast is being performed. */ - else - type = make_typename_type (parser->scope, id, - /*complain=*/1); + /* The syntax permitted here is the same permitted for an + elaborated-type-specifier. */ + type = cp_parser_elaborated_type_specifier (parser, + /*is_friend=*/false, + /*is_declaration=*/false); postfix_expression = cp_parser_functional_cast (parser, type); } break; @@ -3964,20 +3929,29 @@ cp_parser_postfix_expression (cp_parser *parser, bool address_p) if (parser->scope) idk = CP_ID_KIND_QUALIFIED; - if (name != error_mark_node - && !BASELINK_P (name) - && parser->scope) + /* If the name is a template-id that names a type, we will + get a TYPE_DECL here. That is invalid code. */ + if (TREE_CODE (name) == TYPE_DECL) { - name = build_nt (SCOPE_REF, parser->scope, name); - parser->scope = NULL_TREE; - parser->qualifying_scope = NULL_TREE; - parser->object_scope = NULL_TREE; + error ("invalid use of `%D'", name); + postfix_expression = error_mark_node; + } + else + { + if (name != error_mark_node && !BASELINK_P (name) + && parser->scope) + { + name = build_nt (SCOPE_REF, parser->scope, name); + parser->scope = NULL_TREE; + parser->qualifying_scope = NULL_TREE; + parser->object_scope = NULL_TREE; + } + if (scope && name && BASELINK_P (name)) + adjust_result_of_qualified_name_lookup + (name, BINFO_TYPE (BASELINK_BINFO (name)), scope); + postfix_expression = finish_class_member_access_expr + (postfix_expression, name); } - if (scope && name && BASELINK_P (name)) - adjust_result_of_qualified_name_lookup - (name, BINFO_TYPE (BASELINK_BINFO (name)), scope); - postfix_expression - = finish_class_member_access_expr (postfix_expression, name); } /* We no longer need to look up names in the scope of the @@ -6523,6 +6497,13 @@ cp_parser_simple_declaration (cp_parser* parser, /* Give up. */ goto done; } + + /* If we have seen at least one decl-specifier, and the next token + is not a parenthesis, then we must be looking at a declaration. + (After "int (" we might be looking at a functional cast.) */ + if (decl_specifiers + && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_PAREN)) + cp_parser_commit_to_tentative_parse (parser); /* Keep going until we hit the `;' at the end of the simple declaration. */ @@ -6576,7 +6557,12 @@ cp_parser_simple_declaration (cp_parser* parser, /* Anything else is an error. */ else { - cp_parser_error (parser, "expected `,' or `;'"); + /* If we have already issued an error message we don't need + to issue another one. */ + if (decl != error_mark_node + || (cp_parser_parsing_tentatively (parser) + && !cp_parser_committed_to_tentative_parse (parser))) + cp_parser_error (parser, "expected `,' or `;'"); /* Skip tokens until we reach the end of the statement. */ cp_parser_skip_to_end_of_statement (parser); /* If the next token is now a `;', consume it. */ @@ -7802,9 +7788,15 @@ cp_parser_type_parameter (cp_parser* parser) if (cp_lexer_next_token_is_not (parser->lexer, CPP_EQ) && cp_lexer_next_token_is_not (parser->lexer, CPP_GREATER) && cp_lexer_next_token_is_not (parser->lexer, CPP_COMMA)) - identifier = cp_parser_identifier (parser); + { + identifier = cp_parser_identifier (parser); + /* Treat invalid names as if the parameter were nameless. */ + if (identifier == error_mark_node) + identifier = NULL_TREE; + } else identifier = NULL_TREE; + /* Create the template parameter. */ parameter = finish_template_template_parm (class_type_node, identifier); @@ -7846,15 +7838,13 @@ cp_parser_type_parameter (cp_parser* parser) /* Create the combined representation of the parameter and the default argument. */ - parameter = build_tree_list (default_argument, parameter); + parameter = build_tree_list (default_argument, parameter); } break; default: - /* Anything else is an error. */ - cp_parser_error (parser, - "expected `class', `typename', or `template'"); - parameter = error_mark_node; + abort (); + break; } return parameter; @@ -8610,8 +8600,9 @@ cp_parser_explicit_instantiation (cp_parser* parser) /*ctor_dtor_or_conv_p=*/NULL, /*parenthesized_p=*/NULL, /*member_p=*/false); - cp_parser_check_for_definition_in_return_type (declarator, - declares_class_or_enum); + if (declares_class_or_enum & 2) + cp_parser_check_for_definition_in_return_type + (declarator, TREE_VALUE (decl_specifiers)); if (declarator != error_mark_node) { decl = grokdeclarator (declarator, decl_specifiers, @@ -9218,7 +9209,8 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, } /* For a `typename', we needn't call xref_tag. */ - if (tag_type == typename_type) + if (tag_type == typename_type + && TREE_CODE (parser->scope) != NAMESPACE_DECL) return make_typename_type (parser->scope, identifier, /*complain=*/1); /* Look up a qualified name in the usual way. */ @@ -9262,7 +9254,7 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, if (TREE_CODE (decl) != TYPE_DECL) { - error ("expected type-name"); + cp_parser_diagnose_invalid_type_name (parser); return error_mark_node; } @@ -9514,6 +9506,9 @@ cp_parser_namespace_name (cp_parser* parser) if (namespace_decl == error_mark_node || TREE_CODE (namespace_decl) != NAMESPACE_DECL) { + if (!cp_parser_parsing_tentatively (parser) + || cp_parser_committed_to_tentative_parse (parser)) + error ("`%D' is not a namespace-name", identifier); cp_parser_error (parser, "expected namespace-name"); namespace_decl = error_mark_node; } @@ -9982,8 +9977,9 @@ cp_parser_init_declarator (cp_parser* parser, if (declarator == error_mark_node) return error_mark_node; - cp_parser_check_for_definition_in_return_type (declarator, - declares_class_or_enum); + if (declares_class_or_enum & 2) + cp_parser_check_for_definition_in_return_type + (declarator, TREE_VALUE (decl_specifiers)); /* Figure out what scope the entity declared by the DECLARATOR is located in. `grokdeclarator' sometimes changes the scope, so @@ -10069,7 +10065,7 @@ cp_parser_init_declarator (cp_parser* parser, && token->type != CPP_COMMA && token->type != CPP_SEMICOLON) { - cp_parser_error (parser, "expected init-declarator"); + cp_parser_error (parser, "expected initializer"); return error_mark_node; } @@ -10909,7 +10905,7 @@ cp_parser_declarator_id (cp_parser* parser) /*declarator_p=*/true); /* If the name was qualified, create a SCOPE_REF to represent that. */ - if (parser->scope) + if (parser->scope && id_expression != error_mark_node) { id_expression = build_nt (SCOPE_REF, parser->scope, id_expression); parser->scope = NULL_TREE; @@ -12483,8 +12479,13 @@ cp_parser_member_declaration (cp_parser* parser) /* Check for a template-declaration. */ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_TEMPLATE)) { - /* Parse the template-declaration. */ - cp_parser_template_declaration (parser, /*member_p=*/true); + /* An explicit specialization here is an error condition, and we + expect the specialization handler to detect and report this. */ + if (cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_LESS + && cp_lexer_peek_nth_token (parser->lexer, 3)->type == CPP_GREATER) + cp_parser_explicit_specialization (parser); + else + cp_parser_template_declaration (parser, /*member_p=*/true); return; } @@ -12685,8 +12686,9 @@ cp_parser_member_declaration (cp_parser* parser) return; } - cp_parser_check_for_definition_in_return_type - (declarator, declares_class_or_enum); + if (declares_class_or_enum & 2) + cp_parser_check_for_definition_in_return_type + (declarator, TREE_VALUE (decl_specifiers)); /* Look for an asm-specification. */ asm_specification = cp_parser_asm_specification_opt (parser); @@ -13639,7 +13641,10 @@ cp_parser_label_declaration (cp_parser* parser) /* Look for an identifier. */ identifier = cp_parser_identifier (parser); - /* Declare it as a lobel. */ + /* If we failed, stop. */ + if (identifier == error_mark_node) + break; + /* Declare it as a label. */ finish_label_decl (identifier); /* If the next token is a `;', stop. */ if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)) @@ -13689,6 +13694,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name, bool is_type, bool is_template, bool is_namespace, bool check_dependency) { + int flags = 0; tree decl; tree object_type = parser->context->object_type; @@ -13700,6 +13706,10 @@ cp_parser_lookup_name (cp_parser *parser, tree name, if (name == error_mark_node) return error_mark_node; + if (!cp_parser_parsing_tentatively (parser) + || cp_parser_committed_to_tentative_parse (parser)) + flags |= LOOKUP_COMPLAIN; + /* A template-id has already been resolved; there is no lookup to do. */ if (TREE_CODE (name) == TEMPLATE_ID_EXPR) @@ -13813,8 +13823,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name, /*protect=*/0, is_type); /* Look it up in the enclosing context, too. */ decl = lookup_name_real (name, is_type, /*nonclass=*/0, - is_namespace, - /*flags=*/0); + is_namespace, flags); parser->object_scope = object_type; parser->qualifying_scope = NULL_TREE; if (object_decl) @@ -13823,8 +13832,7 @@ cp_parser_lookup_name (cp_parser *parser, tree name, else { decl = lookup_name_real (name, is_type, /*nonclass=*/0, - is_namespace, - /*flags=*/0); + is_namespace, flags); parser->qualifying_scope = NULL_TREE; parser->object_scope = NULL_TREE; } @@ -14508,6 +14516,12 @@ cp_parser_single_declaration (cp_parser* parser, tree attributes; bool function_definition_p = false; + /* This function is only used when processing a template + declaration. */ + if (innermost_scope_kind () != sk_template_parms + && innermost_scope_kind () != sk_template_spec) + abort (); + /* Defer access checks until we know what is being declared. */ push_deferring_access_checks (dk_deferred); @@ -14520,6 +14534,14 @@ cp_parser_single_declaration (cp_parser* parser, &declares_class_or_enum); if (friend_p) *friend_p = cp_parser_friend_p (decl_specifiers); + + /* There are no template typedefs. */ + if (cp_parser_typedef_p (decl_specifiers)) + { + error ("template declaration of `typedef'"); + decl = error_mark_node; + } + /* Gather up the access checks that occurred the decl-specifier-seq. */ stop_deferring_access_checks (); @@ -14536,8 +14558,6 @@ cp_parser_single_declaration (cp_parser* parser, decl = error_mark_node; } } - else - decl = NULL_TREE; /* If it's not a template class, try for a template function. If the next token is a `;', then this declaration does not declare anything. But, if there were errors in the decl-specifiers, then @@ -14563,7 +14583,8 @@ cp_parser_single_declaration (cp_parser* parser, parser->object_scope = NULL_TREE; /* Look for a trailing `;' after the declaration. */ if (!function_definition_p - && !cp_parser_require (parser, CPP_SEMICOLON, "`;'")) + && (decl == error_mark_node + || !cp_parser_require (parser, CPP_SEMICOLON, "`;'"))) cp_parser_skip_to_end_of_block_or_statement (parser); return decl; @@ -14593,8 +14614,10 @@ cp_parser_functional_cast (cp_parser* parser, tree type) cast = build_functional_cast (type, expression_list); /* [expr.const]/1: In an integral constant expression "only type conversions to integral or enumeration type can be used". */ - if (cast != error_mark_node && !type_dependent_expression_p (type) - && !INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (type))) + if (TREE_CODE (type) == TYPE_DECL) + type = TREE_TYPE (type); + if (cast != error_mark_node && !dependent_type_p (type) + && !INTEGRAL_OR_ENUMERATION_TYPE_P (type)) { if (cp_parser_non_integral_constant_expression (parser, "a call to a constructor")) @@ -14716,8 +14739,8 @@ cp_parser_enclosed_template_argument_list (cp_parser* parser) cp_lexer_consume_token (parser->lexer); } } - else if (!cp_parser_require (parser, CPP_GREATER, "`>'")) - error ("missing `>' to terminate the template argument list"); + else + cp_parser_skip_until_found (parser, CPP_GREATER, "`>'"); /* The `>' token might be a greater-than operator again now. */ parser->greater_than_is_operator_p = saved_greater_than_is_operator_p; @@ -14768,9 +14791,10 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function) tokens = DECL_PENDING_INLINE_INFO (member_function); DECL_PENDING_INLINE_INFO (member_function) = NULL; DECL_PENDING_INLINE_P (member_function) = 0; - /* If this was an inline function in a local class, enter the scope - of the containing function. */ - function_scope = decl_function_context (member_function); + + /* If this is a local class, enter the scope of the containing + function. */ + function_scope = current_function_decl; if (function_scope) push_function_context_to (function_scope); @@ -14851,33 +14875,49 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) parameters; parameters = TREE_CHAIN (parameters)) { - if (!TREE_PURPOSE (parameters) - || TREE_CODE (TREE_PURPOSE (parameters)) != DEFAULT_ARG) + tree default_arg = TREE_PURPOSE (parameters); + tree parsed_arg; + + if (!default_arg) + continue; + + if (TREE_CODE (default_arg) != DEFAULT_ARG) + /* This can happen for a friend declaration for a function + already declared with default arguments. */ continue; - /* Save away the current lexer. */ + /* Save away the current lexer. */ saved_lexer = parser->lexer; - /* Create a new one, using the tokens we have saved. */ - tokens = DEFARG_TOKENS (TREE_PURPOSE (parameters)); + /* Create a new one, using the tokens we have saved. */ + tokens = DEFARG_TOKENS (default_arg); parser->lexer = cp_lexer_new_from_tokens (tokens); - /* Set the current source position to be the location of the - first token in the default argument. */ + /* Set the current source position to be the location of the + first token in the default argument. */ cp_lexer_peek_token (parser->lexer); - /* Local variable names (and the `this' keyword) may not appear - in a default argument. */ + /* Local variable names (and the `this' keyword) may not appear + in a default argument. */ saved_local_variables_forbidden_p = parser->local_variables_forbidden_p; parser->local_variables_forbidden_p = true; - /* Parse the assignment-expression. */ + + /* Parse the assignment-expression. */ if (DECL_FRIEND_CONTEXT (fn)) push_nested_class (DECL_FRIEND_CONTEXT (fn)); else if (DECL_CLASS_SCOPE_P (fn)) push_nested_class (DECL_CONTEXT (fn)); - TREE_PURPOSE (parameters) = cp_parser_assignment_expression (parser); + parsed_arg = cp_parser_assignment_expression (parser); if (DECL_FRIEND_CONTEXT (fn) || DECL_CLASS_SCOPE_P (fn)) pop_nested_class (); - + + TREE_PURPOSE (parameters) = parsed_arg; + + /* Update any instantiations we've already created. */ + for (default_arg = TREE_CHAIN (default_arg); + default_arg; + default_arg = TREE_CHAIN (default_arg)) + TREE_PURPOSE (TREE_PURPOSE (default_arg)) = parsed_arg; + /* If the token stream has not been completely used up, then there was extra junk after the end of the default argument. */ @@ -14889,6 +14929,9 @@ cp_parser_late_parsing_default_args (cp_parser *parser, tree fn) parser->local_variables_forbidden_p = saved_local_variables_forbidden_p; } + /* Make sure no default arg is missing. */ + check_default_args (fn); + /* Restore the queue. */ parser->unparsed_functions_queues = TREE_CHAIN (parser->unparsed_functions_queues); @@ -15012,6 +15055,27 @@ cp_parser_friend_p (tree decl_specifiers) return false; } +/* DECL_SPECIFIERS is the representation of a decl-specifier-seq. + Returns TRUE iff `typedef' appears among the DECL_SPECIFIERS. */ + +static bool +cp_parser_typedef_p (tree decl_specifiers) +{ + while (decl_specifiers) + { + /* See if this decl-specifier is `typedef'. */ + if (TREE_CODE (TREE_VALUE (decl_specifiers)) == IDENTIFIER_NODE + && C_RID_CODE (TREE_VALUE (decl_specifiers)) == RID_TYPEDEF) + return true; + + /* Go on to the next decl-specifier. */ + decl_specifiers = TREE_CHAIN (decl_specifiers); + } + + return false; +} + + /* If the next token is of the indicated TYPE, consume it. Otherwise, issue an error message indicating that TOKEN_DESC was expected. diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c index e5aadc1..0ae2d23 100644 --- a/contrib/gcc/cp/pt.c +++ b/contrib/gcc/cp/pt.c @@ -744,8 +744,12 @@ check_specialization_namespace (tree tmpl) void maybe_process_partial_specialization (tree type) { - /* TYPE maybe an ERROR_MARK_NODE. */ - tree context = TYPE_P (type) ? TYPE_CONTEXT (type) : NULL_TREE; + tree context; + + if (type == error_mark_node) + return; + + context = TYPE_CONTEXT (type); if (CLASS_TYPE_P (type) && CLASSTYPE_USE_TEMPLATE (type)) { @@ -1779,6 +1783,11 @@ check_explicit_specialization (tree declarator, /* Find the namespace binding, using the declaration context. */ fns = namespace_binding (dname, CP_DECL_CONTEXT (decl)); + if (!fns || !is_overloaded_fn (fns)) + { + error ("`%D' is not a template function", dname); + fns = error_mark_node; + } } declarator = lookup_template_function (fns, NULL_TREE); @@ -2832,9 +2841,8 @@ push_template_decl_real (tree decl, int is_friend) return decl; } } - else if ((DECL_IMPLICIT_TYPEDEF_P (decl) - && CLASS_TYPE_P (TREE_TYPE (decl))) - || (TREE_CODE (decl) == VAR_DECL && ctx && CLASS_TYPE_P (ctx))) + else if (DECL_IMPLICIT_TYPEDEF_P (decl) + && CLASS_TYPE_P (TREE_TYPE (decl))) /* OK */; else { @@ -2973,6 +2981,7 @@ push_template_decl_real (tree decl, int is_friend) error ("got %d template parameters for `%#T'", TREE_VEC_LENGTH (a), current); error (" but %d required", TREE_VEC_LENGTH (t)); + return error_mark_node; } /* Perhaps we should also check that the parms are used in the @@ -3074,10 +3083,9 @@ redeclare_class_template (tree type, tree parms) if (TREE_VEC_LENGTH (parms) != TREE_VEC_LENGTH (tmpl_parms)) { cp_error_at ("previous declaration `%D'", tmpl); - error ("used %d template parameter%s instead of %d", - TREE_VEC_LENGTH (tmpl_parms), - TREE_VEC_LENGTH (tmpl_parms) == 1 ? "" : "s", - TREE_VEC_LENGTH (parms)); + error ("used %d template parameter(s) instead of %d", + TREE_VEC_LENGTH (tmpl_parms), + TREE_VEC_LENGTH (parms)); return; } @@ -4067,18 +4075,9 @@ lookup_template_function (tree fns, tree arglist) return error_mark_node; my_friendly_assert (!arglist || TREE_CODE (arglist) == TREE_VEC, 20030726); - if (fns == NULL_TREE - || TREE_CODE (fns) == FUNCTION_DECL) - { - error ("non-template used as template"); - return error_mark_node; - } - - my_friendly_assert (TREE_CODE (fns) == TEMPLATE_DECL - || TREE_CODE (fns) == OVERLOAD - || BASELINK_P (fns) - || TREE_CODE (fns) == IDENTIFIER_NODE, - 20020730); + my_friendly_assert (fns && (is_overloaded_fn (fns) + || TREE_CODE (fns) == IDENTIFIER_NODE), + 20050608); if (BASELINK_P (fns)) { @@ -4809,11 +4808,14 @@ uses_template_parms (tree t) else if (TREE_CODE (t) == TREE_LIST) dependent_p = (uses_template_parms (TREE_VALUE (t)) || uses_template_parms (TREE_CHAIN (t))); + else if (TREE_CODE (t) == TYPE_DECL) + dependent_p = dependent_type_p (TREE_TYPE (t)); else if (DECL_P (t) || EXPR_P (t) || TREE_CODE (t) == TEMPLATE_PARM_INDEX || TREE_CODE (t) == OVERLOAD || TREE_CODE (t) == BASELINK + || TREE_CODE (t) == IDENTIFIER_NODE || TREE_CODE_CLASS (TREE_CODE (t)) == 'c') dependent_p = (type_dependent_expression_p (t) || value_dependent_expression_p (t)); @@ -5787,6 +5789,12 @@ tsubst_template_parms (tree parms, tree args, tsubst_flags_t complain) tree r = NULL_TREE; tree* new_parms; + /* When substituting into a template, we must set + PROCESSING_TEMPLATE_DECL as the template parameters may be + dependent if they are based on one-another, and the dependency + predicates are short-circuit outside of templates. */ + ++processing_template_decl; + for (new_parms = &r; TMPL_PARMS_DEPTH (parms) > TMPL_ARGS_DEPTH (args); new_parms = &(TREE_CHAIN (*new_parms)), @@ -5816,6 +5824,8 @@ tsubst_template_parms (tree parms, tree args, tsubst_flags_t complain) new_vec, NULL_TREE); } + --processing_template_decl; + return r; } @@ -6001,8 +6011,14 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) : DECL_TI_ARGS (DECL_TEMPLATE_RESULT (t)); tree full_args; + /* Because this is a template, the arguments will still be + dependent, even after substitution. If + PROCESSING_TEMPLATE_DECL is not set, the dependency + predicates will short-circuit. */ + ++processing_template_decl; full_args = tsubst_template_args (tmpl_args, args, complain, in_decl); + --processing_template_decl; /* tsubst_template_args doesn't copy the vector if nothing changed. But, *something* should have @@ -6034,15 +6050,14 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) break; } - DECL_CONTEXT (r) - = tsubst_aggr_type (DECL_CONTEXT (t), args, - complain, in_decl, - /*entering_scope=*/1); DECL_TEMPLATE_INFO (r) = build_tree_list (t, args); if (TREE_CODE (decl) == TYPE_DECL) { - tree new_type = tsubst (TREE_TYPE (t), args, complain, in_decl); + tree new_type; + ++processing_template_decl; + new_type = tsubst (TREE_TYPE (t), args, complain, in_decl); + --processing_template_decl; if (new_type == error_mark_node) return error_mark_node; @@ -6050,10 +6065,14 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) CLASSTYPE_TI_TEMPLATE (new_type) = r; DECL_TEMPLATE_RESULT (r) = TYPE_MAIN_DECL (new_type); DECL_TI_ARGS (r) = CLASSTYPE_TI_ARGS (new_type); + DECL_CONTEXT (r) = TYPE_CONTEXT (new_type); } else { - tree new_decl = tsubst (decl, args, complain, in_decl); + tree new_decl; + ++processing_template_decl; + new_decl = tsubst (decl, args, complain, in_decl); + --processing_template_decl; if (new_decl == error_mark_node) return error_mark_node; @@ -6061,6 +6080,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) DECL_TI_TEMPLATE (new_decl) = r; TREE_TYPE (r) = TREE_TYPE (new_decl); DECL_TI_ARGS (r) = DECL_TI_ARGS (new_decl); + DECL_CONTEXT (r) = DECL_CONTEXT (new_decl); } SET_DECL_IMPLICIT_INSTANTIATION (r); @@ -6292,8 +6312,7 @@ tsubst_decl (tree t, tree args, tree type, tsubst_flags_t complain) clone_function_decl (r, /*update_method_vec_p=*/0); } else if (IDENTIFIER_OPNAME_P (DECL_NAME (r))) - grok_op_properties (r, DECL_FRIEND_P (r), - (complain & tf_error) != 0); + grok_op_properties (r, (complain & tf_error) != 0); if (DECL_FRIEND_P (t) && DECL_FRIEND_CONTEXT (t)) SET_DECL_FRIEND_CONTEXT (r, @@ -6486,6 +6505,8 @@ tsubst_arg_types (tree arg_types, { tree remaining_arg_types; tree type; + tree default_arg; + tree result = NULL_TREE; if (!arg_types || arg_types == void_list_node) return arg_types; @@ -6513,12 +6534,25 @@ tsubst_arg_types (tree arg_types, top-level qualifiers as required. */ type = TYPE_MAIN_VARIANT (type_decays_to (type)); - /* Note that we do not substitute into default arguments here. The - standard mandates that they be instantiated only when needed, - which is done in build_over_call. */ - return hash_tree_cons (TREE_PURPOSE (arg_types), type, - remaining_arg_types); - + /* We do not substitute into default arguments here. The standard + mandates that they be instantiated only when needed, which is + done in build_over_call. */ + default_arg = TREE_PURPOSE (arg_types); + + if (default_arg && TREE_CODE (default_arg) == DEFAULT_ARG) + { + /* We've instantiated a template before its default arguments + have been parsed. This can happen for a nested template + class, and is not an error unless we require the default + argument in a call of this function. */ + result = tree_cons (default_arg, type, remaining_arg_types); + TREE_CHAIN (default_arg) = tree_cons (result, NULL_TREE, + TREE_CHAIN (default_arg)); + } + else + result = hash_tree_cons (default_arg, type, remaining_arg_types); + + return result; } /* Substitute into a FUNCTION_TYPE or METHOD_TYPE. This routine does @@ -6711,8 +6745,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) /* The array dimension behaves like a non-type template arg, in that we want to fold it as much as possible. */ max = tsubst_template_arg (omax, args, complain, in_decl); - if (!processing_template_decl) - max = decl_constant_value (max); + max = fold_non_dependent_expr (max); if (integer_zerop (omax)) { @@ -7774,6 +7807,10 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) in_decl), tsubst (TREE_TYPE (t), args, complain, in_decl)); + case OFFSET_REF: + mark_used (TREE_OPERAND (t, 1)); + return t; + default: return t; } @@ -9158,17 +9195,12 @@ type_unification_real (tree tparms, else type = arg; - if (strict == DEDUCE_EXACT || strict == DEDUCE_ORDER) - { - if (same_type_p (parm, type)) - continue; - } - else - /* It might work; we shouldn't check now, because we might - get into infinite recursion. Overload resolution will - handle it. */ + if (same_type_p (parm, type)) continue; - + if (strict != DEDUCE_EXACT + && can_convert_arg (parm, type, TYPE_P (arg) ? NULL_TREE : arg)) + continue; + return 1; } @@ -12024,7 +12056,8 @@ type_dependent_expression_p (tree expression) return true; expression = TREE_OPERAND (expression, 0); } - if (TREE_CODE (expression) == OVERLOAD) + if (TREE_CODE (expression) == OVERLOAD + || TREE_CODE (expression) == FUNCTION_DECL) { while (expression) { @@ -12037,6 +12070,8 @@ type_dependent_expression_p (tree expression) abort (); } + my_friendly_assert (TREE_CODE (expression) != TYPE_DECL, 20051116); + return (dependent_type_p (TREE_TYPE (expression))); } diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c index 0dfdb92..c227175 100644 --- a/contrib/gcc/cp/search.c +++ b/contrib/gcc/cp/search.c @@ -946,8 +946,12 @@ accessible_p (tree type, tree decl) /* In a template declaration, we cannot be sure whether the particular specialization that is instantiated will be a friend or not. Therefore, all access checks are deferred until - instantiation. */ - if (processing_template_decl) + instantiation. However, PROCESSING_TEMPLATE_DECL is set in the + parameter list for a template (because we may see dependent types + in default arguments for template parameters), and access + checking should be performed in the outermost parameter list. */ + if (processing_template_decl + && (!processing_template_parmlist || processing_template_decl > 1)) return 1; if (!TYPE_P (type)) diff --git a/contrib/gcc/cp/semantics.c b/contrib/gcc/cp/semantics.c index bb2f3c9..943e7a1 100644 --- a/contrib/gcc/cp/semantics.c +++ b/contrib/gcc/cp/semantics.c @@ -2295,7 +2295,9 @@ check_multiple_declarators (void) void qualified_name_lookup_error (tree scope, tree name) { - if (TYPE_P (scope)) + if (scope == error_mark_node) + ; /* We already complained. */ + else if (TYPE_P (scope)) { if (!COMPLETE_TYPE_P (scope)) error ("incomplete type `%T' used in nested name specifier", scope); @@ -2398,6 +2400,21 @@ finish_id_expression (tree id_expression, was entirely defined. */ if (!scope && decl != error_mark_node) maybe_note_name_used_in_class (id_expression, decl); + + /* Disallow uses of local variables from containing functions. */ + if (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) + { + tree context = decl_function_context (decl); + if (context != NULL_TREE && context != current_function_decl + && ! TREE_STATIC (decl)) + { + error (TREE_CODE (decl) == VAR_DECL + ? "use of `auto' variable from containing function" + : "use of parameter from containing function"); + cp_error_at (" `%#D' declared here", decl); + return error_mark_node; + } + } } /* If we didn't find anything, or what we found was a type, @@ -2664,23 +2681,6 @@ finish_id_expression (tree id_expression, } else { - if (TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == PARM_DECL - || TREE_CODE (decl) == RESULT_DECL) - { - tree context = decl_function_context (decl); - - if (context != NULL_TREE && context != current_function_decl - && ! TREE_STATIC (decl)) - { - error ("use of %s from containing function", - (TREE_CODE (decl) == VAR_DECL - ? "`auto' variable" : "parameter")); - cp_error_at (" `%#D' declared here", decl); - return error_mark_node; - } - } - if (DECL_P (decl) && DECL_NONLOCAL (decl) && DECL_CLASS_SCOPE_P (decl) && DECL_CONTEXT (decl) != current_class_type) diff --git a/contrib/gcc/cp/typeck.c b/contrib/gcc/cp/typeck.c index 0c9c6c4..b13fb85 100644 --- a/contrib/gcc/cp/typeck.c +++ b/contrib/gcc/cp/typeck.c @@ -95,6 +95,9 @@ require_complete_type (tree value) else type = TREE_TYPE (value); + if (type == error_mark_node) + return error_mark_node; + /* First, detect a valid value with a complete type. */ if (COMPLETE_TYPE_P (type)) return value; @@ -265,10 +268,12 @@ type_after_usual_arithmetic_conversions (tree t1, tree t2) /* FIXME: Attributes. */ my_friendly_assert (ARITHMETIC_TYPE_P (t1) || TREE_CODE (t1) == COMPLEX_TYPE + || TREE_CODE (t1) == VECTOR_TYPE || TREE_CODE (t1) == ENUMERAL_TYPE, 19990725); my_friendly_assert (ARITHMETIC_TYPE_P (t2) || TREE_CODE (t2) == COMPLEX_TYPE + || TREE_CODE (t2) == VECTOR_TYPE || TREE_CODE (t2) == ENUMERAL_TYPE, 19990725); @@ -296,6 +301,16 @@ type_after_usual_arithmetic_conversions (tree t1, tree t2) attributes); } + if (code1 == VECTOR_TYPE) + { + /* When we get here we should have two vectors of the same size. + Just prefer the unsigned one if present. */ + if (TREE_UNSIGNED (t1)) + return build_type_attribute_variant (t1, attributes); + else + return build_type_attribute_variant (t2, attributes); + } + /* If only one is real, use it as the result. */ if (code1 == REAL_TYPE && code2 != REAL_TYPE) return build_type_attribute_variant (t1, attributes); @@ -745,9 +760,9 @@ common_type (tree t1, tree t2) code2 = TREE_CODE (t2); if ((ARITHMETIC_TYPE_P (t1) || code1 == ENUMERAL_TYPE - || code1 == COMPLEX_TYPE) + || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE) && (ARITHMETIC_TYPE_P (t2) || code2 == ENUMERAL_TYPE - || code2 == COMPLEX_TYPE)) + || code2 == COMPLEX_TYPE || code2 == VECTOR_TYPE)) return type_after_usual_arithmetic_conversions (t1, t2); else if ((TYPE_PTR_P (t1) && TYPE_PTR_P (t2)) @@ -2878,9 +2893,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, case ROUND_DIV_EXPR: case EXACT_DIV_EXPR: if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE - || code0 == COMPLEX_TYPE) + || code0 == COMPLEX_TYPE || code0 == VECTOR_TYPE) && (code1 == INTEGER_TYPE || code1 == REAL_TYPE - || code1 == COMPLEX_TYPE)) + || code1 == COMPLEX_TYPE || code1 == VECTOR_TYPE)) { if (TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1)) warning ("division by zero in `%E / 0'", op0); @@ -2907,7 +2922,8 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, case BIT_AND_EXPR: case BIT_IOR_EXPR: case BIT_XOR_EXPR: - if (code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) + if ((code0 == INTEGER_TYPE && code1 == INTEGER_TYPE) + || (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)) shorten = -1; break; @@ -3158,12 +3174,17 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, break; } - if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE) - && - (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE)) + if (((code0 == INTEGER_TYPE || code0 == REAL_TYPE || code0 == COMPLEX_TYPE) + && + (code1 == INTEGER_TYPE || code1 == REAL_TYPE || code1 == COMPLEX_TYPE)) + || (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE)) { int none_complex = (code0 != COMPLEX_TYPE && code1 != COMPLEX_TYPE); + if (code0 == VECTOR_TYPE && code1 == VECTOR_TYPE + && !tree_int_cst_equal (TYPE_SIZE (type0), TYPE_SIZE (type1))) + error ("can't convert between vector values of different size"); + if (shorten || common || short_compare) result_type = common_type (type0, type1); @@ -4776,7 +4797,7 @@ build_const_cast (tree type, tree expr) { tree intype; - if (type == error_mark_node || expr == error_mark_node) + if (type == error_mark_node || error_operand_p (expr)) return error_mark_node; if (processing_template_decl) @@ -6066,6 +6087,15 @@ check_return_expr (tree retval) /* Remember that this function did return a value. */ current_function_returns_value = 1; + /* Check for erroneous operands -- but after giving ourselves a + chance to provide an error about returning a value from a void + function. */ + if (error_operand_p (retval)) + { + current_function_return_value = error_mark_node; + return error_mark_node; + } + /* Only operator new(...) throw(), can return NULL [expr.new/13]. */ if ((DECL_OVERLOADED_OPERATOR_P (current_function_decl) == NEW_EXPR || DECL_OVERLOADED_OPERATOR_P (current_function_decl) == VEC_NEW_EXPR) @@ -6122,8 +6152,8 @@ check_return_expr (tree retval) /* We don't need to do any conversions when there's nothing being returned. */ - if (!retval || retval == error_mark_node) - return retval; + if (!retval) + return NULL_TREE; /* Do any required conversions. */ if (retval == result || DECL_CONSTRUCTOR_P (current_function_decl)) @@ -6314,11 +6344,6 @@ casts_away_constness_r (tree *t1, tree *t2) and pointers to members (conv.qual), the "member" aspect of a pointer to member level is ignored when determining if a const cv-qualifier has been cast away. */ - if (TYPE_PTRMEM_P (*t1)) - *t1 = build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (*t1)); - if (TYPE_PTRMEM_P (*t2)) - *t2 = build_pointer_type (TYPE_PTRMEM_POINTED_TO_TYPE (*t2)); - /* [expr.const.cast] For two pointer types: @@ -6336,9 +6361,8 @@ casts_away_constness_r (tree *t1, tree *t2) to Tcv2,(M-K+1) * cv2,(M-K+2) * ... cv2,M *. */ - - if (TREE_CODE (*t1) != POINTER_TYPE - || TREE_CODE (*t2) != POINTER_TYPE) + if ((!TYPE_PTR_P (*t1) && !TYPE_PTRMEM_P (*t1)) + || (!TYPE_PTR_P (*t2) && !TYPE_PTRMEM_P (*t2))) { *t1 = cp_build_qualified_type (void_type_node, cp_type_quals (*t1)); @@ -6349,8 +6373,16 @@ casts_away_constness_r (tree *t1, tree *t2) quals1 = cp_type_quals (*t1); quals2 = cp_type_quals (*t2); - *t1 = TREE_TYPE (*t1); - *t2 = TREE_TYPE (*t2); + + if (TYPE_PTRMEM_P (*t1)) + *t1 = TYPE_PTRMEM_POINTED_TO_TYPE (*t1); + else + *t1 = TREE_TYPE (*t1); + if (TYPE_PTRMEM_P (*t2)) + *t2 = TYPE_PTRMEM_POINTED_TO_TYPE (*t2); + else + *t2 = TREE_TYPE (*t2); + casts_away_constness_r (t1, t2); *t1 = build_pointer_type (*t1); *t2 = build_pointer_type (*t2); diff --git a/contrib/gcc/cppfiles.c b/contrib/gcc/cppfiles.c index 9aea34c..04f1a16 100644 --- a/contrib/gcc/cppfiles.c +++ b/contrib/gcc/cppfiles.c @@ -164,7 +164,7 @@ static bool should_stack_file (cpp_reader *, _cpp_file *file, bool import); static struct cpp_dir *search_path_head (cpp_reader *, const char *fname, int angle_brackets, enum include_type); static const char *dir_name_of_file (_cpp_file *file); -static void open_file_failed (cpp_reader *pfile, _cpp_file *file); +static void open_file_failed (cpp_reader *pfile, _cpp_file *file, int); static struct file_hash_entry *search_cache (struct file_hash_entry *head, const cpp_dir *start_dir); static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname); @@ -330,7 +330,7 @@ find_file_in_dir (cpp_reader *pfile, _cpp_file *file, bool *invalid_pch) if (file->err_no != ENOENT) { - open_file_failed (pfile, file); + open_file_failed (pfile, file, 0); return true; } @@ -360,7 +360,7 @@ _cpp_find_failed (_cpp_file *file) to open_file(). */ _cpp_file * -_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool fake) +_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool fake, int angle_brackets) { struct file_hash_entry *entry, **hash_slot; _cpp_file *file; @@ -391,7 +391,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, bool f file->dir = file->dir->next; if (file->dir == NULL) { - open_file_failed (pfile, file); + open_file_failed (pfile, file, angle_brackets); if (invalid_pch) { cpp_error (pfile, CPP_DL_ERROR, @@ -533,7 +533,7 @@ read_file (cpp_reader *pfile, _cpp_file *file) if (file->fd == -1 && !open_file (file)) { - open_file_failed (pfile, file); + open_file_failed (pfile, file, 0); return false; } @@ -757,16 +757,17 @@ _cpp_stack_include (cpp_reader *pfile, const char *fname, int angle_brackets, if (!dir) return false; - return _cpp_stack_file (pfile, _cpp_find_file (pfile, fname, dir, false), + return _cpp_stack_file (pfile, _cpp_find_file (pfile, fname, dir, false, + angle_brackets), type == IT_IMPORT); } /* Could not open FILE. The complication is dependency output. */ static void -open_file_failed (cpp_reader *pfile, _cpp_file *file) +open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets) { int sysp = pfile->map ? pfile->map->sysp: 0; - bool print_dep = CPP_OPTION (pfile, deps.style) > !!sysp; + bool print_dep = CPP_OPTION (pfile, deps.style) > (angle_brackets || !!sysp); errno = file->err_no; if (print_dep && CPP_OPTION (pfile, deps.missing_files) && errno == ENOENT) @@ -948,7 +949,7 @@ _cpp_cleanup_files (cpp_reader *pfile) void _cpp_fake_include (cpp_reader *pfile, const char *fname) { - _cpp_find_file (pfile, fname, pfile->buffer->file->dir, true); + _cpp_find_file (pfile, fname, pfile->buffer->file->dir, true, 0); } /* Not everyone who wants to set system-header-ness on a buffer can @@ -1030,7 +1031,7 @@ _cpp_compare_file_date (cpp_reader *pfile, const char *fname, if (!dir) return -1; - file = _cpp_find_file (pfile, fname, dir, false); + file = _cpp_find_file (pfile, fname, dir, false, angle_brackets); if (file->err_no) return -1; @@ -1070,6 +1071,7 @@ _cpp_pop_file_buffer (cpp_reader *pfile, _cpp_file *file) { free ((void *) file->buffer); file->buffer = NULL; + file->buffer_valid = false; } } diff --git a/contrib/gcc/cpphash.h b/contrib/gcc/cpphash.h index e30cdca..8c814b9 100644 --- a/contrib/gcc/cpphash.h +++ b/contrib/gcc/cpphash.h @@ -516,7 +516,7 @@ extern void _cpp_destroy_hashtable (cpp_reader *); /* In cppfiles.c */ typedef struct _cpp_file _cpp_file; extern _cpp_file *_cpp_find_file (cpp_reader *, const char *fname, - cpp_dir *start_dir, bool fake); + cpp_dir *start_dir, bool fake, int); extern bool _cpp_find_failed (_cpp_file *); extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *); extern void _cpp_fake_include (cpp_reader *, const char *); diff --git a/contrib/gcc/cse.c b/contrib/gcc/cse.c index 447d972..72af39a 100644 --- a/contrib/gcc/cse.c +++ b/contrib/gcc/cse.c @@ -3518,6 +3518,9 @@ fold_rtx (rtx x, rtx insn) addr = addr_ent->const_rtx; } + /* Call target hook to avoid the effects of -fpic etc.... */ + addr = targetm.delegitimize_address (addr); + /* If address is constant, split it into a base and integer offset. */ if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF) base = addr; diff --git a/contrib/gcc/doc/contrib.texi b/contrib/gcc/doc/contrib.texi index 8c24193..3a279cd 100644 --- a/contrib/gcc/doc/contrib.texi +++ b/contrib/gcc/doc/contrib.texi @@ -269,9 +269,12 @@ Ivan Fontes Garcia for the Portugese translation of the GCJ FAQ. Peter Gerwinski for various bug fixes and the Pascal front end. @item -Kaveh Ghazi for his direction via the steering committee, -amazing work to make @samp{-W -Wall} useful, and continuously testing -GCC on a plethora of platforms. +Kaveh R.@: Ghazi for his direction via the steering committee, amazing +work to make @samp{-W -Wall -W* -Werror} useful, and continuously +testing GCC on a plethora of platforms. Kaveh extends his gratitude to +the @uref{http://www.caip.rutgers.edu,,CAIP Center} at Rutgers +University for providing him with computing resources to work on Free +Software since the late 1980s. @item John Gilmore for a donation to the FSF earmarked improving GNU Java. diff --git a/contrib/gcc/doc/hostconfig.texi b/contrib/gcc/doc/hostconfig.texi index 5c38313..8830c6b 100644 --- a/contrib/gcc/doc/hostconfig.texi +++ b/contrib/gcc/doc/hostconfig.texi @@ -42,35 +42,31 @@ This host hook is used to set up handling for extra signals. The most common thing to do in this hook is to detect stack overflow. @end deftypefn -@deftypefn {Host Hook} void * HOST_HOOKS_GT_PCH_GET_ADDRESS (size_t @var{size}) -This host hook returns the address of some space in which a PCH may be -loaded with @samp{HOST_HOOKS_PCH_LOAD_PCH}. The space will need to -have @var{size} bytes. If insufficient space is available, -@samp{NULL} may be returned; the PCH machinery will try to find a -suitable address using a heuristic. - -The memory does not have to be available now. In fact, usually -@samp{HOST_HOOKS_PCH_LOAD_PCH} will already have been called. The memory -need only be available in future invocations of GCC. +@deftypefn {Host Hook} void * HOST_HOOKS_GT_PCH_GET_ADDRESS (size_t @var{size}, int @var{fd}) +This host hook returns the address of some space that is likely to be +free in some subsequent invocation of the compiler. We intend to load +the PCH data at this address such that the data need not be relocated. +The area should be able to hold @var{size} bytes. If the host uses +@code{mmap}, @var{fd} is an open file descriptor that can be used for +probing. @end deftypefn -@deftypefn {Host Hook} bool HOST_HOOKS_GT_PCH_USE_ADDRESS (size_t @var{size}, void * @var{address}) -This host hook is called when a PCH file is about to be loaded. If -@var{address} is the address that would have been returned by -@samp{HOST_HOOKS_PCH_MEMORY_ADDRESS}, and @var{size} is smaller than -the maximum than @samp{HOST_HOOKS_PCH_MEMORY_ADDRESS} would have -accepted, return true, otherwise return false. +@deftypefn {Host Hook} int HOST_HOOKS_GT_PCH_USE_ADDRESS (void * @var{address}, size_t @var{size}, int @var{fd}, size_t @var{offset}) +This host hook is called when a PCH file is about to be loaded. +We want to load @var{size} bytes from @var{fd} at @var{offset} +into memory at @var{address}. The given address will be the result of +a previous invocation of @code{HOST_HOOKS_GT_PCH_GET_ADDRESS}. +Return @minus{}1 if we couldn't allocate @var{size} bytes at @var{address}. +Return 0 if the memory is allocated but the data is not loaded. Return 1 +if the hook has performed everything. -In addition, free any address space reserved that isn't needed to hold -@var{size} bytes (whether or not true is returned). The PCH machinery will -use @samp{mmap} with @samp{MAP_FIXED} to load the PCH if @samp{HAVE_MMAP_FILE}, -or will use @samp{fread} otherwise. - -If no PCH will be loaded, this hook may be called with @var{size} -zero, in which case all reserved address space should be freed. +If the implementation uses reserved address space, free any reserved +space beyond @var{size}, regardless of the return value. If no PCH will +be loaded, this hook may be called with @var{size} zero, in which case +all reserved address space should be freed. Do not try to handle values of @var{address} that could not have been -returned by this executable; just return false. Such values usually +returned by this executable; just return @minus{}1. Such values usually indicate an out-of-date PCH file (built by some other GCC executable), and such a PCH file won't work. @end deftypefn diff --git a/contrib/gcc/doc/include/gcc-common.texi b/contrib/gcc/doc/include/gcc-common.texi index b5e8891..b31ea20 100644 --- a/contrib/gcc/doc/include/gcc-common.texi +++ b/contrib/gcc/doc/include/gcc-common.texi @@ -1,10 +1,10 @@ -@c Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +@c Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @c Common values used in the GCC manuals: -@set version-GCC 3.4.4 +@set version-GCC 3.4.6 @c DEVELOPMENT is set to indicate an in-development version, @c as compared to a release version. When making a release diff --git a/contrib/gcc/doc/invoke.texi b/contrib/gcc/doc/invoke.texi index 3475408..e683d0c 100644 --- a/contrib/gcc/doc/invoke.texi +++ b/contrib/gcc/doc/invoke.texi @@ -3651,7 +3651,8 @@ invoking @option{-O2} on programs that use computed gotos. @opindex O3 Optimize yet more. @option{-O3} turns on all optimizations specified by @option{-O2} and also turns on the @option{-finline-functions}, -@option{-fweb} and @option{-frename-registers} options. +@option{-fweb}, @option{-frename-registers} and @option{-funswitch-loops} +options. @item -O0 @opindex O0 @@ -8691,7 +8692,8 @@ have any affect on which ld is called, it only changes what parameters are passed to that ld. The ld that is called is determined by the @option{--with-ld} configure option, GCC's program search path, and finally by the user's @env{PATH}. The linker used by GCC can be printed -using @samp{which `gcc -print-prog-name=ld`}. +using @samp{which `gcc -print-prog-name=ld`}. This option is only available +on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. @item -mhp-ld @opindex hp-ld @@ -8703,7 +8705,8 @@ which ld is called, it only changes what parameters are passed to that ld. The ld that is called is determined by the @option{--with-ld} configure option, GCC's program search path, and finally by the user's @env{PATH}. The linker used by GCC can be printed using @samp{which -`gcc -print-prog-name=ld`}. +`gcc -print-prog-name=ld`}. This option is only available on the 64 bit +HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}. @item -mlong-calls @opindex mno-long-calls @@ -10075,8 +10078,8 @@ specified separated by a comma. Specify bit size of immediate TLS offsets. Valid values are 14, 22, and 64. -@item -mtune-arch=@var{cpu-type} -@opindex mtune-arch +@item -mtune=@var{cpu-type} +@opindex mtune Tune the instruction scheduling for a particular CPU, Valid values are itanium, itanium1, merced, itanium2, and mckinley. diff --git a/contrib/gcc/expmed.c b/contrib/gcc/expmed.c index a803934..864f78a 100644 --- a/contrib/gcc/expmed.c +++ b/contrib/gcc/expmed.c @@ -389,25 +389,11 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, || (offset * BITS_PER_UNIT % bitsize == 0 && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0)))) { - if (GET_MODE (op0) != fieldmode) - { - if (GET_CODE (op0) == SUBREG) - { - if (GET_MODE (SUBREG_REG (op0)) == fieldmode - || GET_MODE_CLASS (fieldmode) == MODE_INT - || GET_MODE_CLASS (fieldmode) == MODE_PARTIAL_INT) - op0 = SUBREG_REG (op0); - else - /* Else we've got some float mode source being extracted into - a different float mode destination -- this combination of - subregs results in Severe Tire Damage. */ - abort (); - } - if (GET_CODE (op0) == REG) - op0 = gen_rtx_SUBREG (fieldmode, op0, byte_offset); - else - op0 = adjust_address (op0, fieldmode, offset); - } + if (GET_CODE (op0) == MEM) + op0 = adjust_address (op0, fieldmode, offset); + else if (GET_MODE (op0) != fieldmode) + op0 = simplify_gen_subreg (fieldmode, op0, GET_MODE (op0), + byte_offset); emit_move_insn (op0, value); return value; } @@ -622,6 +608,7 @@ store_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, bestmode = GET_MODE (op0); if (bestmode == VOIDmode + || GET_MODE_SIZE (bestmode) < GET_MODE_SIZE (fieldmode) || (SLOW_UNALIGNED_ACCESS (bestmode, MEM_ALIGN (op0)) && GET_MODE_BITSIZE (bestmode) > MEM_ALIGN (op0))) goto insv_loses; @@ -1401,6 +1388,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, xbitpos = bitnum % unit; xop0 = adjust_address (xop0, bestmode, xoffset); + /* Make sure register is big enough for the whole field. */ + if (xoffset * BITS_PER_UNIT + unit + < offset * BITS_PER_UNIT + bitsize) + goto extzv_loses; + /* Fetch it to a register in that size. */ xop0 = force_reg (bestmode, xop0); @@ -1531,6 +1523,11 @@ extract_bit_field (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, xbitpos = bitnum % unit; xop0 = adjust_address (xop0, bestmode, xoffset); + /* Make sure register is big enough for the whole field. */ + if (xoffset * BITS_PER_UNIT + unit + < offset * BITS_PER_UNIT + bitsize) + goto extv_loses; + /* Fetch it to a register in that size. */ xop0 = force_reg (bestmode, xop0); diff --git a/contrib/gcc/f/ChangeLog b/contrib/gcc/f/ChangeLog index bf48201..58cf3e0 100644 --- a/contrib/gcc/f/ChangeLog +++ b/contrib/gcc/f/ChangeLog @@ -1,3 +1,21 @@ +2006-03-05 Release Manager + + * GCC 3.4.6 released. + +2006-01-21 Joseph Myers <joseph@codesourcery.com> + + * g77spec.c (lang_specific_driver): Update copyright notice date. + +2005-12-27 Toon Moene <toon@moene.indiv.nluug.nl> + + PR/25494 + * g77.texi: Corrected entry about catching + Floating Point Exceptions. + +2005-11-30 Release Manager + + * GCC 3.4.5 released. + 2005-05-19 Release Manager * GCC 3.4.4 released. diff --git a/contrib/gcc/f/g77.texi b/contrib/gcc/f/g77.texi index 3d5f83d..2317231 100644 --- a/contrib/gcc/f/g77.texi +++ b/contrib/gcc/f/g77.texi @@ -9415,12 +9415,13 @@ trapfpe () @} @end smallexample -A convenient trick is to compile this something like: +Assuming the above source is in file @file{trapfpe.c}, +then compile this routine as follows: @smallexample -gcc -o libtrapfpe.a trapfpe.c +gcc -c trapfpe.c @end smallexample -and then use it by adding @option{-trapfpe} to the @command{g77} command line -when linking. +and subsequently use it by adding @file{trapfpe.o} to the @command{g77} +command line when linking. @node Nonportable Conversions @subsection Nonportable Conversions diff --git a/contrib/gcc/flow.c b/contrib/gcc/flow.c index fed908d..9f1e1b7 100644 --- a/contrib/gcc/flow.c +++ b/contrib/gcc/flow.c @@ -104,7 +104,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA life_analysis fills in certain vectors containing information about register usage: REG_N_REFS, REG_N_DEATHS, REG_N_SETS, REG_LIVE_LENGTH, - REG_N_CALLS_CROSSED and REG_BASIC_BLOCK. + REG_N_CALLS_CROSSED, REG_N_THROWING_CALLS_CROSSED and REG_BASIC_BLOCK. life_analysis sets current_function_sp_is_unchanging if the function doesn't modify the stack pointer. */ @@ -1470,6 +1470,7 @@ allocate_reg_life_data (void) REG_N_REFS (i) = 0; REG_N_DEATHS (i) = 0; REG_N_CALLS_CROSSED (i) = 0; + REG_N_THROWING_CALLS_CROSSED (i) = 0; REG_LIVE_LENGTH (i) = 0; REG_FREQ (i) = 0; REG_BASIC_BLOCK (i) = REG_BLOCK_UNKNOWN; @@ -1688,8 +1689,13 @@ propagate_one_insn (struct propagate_block_info *pbi, rtx insn) record this for them. */ if (GET_CODE (insn) == CALL_INSN && (flags & PROP_REG_INFO)) - EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, - { REG_N_CALLS_CROSSED (i)++; }); + { + EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, + { REG_N_CALLS_CROSSED (i)++; }); + if (can_throw_internal (insn)) + EXECUTE_IF_SET_IN_REG_SET (pbi->reg_live, 0, i, + { REG_N_THROWING_CALLS_CROSSED (i)++; }); + } /* Record sets. Do this even for dead instructions, since they would have killed the values if they hadn't been deleted. */ @@ -3365,7 +3371,11 @@ attempt_auto_inc (struct propagate_block_info *pbi, rtx inc, rtx insn, that REGNO now crosses them. */ for (temp = insn; temp != incr; temp = NEXT_INSN (temp)) if (GET_CODE (temp) == CALL_INSN) - REG_N_CALLS_CROSSED (regno)++; + { + REG_N_CALLS_CROSSED (regno)++; + if (can_throw_internal (temp)) + REG_N_THROWING_CALLS_CROSSED (regno)++; + } /* Invalidate alias info for Q since we just changed its value. */ clear_reg_alias_info (q); diff --git a/contrib/gcc/fold-const.c b/contrib/gcc/fold-const.c index b34422f..cc2698d 100644 --- a/contrib/gcc/fold-const.c +++ b/contrib/gcc/fold-const.c @@ -1467,33 +1467,36 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc) case RDIV_EXPR: { + tree t1, t2, real, imag; tree magsquared = const_binop (PLUS_EXPR, const_binop (MULT_EXPR, r2, r2, notrunc), const_binop (MULT_EXPR, i2, i2, notrunc), notrunc); - t = build_complex (type, - const_binop - (INTEGRAL_TYPE_P (TREE_TYPE (r1)) - ? TRUNC_DIV_EXPR : RDIV_EXPR, - const_binop (PLUS_EXPR, - const_binop (MULT_EXPR, r1, r2, - notrunc), - const_binop (MULT_EXPR, i1, i2, - notrunc), - notrunc), - magsquared, notrunc), - const_binop - (INTEGRAL_TYPE_P (TREE_TYPE (r1)) - ? TRUNC_DIV_EXPR : RDIV_EXPR, - const_binop (MINUS_EXPR, - const_binop (MULT_EXPR, i1, r2, - notrunc), - const_binop (MULT_EXPR, r1, i2, - notrunc), - notrunc), - magsquared, notrunc)); + t1 = const_binop (PLUS_EXPR, + const_binop (MULT_EXPR, r1, r2, notrunc), + const_binop (MULT_EXPR, i1, i2, notrunc), + notrunc); + t2 = const_binop (MINUS_EXPR, + const_binop (MULT_EXPR, i1, r2, notrunc), + const_binop (MULT_EXPR, r1, i2, notrunc), + notrunc); + + if (INTEGRAL_TYPE_P (TREE_TYPE (r1))) + { + real = const_binop (TRUNC_DIV_EXPR, t1, magsquared, notrunc); + imag = const_binop (TRUNC_DIV_EXPR, t2, magsquared, notrunc); + } + else + { + real = const_binop (RDIV_EXPR, t1, magsquared, notrunc); + imag = const_binop (RDIV_EXPR, t2, magsquared, notrunc); + if (!real || !imag) + return NULL_TREE; + } + + t = build_complex (type, real, imag); } break; @@ -7497,6 +7500,8 @@ fold (tree expr) else if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE && TREE_CODE (arg0) == NOP_EXPR && (tem = get_unwidened (arg0, NULL_TREE)) != arg0 + && (TYPE_PRECISION (TREE_TYPE (tem)) + > TYPE_PRECISION (TREE_TYPE (arg0))) && (code == EQ_EXPR || code == NE_EXPR || TREE_UNSIGNED (TREE_TYPE (arg0)) == TREE_UNSIGNED (TREE_TYPE (tem))) @@ -8137,7 +8142,12 @@ fold (tree expr) if (INTEGRAL_TYPE_P (type) && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST - && TREE_CODE (arg2) == INTEGER_CST) + && TREE_CODE (arg2) == INTEGER_CST + /* ??? We somehow can end up here with + (unsigned int)1 == 1 ? 1U : 2U + for which we won't make any progress but recurse + indefinitely. Just stop here in this case. */ + && TREE_CODE (arg1) != INTEGER_CST) switch (comp_code) { case EQ_EXPR: @@ -8194,8 +8204,9 @@ fold (tree expr) /* If the second operand is simpler than the third, swap them since that produces better jump optimization results. */ - if (tree_swap_operands_p (TREE_OPERAND (t, 1), - TREE_OPERAND (t, 2), false)) + if (truth_value_p (TREE_CODE (arg0)) + && tree_swap_operands_p (TREE_OPERAND (t, 1), + TREE_OPERAND (t, 2), false)) { /* See if this can be inverted. If it can't, possibly because it was a floating-point inequality comparison, don't do @@ -8431,7 +8442,7 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht) { void **slot; enum tree_code code; - char buf[sizeof (struct tree_decl)]; + struct tree_decl buf; int i, len; if (sizeof (struct tree_exp) + 5 * sizeof (tree) @@ -8448,23 +8459,23 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht) if (code == SAVE_EXPR && SAVE_EXPR_NOPLACEHOLDER (expr)) { /* Allow SAVE_EXPR_NOPLACEHOLDER flag to be modified. */ - memcpy (buf, expr, tree_size (expr)); - expr = (tree) buf; + memcpy (&buf, expr, tree_size (expr)); + expr = (tree) &buf; SAVE_EXPR_NOPLACEHOLDER (expr) = 0; } else if (TREE_CODE_CLASS (code) == 'd' && DECL_ASSEMBLER_NAME_SET_P (expr)) { /* Allow DECL_ASSEMBLER_NAME to be modified. */ - memcpy (buf, expr, tree_size (expr)); - expr = (tree) buf; + memcpy (&buf, expr, tree_size (expr)); + expr = (tree) &buf; SET_DECL_ASSEMBLER_NAME (expr, NULL); } else if (TREE_CODE_CLASS (code) == 't' && (TYPE_POINTER_TO (expr) || TYPE_REFERENCE_TO (expr))) { /* Allow TYPE_POINTER_TO and TYPE_REFERENCE_TO to be modified. */ - memcpy (buf, expr, tree_size (expr)); - expr = (tree) buf; + memcpy (&buf, expr, tree_size (expr)); + expr = (tree) &buf; TYPE_POINTER_TO (expr) = NULL; TYPE_REFERENCE_TO (expr) = NULL; } diff --git a/contrib/gcc/gcov-dump.c b/contrib/gcc/gcov-dump.c index e011562..7e3921a 100644 --- a/contrib/gcc/gcov-dump.c +++ b/contrib/gcc/gcov-dump.c @@ -1,5 +1,5 @@ /* Dump a gcov file, for debugging use. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. Contributed by Nathan Sidwell <nathan@codesourcery.com> Gcov is free software; you can redistribute it and/or modify @@ -118,7 +118,7 @@ static void print_version (void) { printf ("gcov-dump (GCC) %s\n", version_string); - printf ("Copyright (C) 2003 Free Software Foundation, Inc.\n"); + printf ("Copyright (C) 2006 Free Software Foundation, Inc.\n"); printf ("This is free software; see the source for copying conditions.\n" "There is NO warranty; not even for MERCHANTABILITY or \n" "FITNESS FOR A PARTICULAR PURPOSE.\n\n"); diff --git a/contrib/gcc/gcov.c b/contrib/gcc/gcov.c index 172f9e8..e230e39 100644 --- a/contrib/gcc/gcov.c +++ b/contrib/gcc/gcov.c @@ -1,7 +1,7 @@ /* Gcov.c: prepend line execution counts and branch probabilities to a source file. - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by James E. Wilson of Cygnus Support. Mangled by Bob Manson of Cygnus Support. Mangled further by Nathan Sidwell <nathan@codesourcery.com> @@ -420,7 +420,7 @@ static void print_version (void) { fnotice (stdout, "gcov (GCC) %s\n", version_string); - fprintf (stdout, "Copyright %s 2004 Free Software Foundation, Inc.\n", + fprintf (stdout, "Copyright %s 2006 Free Software Foundation, Inc.\n", _("(C)")); fnotice (stdout, _("This is free software; see the source for copying conditions.\n" diff --git a/contrib/gcc/gcse.c b/contrib/gcc/gcse.c index d06a224..d785c7e 100644 --- a/contrib/gcc/gcse.c +++ b/contrib/gcc/gcse.c @@ -6445,7 +6445,7 @@ hoist_code (void) insn_inserted_p = 0; /* These tests should be the same as the tests above. */ - if (TEST_BIT (hoist_vbeout[bb->index], i)) + if (TEST_BIT (hoist_exprs[bb->index], i)) { /* We've found a potentially hoistable expression, now we look at every block BB dominates to see if it diff --git a/contrib/gcc/ggc-common.c b/contrib/gcc/ggc-common.c index ecd6624..5830591 100644 --- a/contrib/gcc/ggc-common.c +++ b/contrib/gcc/ggc-common.c @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "params.h" #include "hosthooks.h" +#include "hosthooks-def.h" #ifdef HAVE_SYS_RESOURCE_H # include <sys/resource.h> @@ -458,21 +459,8 @@ gt_pch_save (FILE *f) and on the rest it's a lot of work to do better. (The extra work goes in HOST_HOOKS_GT_PCH_GET_ADDRESS and HOST_HOOKS_GT_PCH_USE_ADDRESS.) */ - mmi.preferred_base = host_hooks.gt_pch_get_address (mmi.size); + mmi.preferred_base = host_hooks.gt_pch_get_address (mmi.size, fileno (f)); -#if HAVE_MMAP_FILE - if (mmi.preferred_base == NULL) - { - mmi.preferred_base = mmap (NULL, mmi.size, - PROT_READ | PROT_WRITE, MAP_PRIVATE, - fileno (state.f), 0); - if (mmi.preferred_base == (void *) MAP_FAILED) - mmi.preferred_base = NULL; - else - munmap (mmi.preferred_base, mmi.size); - } -#endif /* HAVE_MMAP_FILE */ - ggc_pch_this_base (state.d, mmi.preferred_base); state.ptrs = xmalloc (state.count * sizeof (*state.ptrs)); @@ -526,7 +514,8 @@ gt_pch_save (FILE *f) state.ptrs[i]->note_ptr_cookie, relocate_ptrs, &state); ggc_pch_write_object (state.d, state.f, state.ptrs[i]->obj, - state.ptrs[i]->new_addr, state.ptrs[i]->size, state.ptrs[i]->note_ptr_fn == gt_pch_p_S); + state.ptrs[i]->new_addr, state.ptrs[i]->size, + state.ptrs[i]->note_ptr_fn == gt_pch_p_S); if (state.ptrs[i]->note_ptr_fn != gt_pch_p_S) memcpy (state.ptrs[i]->obj, this_object, state.ptrs[i]->size); } @@ -546,8 +535,7 @@ gt_pch_restore (FILE *f) const struct ggc_root_tab *rti; size_t i; struct mmap_info mmi; - void *addr; - bool needs_read; + int result; /* Delete any deletable objects. This makes ggc_pch_read much faster, as it can be sure that no GCable objects remain other @@ -580,110 +568,95 @@ gt_pch_restore (FILE *f) if (fread (&mmi, sizeof (mmi), 1, f) != 1) fatal_error ("can't read PCH file: %m"); - if (host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size)) - { -#if HAVE_MMAP_FILE - void *mmap_result; - - mmap_result = mmap (mmi.preferred_base, mmi.size, - PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, - fileno (f), mmi.offset); - - /* The file might not be mmap-able. */ - needs_read = mmap_result == (void *) MAP_FAILED; - - /* Sanity check for broken MAP_FIXED. */ - if (! needs_read && mmap_result != mmi.preferred_base) - abort (); -#else - needs_read = true; -#endif - addr = mmi.preferred_base; - } - else - { -#if HAVE_MMAP_FILE - addr = mmap (mmi.preferred_base, mmi.size, - PROT_READ | PROT_WRITE, MAP_PRIVATE, - fileno (f), mmi.offset); - -#if HAVE_MINCORE - if (addr != mmi.preferred_base) - { - size_t page_size = getpagesize(); - char one_byte; - - if (addr != (void *) MAP_FAILED) - munmap (addr, mmi.size); - - /* We really want to be mapped at mmi.preferred_base - so we're going to resort to MAP_FIXED. But before, - make sure that we can do so without destroying a - previously mapped area, by looping over all pages - that would be affected by the fixed mapping. */ - errno = 0; - - for (i = 0; i < mmi.size; i+= page_size) - if (mincore ((char *)mmi.preferred_base + i, page_size, - (void *)&one_byte) == -1 - && errno == ENOMEM) - continue; /* The page is not mapped. */ - else - break; - - if (i >= mmi.size) - addr = mmap (mmi.preferred_base, mmi.size, - PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FIXED, - fileno (f), mmi.offset); - } -#endif /* HAVE_MINCORE */ - - needs_read = addr == (void *) MAP_FAILED; - -#else /* HAVE_MMAP_FILE */ - needs_read = true; -#endif /* HAVE_MMAP_FILE */ - if (needs_read) - addr = xmalloc (mmi.size); - } - - if (needs_read) + result = host_hooks.gt_pch_use_address (mmi.preferred_base, mmi.size, + fileno (f), mmi.offset); + if (result < 0) + fatal_error ("had to relocate PCH"); + if (result == 0) { if (fseek (f, mmi.offset, SEEK_SET) != 0 - || fread (&mmi, mmi.size, 1, f) != 1) + || fread (mmi.preferred_base, mmi.size, 1, f) != 1) fatal_error ("can't read PCH file: %m"); } else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) fatal_error ("can't read PCH file: %m"); - ggc_pch_read (f, addr); + ggc_pch_read (f, mmi.preferred_base); - if (addr != mmi.preferred_base) - { - for (rt = gt_ggc_rtab; *rt; rt++) - for (rti = *rt; rti->base != NULL; rti++) - for (i = 0; i < rti->nelt; i++) - { - char **ptr = (char **)((char *)rti->base + rti->stride * i); - if (*ptr != NULL) - *ptr += (size_t)addr - (size_t)mmi.preferred_base; - } + gt_pch_restore_stringpool (); +} - for (rt = gt_pch_cache_rtab; *rt; rt++) - for (rti = *rt; rti->base != NULL; rti++) - for (i = 0; i < rti->nelt; i++) - { - char **ptr = (char **)((char *)rti->base + rti->stride * i); - if (*ptr != NULL) - *ptr += (size_t)addr - (size_t)mmi.preferred_base; - } +/* Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is not present. + Select no address whatsoever, and let gt_pch_save choose what it will with + malloc, presumably. */ - sorry ("had to relocate PCH"); - } +void * +default_gt_pch_get_address (size_t size ATTRIBUTE_UNUSED, + int fd ATTRIBUTE_UNUSED) +{ + return NULL; +} - gt_pch_restore_stringpool (); +/* Default version of HOST_HOOKS_GT_PCH_USE_ADDRESS when mmap is not present. + Allocate SIZE bytes with malloc. Return 0 if the address we got is the + same as base, indicating that the memory has been allocated but needs to + be read in from the file. Return -1 if the address differs, to relocation + of the PCH file would be required. */ + +int +default_gt_pch_use_address (void *base, size_t size, int fd ATTRIBUTE_UNUSED, + size_t offset ATTRIBUTE_UNUSED) +{ + void *addr = xmalloc (size); + return (addr == base) - 1; } +#if HAVE_MMAP_FILE +/* Default version of HOST_HOOKS_GT_PCH_GET_ADDRESS when mmap is present. + We temporarily allocate SIZE bytes, and let the kernel place the data + whereever it will. If it worked, that's our spot, if not we're likely + to be in trouble. */ + +void * +mmap_gt_pch_get_address (size_t size, int fd) +{ + void *ret; + + ret = mmap (NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); + if (ret == (void *) MAP_FAILED) + ret = NULL; + else + munmap (ret, size); + + return ret; +} + +/* Default version of HOST_HOOKS_GT_PCH_USE_ADDRESS when mmap is present. + Map SIZE bytes of FD+OFFSET at BASE. Return 1 if we succeeded at + mapping the data at BASE, -1 if we couldn't. + + This version assumes that the kernel honors the START operand of mmap + even without MAP_FIXED if START through START+SIZE are not currently + mapped with something. */ + +int +mmap_gt_pch_use_address (void *base, size_t size, int fd, size_t offset) +{ + void *addr; + + /* We're called with size == 0 if we're not planning to load a PCH + file at all. This allows the hook to free any static space that + we might have allocated at link time. */ + if (size == 0) + return -1; + + addr = mmap (base, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, + fd, offset); + + return addr == base ? 1 : -1; + } +#endif /* HAVE_MMAP_FILE */ + /* Modify the bound based on rlimits. Keep the smallest number found. */ static double ggc_rlimit_bound (double limit) diff --git a/contrib/gcc/global.c b/contrib/gcc/global.c index de765b3..13e41cb 100644 --- a/contrib/gcc/global.c +++ b/contrib/gcc/global.c @@ -96,6 +96,9 @@ struct allocno /* Number of calls crossed by each allocno. */ int calls_crossed; + /* Number of calls that might throw crossed by each allocno. */ + int throwing_calls_crossed; + /* Number of refs to each allocno. */ int n_refs; @@ -469,6 +472,8 @@ global_alloc (FILE *file) allocno[num].reg = i; allocno[num].size = PSEUDO_REGNO_SIZE (i); allocno[num].calls_crossed += REG_N_CALLS_CROSSED (i); + allocno[num].throwing_calls_crossed + += REG_N_THROWING_CALLS_CROSSED (i); allocno[num].n_refs += REG_N_REFS (i); allocno[num].freq += REG_FREQ (i); if (allocno[num].live_length < REG_LIVE_LENGTH (i)) @@ -1187,9 +1192,11 @@ find_reg (int num, HARD_REG_SET losers, int alt_regs_p, int accept_call_clobbere { /* Did not find a register. If it would be profitable to allocate a call-clobbered register and save and restore it - around calls, do that. */ + around calls, do that. Don't do this if it crosses any calls + that might throw. */ if (! accept_call_clobbered && allocno[num].calls_crossed != 0 + && allocno[num].throwing_calls_crossed == 0 && CALLER_SAVE_PROFITABLE (allocno[num].n_refs, allocno[num].calls_crossed)) { diff --git a/contrib/gcc/hooks.c b/contrib/gcc/hooks.c index 06a5732..9179938 100644 --- a/contrib/gcc/hooks.c +++ b/contrib/gcc/hooks.c @@ -213,21 +213,6 @@ hook_rtx_tree_int_null (tree a ATTRIBUTE_UNUSED, int b ATTRIBUTE_UNUSED) return NULL; } -/* Generic hook that takes a size_t and returns NULL. */ -void * -hook_voidp_size_t_null (size_t a ATTRIBUTE_UNUSED) -{ - return NULL; -} - -/* Generic hook that takes a size_t and a pointer and returns false. */ -bool -hook_bool_voidp_size_t_false (void * a ATTRIBUTE_UNUSED, - size_t b ATTRIBUTE_UNUSED) -{ - return false; -} - /* Generic hook that takes a tree and returns a NULL string. */ const char * hook_constcharptr_tree_null (tree t ATTRIBUTE_UNUSED) diff --git a/contrib/gcc/hooks.h b/contrib/gcc/hooks.h index 8f4c24f..4547e04 100644 --- a/contrib/gcc/hooks.h +++ b/contrib/gcc/hooks.h @@ -58,7 +58,5 @@ extern bool hook_bool_tree_tree_false (tree, tree); extern rtx hook_rtx_rtx_identity (rtx); extern rtx hook_rtx_rtx_null (rtx); extern rtx hook_rtx_tree_int_null (tree, int); -extern void * hook_voidp_size_t_null (size_t); -extern bool hook_bool_voidp_size_t_false (void *, size_t); extern const char *hook_constcharptr_tree_null (tree); #endif diff --git a/contrib/gcc/hosthooks-def.h b/contrib/gcc/hosthooks-def.h index b1a41e7..537ac6f 100644 --- a/contrib/gcc/hosthooks-def.h +++ b/contrib/gcc/hosthooks-def.h @@ -24,8 +24,18 @@ Boston, MA 02111-1307, USA. */ #include "hooks.h" #define HOST_HOOKS_EXTRA_SIGNALS hook_void_void -#define HOST_HOOKS_GT_PCH_GET_ADDRESS hook_voidp_size_t_null -#define HOST_HOOKS_GT_PCH_USE_ADDRESS hook_bool_voidp_size_t_false +#if HAVE_MMAP_FILE +#define HOST_HOOKS_GT_PCH_GET_ADDRESS mmap_gt_pch_get_address +#define HOST_HOOKS_GT_PCH_USE_ADDRESS mmap_gt_pch_use_address +#else +#define HOST_HOOKS_GT_PCH_GET_ADDRESS default_gt_pch_get_address +#define HOST_HOOKS_GT_PCH_USE_ADDRESS default_gt_pch_use_address +#endif + +extern void* default_gt_pch_get_address (size_t, int); +extern int default_gt_pch_use_address (void *, size_t, int, size_t); +extern void* mmap_gt_pch_get_address (size_t, int); +extern int mmap_gt_pch_use_address (void *, size_t, int, size_t); /* The structure is defined in hosthooks.h. */ #define HOST_HOOKS_INITIALIZER { \ diff --git a/contrib/gcc/hosthooks.h b/contrib/gcc/hosthooks.h index bbc28f6..a3fc0c7 100644 --- a/contrib/gcc/hosthooks.h +++ b/contrib/gcc/hosthooks.h @@ -25,8 +25,16 @@ struct host_hooks { void (*extra_signals) (void); - void * (*gt_pch_get_address) (size_t); - bool (*gt_pch_use_address) (void *, size_t); + /* Identify an address that's likely to be free in a subsequent invocation + of the compiler. The area should be able to hold SIZE bytes. FD is an + open file descriptor if the host would like to probe with mmap. */ + void * (*gt_pch_get_address) (size_t size, int fd); + + /* ADDR is an address returned by gt_pch_get_address. Attempt to allocate + SIZE bytes at the same address and load it with the data from FD at + OFFSET. Return -1 if we couldn't allocate memory at ADDR, return 0 + if the memory is allocated but the data not loaded, return 1 if done. */ + int (*gt_pch_use_address) (void *addr, size_t size, int fd, size_t offset); /* Whenever you add entries here, make sure you adjust hosthooks-def.h. */ }; diff --git a/contrib/gcc/local-alloc.c b/contrib/gcc/local-alloc.c index 61ff7fb..6b1203d 100644 --- a/contrib/gcc/local-alloc.c +++ b/contrib/gcc/local-alloc.c @@ -120,6 +120,11 @@ struct qty int n_calls_crossed; + /* Number of times a reg tied to given qty lives across a CALL_INSN + that might throw. */ + + int n_throwing_calls_crossed; + /* The register number of one pseudo register whose reg_qty value is Q. This register should be the head of the chain maintained in reg_next_in_qty. */ @@ -317,6 +322,7 @@ alloc_qty (int regno, enum machine_mode mode, int size, int birth) qty[qtyno].mode = mode; qty[qtyno].birth = birth; qty[qtyno].n_calls_crossed = REG_N_CALLS_CROSSED (regno); + qty[qtyno].n_throwing_calls_crossed = REG_N_THROWING_CALLS_CROSSED (regno); qty[qtyno].min_class = reg_preferred_class (regno); qty[qtyno].alternate_class = reg_alternate_class (regno); qty[qtyno].n_refs = REG_N_REFS (regno); @@ -1119,6 +1125,7 @@ update_equiv_regs (void) REG_BASIC_BLOCK (regno) = bb->index; REG_N_CALLS_CROSSED (regno) = 0; + REG_N_THROWING_CALLS_CROSSED (regno) = 0; REG_LIVE_LENGTH (regno) = 2; if (insn == BB_HEAD (bb)) @@ -1946,6 +1953,8 @@ combine_regs (rtx usedreg, rtx setreg, int may_save_copy, int insn_number, /* Update info about quantity SQTY. */ qty[sqty].n_calls_crossed += REG_N_CALLS_CROSSED (sreg); + qty[sqty].n_throwing_calls_crossed + += REG_N_THROWING_CALLS_CROSSED (sreg); qty[sqty].n_refs += REG_N_REFS (sreg); qty[sqty].freq += REG_FREQ (sreg); if (usize < ssize) @@ -2251,12 +2260,14 @@ find_free_reg (enum reg_class class, enum machine_mode mode, int qtyno, /* We need not check to see if the current function has nonlocal labels because we don't put any pseudos that are live over calls in - registers in that case. */ + registers in that case. Avoid putting pseudos crossing calls that + might throw into call used registers. */ if (! accept_call_clobbered && flag_caller_saves && ! just_try_suggested && qty[qtyno].n_calls_crossed != 0 + && qty[qtyno].n_throwing_calls_crossed == 0 && CALLER_SAVE_PROFITABLE (qty[qtyno].n_refs, qty[qtyno].n_calls_crossed)) { diff --git a/contrib/gcc/longlong.h b/contrib/gcc/longlong.h index e59e712..45d649f 100644 --- a/contrib/gcc/longlong.h +++ b/contrib/gcc/longlong.h @@ -1,6 +1,6 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. - Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000 - Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2005 Free Software Foundation, Inc. This definition file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public @@ -646,7 +646,9 @@ UDItype __umulsidi3 (USItype, USItype); || defined (__powerpc__) /* gcc */ \ || defined (__POWERPC__) /* BEOS */ \ || defined (__ppc__) /* Darwin */ \ - || defined (PPC) /* GNU/Linux, SysV */ \ + || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \ + || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \ + && CPU_FAMILY == PPC) \ ) && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ @@ -684,7 +686,10 @@ UDItype __umulsidi3 (USItype, USItype); __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x)) #define COUNT_LEADING_ZEROS_0 32 #if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \ - || defined (__ppc__) || defined (PPC) + || defined (__ppc__) \ + || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \ + || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \ + && CPU_FAMILY == PPC) #define umul_ppmm(ph, pl, m0, m1) \ do { \ USItype __m0 = (m0), __m1 = (m1); \ diff --git a/contrib/gcc/loop.c b/contrib/gcc/loop.c index 4ddd77a..fa74b8e 100644 --- a/contrib/gcc/loop.c +++ b/contrib/gcc/loop.c @@ -8396,17 +8396,6 @@ check_dbra_loop (struct loop *loop, int insn_count) /* First check if we can do a vanilla loop reversal. */ if (initial_value == const0_rtx - /* If we have a decrement_and_branch_on_count, - prefer the NE test, since this will allow that - instruction to be generated. Note that we must - use a vanilla loop reversal if the biv is used to - calculate a giv or has a non-counting use. */ -#if ! defined (HAVE_decrement_and_branch_until_zero) \ -&& defined (HAVE_decrement_and_branch_on_count) - && (! (add_val == 1 && loop->vtop - && (bl->biv_count == 0 - || no_use_except_counting))) -#endif && GET_CODE (comparison_value) == CONST_INT /* Now do postponed overflow checks on COMPARISON_VAL. */ && ! (((comparison_val - add_val) ^ INTVAL (comparison_value)) @@ -8418,13 +8407,6 @@ check_dbra_loop (struct loop *loop, int insn_count) nonneg = 1; cmp_code = GE; } - else if (add_val == 1 && loop->vtop - && (bl->biv_count == 0 - || no_use_except_counting)) - { - add_adjust = 0; - cmp_code = NE; - } else return 0; diff --git a/contrib/gcc/md5.c b/contrib/gcc/md5.c index e458f2a..7a202d8 100644 --- a/contrib/gcc/md5.c +++ b/contrib/gcc/md5.c @@ -236,6 +236,23 @@ md5_process_bytes (buffer, len, ctx) /* Process available complete blocks. */ if (len > 64) { +#if !_STRING_ARCH_unaligned +/* To check alignment gcc has an appropriate operator. Other + compilers don't. */ +# if __GNUC__ >= 2 +# define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0) +# else +# define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0) +# endif + if (UNALIGNED_P (buffer)) + while (len > 64) + { + md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } + else +#endif md5_process_block (buffer, len & ~63, ctx); buffer = (const void *) ((const char *) buffer + (len & ~63)); len &= 63; diff --git a/contrib/gcc/md5.h b/contrib/gcc/md5.h index ad51f19..4d6161c 100644 --- a/contrib/gcc/md5.h +++ b/contrib/gcc/md5.h @@ -27,6 +27,8 @@ # include <limits.h> #endif +#include "ansidecl.h" + /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but @@ -37,6 +39,7 @@ #ifdef _LIBC # include <sys/types.h> typedef u_int32_t md5_uint32; +typedef uintptr_t md5_uintptr; #else # define INT_MAX_32_BITS 2147483647 @@ -64,6 +67,9 @@ typedef u_int32_t md5_uint32; # endif # endif # endif +/* We have to make a guess about the integer type equivalent in size + to pointers which should always be correct. */ +typedef unsigned long int md5_uintptr; #endif #undef __P @@ -83,7 +89,7 @@ struct md5_ctx md5_uint32 total[2]; md5_uint32 buflen; - char buffer[128]; + char buffer[128] ATTRIBUTE_ALIGNED_ALIGNOF(md5_uint32); }; /* diff --git a/contrib/gcc/mips-tdump.c b/contrib/gcc/mips-tdump.c index e25c175..04d66c7 100644 --- a/contrib/gcc/mips-tdump.c +++ b/contrib/gcc/mips-tdump.c @@ -1,5 +1,5 @@ /* Read and manage MIPS symbol tables from object modules. - Copyright (C) 1991, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2003 + Copyright (C) 1991, 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2003, 2006 Free Software Foundation, Inc. Contributed by hartzell@boulder.colorado.edu, Rewritten by meissner@osf.org. @@ -1412,7 +1412,7 @@ main (int argc, char **argv) if (version) { printf ("mips-tdump (GCC) %s\n", version_string); - fputs ("Copyright (C) 2003 Free Software Foundation, Inc.\n", stdout); + fputs ("Copyright (C) 2006 Free Software Foundation, Inc.\n", stdout); fputs ("This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n", stdout); diff --git a/contrib/gcc/mips-tfile.c b/contrib/gcc/mips-tfile.c index 9b33306..3156e31 100644 --- a/contrib/gcc/mips-tfile.c +++ b/contrib/gcc/mips-tfile.c @@ -3,7 +3,7 @@ in the form of comments (the mips assembler does not support assembly access to debug information). Copyright (C) 1991, 1993, 1994, 1995, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2006 Free Software Foundation, Inc. Contributed by Michael Meissner (meissner@cygnus.com). This file is part of GCC. @@ -4774,7 +4774,7 @@ main (int argc, char **argv) if (version) { printf (_("mips-tfile (GCC) %s\n"), version_string); - fputs ("Copyright (C) 2004 Free Software Foundation, Inc.\n", stdout); + fputs ("Copyright (C) 2006 Free Software Foundation, Inc.\n", stdout); fputs (_("This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"), stdout); diff --git a/contrib/gcc/mklibgcc.in b/contrib/gcc/mklibgcc.in index 143b4e8..8fafce4 100644 --- a/contrib/gcc/mklibgcc.in +++ b/contrib/gcc/mklibgcc.in @@ -246,6 +246,9 @@ for file in $LIB2ADDEH; do fi done +# Flag whether we need eh_dummy.c +need_eh_dummy= + if [ "$SHLIB_LINK" ]; then # Those should be in libgcc_eh.a. for file in $LIB2ADDEHSTATIC; do @@ -260,6 +263,23 @@ if [ "$SHLIB_LINK" ]; then oname=`echo $name | sed -e 's,.*/,,'` libgcc2_eh_shared_objs="$libgcc2_eh_shared_objs ${oname}${objext}" done + + # If nothing went into libgcc_eh.a, create a dummy object - + # some linkers don't like totally empty archives. + if [ -z "$LIB2ADDEHSTATIC" ]; then + file=eh_dummy.c + libgcc2_eh_static_objs="$libgcc2_eh_static_objs eh_dummy${objext}" + need_eh_dummy=1 + + for ml in $MULTILIBS; do + dir=`echo ${ml} | sed -e 's/;.*$//' -e 's/=/$(EQ)/g'` + flags=`echo ${ml} | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; + out="libgcc/${dir}/eh_dummy${objext}" + + echo $out: stmp-dirs $file + echo " $gcc_compile" $flags -fexceptions -c $file -o $out + done + fi fi for file in $LIB2ADD_ST; do @@ -649,6 +669,11 @@ done echo "" echo "all: $all" +if [ "$need_eh_dummy" ]; then + echo "eh_dummy.c:" + echo " echo 'int __libgcc_eh_dummy;' > \$@" +fi + echo "" echo "install: $all" for ml in $MULTILIBS; do diff --git a/contrib/gcc/optabs.c b/contrib/gcc/optabs.c index 3d85a06..536b1da 100644 --- a/contrib/gcc/optabs.c +++ b/contrib/gcc/optabs.c @@ -1078,7 +1078,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1, && ashl_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing && lshr_optab->handlers[(int) word_mode].insn_code != CODE_FOR_nothing) { - rtx insns, equiv_value; + rtx insns; rtx into_target, outof_target; rtx into_input, outof_input; rtx inter; @@ -1174,20 +1174,7 @@ expand_binop (enum machine_mode mode, optab binoptab, rtx op0, rtx op1, if (inter != 0) { - if (binoptab->code != UNKNOWN) - equiv_value = gen_rtx_fmt_ee (binoptab->code, mode, op0, op1); - else - equiv_value = 0; - - /* We can't make this a no conflict block if this is a word swap, - because the word swap case fails if the input and output values - are in the same register. */ - if (shift_count != BITS_PER_WORD) - emit_no_conflict_block (insns, target, op0, op1, equiv_value); - else - emit_insn (insns); - - + emit_insn (insns); return target; } } diff --git a/contrib/gcc/pretty-print.c b/contrib/gcc/pretty-print.c index 993fde7..9e3fbba 100644 --- a/contrib/gcc/pretty-print.c +++ b/contrib/gcc/pretty-print.c @@ -178,7 +178,7 @@ pp_base_indent (pretty_printer *pp) %p: pointer. %m: strerror(text->err_no) - does not consume a value from args_ptr. %%: `%'. - %*.s: a substring the length of which is specified by an integer. + %.*s: a substring the length of which is specified by an integer. %H: location_t. */ void pp_base_format_text (pretty_printer *pp, text_info *text) diff --git a/contrib/gcc/reg-stack.c b/contrib/gcc/reg-stack.c index 0f284ac..f10abe9 100644 --- a/contrib/gcc/reg-stack.c +++ b/contrib/gcc/reg-stack.c @@ -429,7 +429,7 @@ reg_to_stack (rtx first, FILE *file) Also need to rebuild life when superblock scheduling is done as it don't update liveness yet. */ if (!optimize - || (flag_sched2_use_superblocks + || ((flag_sched2_use_superblocks || flag_sched2_use_traces) && flag_schedule_insns_after_reload)) { count_or_remove_death_notes (NULL, 1); @@ -1231,9 +1231,9 @@ swap_rtx_condition (rtx insn) pat = PATTERN (insn); } - /* See if this is, or ends in, a fnstsw, aka unspec 9. If so, we're - not doing anything with the cc value right now. We may be able to - search for one though. */ + /* See if this is, or ends in, a fnstsw. If so, we're not doing anything + with the cc value right now. We may be able to search for one + though. */ if (GET_CODE (pat) == SET && GET_CODE (SET_SRC (pat)) == UNSPEC @@ -1252,9 +1252,13 @@ swap_rtx_condition (rtx insn) return 0; } + /* We haven't found it. */ + if (insn == BB_END (current_block)) + return 0; + /* So we've found the insn using this value. If it is anything - other than sahf, aka unspec 10, or the value does not die - (meaning we'd have to search further), then we must give up. */ + other than sahf or the value does not die (meaning we'd have + to search further), then we must give up. */ pat = PATTERN (insn); if (GET_CODE (pat) != SET || GET_CODE (SET_SRC (pat)) != UNSPEC diff --git a/contrib/gcc/regrename.c b/contrib/gcc/regrename.c index 8c326c0..1183f44 100644 --- a/contrib/gcc/regrename.c +++ b/contrib/gcc/regrename.c @@ -675,7 +675,8 @@ scan_rtx (rtx insn, rtx *loc, enum reg_class class, case SET: scan_rtx (insn, &SET_SRC (x), class, action, OP_IN, 0); - scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 0); + scan_rtx (insn, &SET_DEST (x), class, action, + GET_CODE (PATTERN (insn)) == COND_EXEC ? OP_INOUT : OP_OUT, 0); return; case STRICT_LOW_PART: @@ -700,7 +701,8 @@ scan_rtx (rtx insn, rtx *loc, enum reg_class class, abort (); case CLOBBER: - scan_rtx (insn, &SET_DEST (x), class, action, OP_OUT, 1); + scan_rtx (insn, &SET_DEST (x), class, action, + GET_CODE (PATTERN (insn)) == COND_EXEC ? OP_INOUT : OP_OUT, 1); return; case EXPR_LIST: diff --git a/contrib/gcc/regs.h b/contrib/gcc/regs.h index bb1f43d..e9ab2d8 100644 --- a/contrib/gcc/regs.h +++ b/contrib/gcc/regs.h @@ -59,6 +59,7 @@ typedef struct reg_info_def int deaths; /* # of times (REG n) dies */ int live_length; /* # of instructions (REG n) is live */ int calls_crossed; /* # of calls (REG n) is live across */ + int throw_calls_crossed; /* # of calls that may throw (REG n) is live across */ int basic_block; /* # of basic blocks (REG n) is used in */ char changes_mode; /* whether (SUBREG (REG n)) exists and is illegal. */ @@ -125,6 +126,12 @@ extern varray_type reg_n_info; #define REG_N_CALLS_CROSSED(N) (VARRAY_REG (reg_n_info, N)->calls_crossed) +/* Indexed by N, gives number of CALL_INSNS that may throw, across which + (REG n) is live. */ + +#define REG_N_THROWING_CALLS_CROSSED(N) \ + (VARRAY_REG (reg_n_info, N)->throw_calls_crossed) + /* Total number of instructions at which (REG n) is live. The larger this is, the less priority (REG n) gets for allocation in a hard register (in global-alloc). diff --git a/contrib/gcc/rtl.h b/contrib/gcc/rtl.h index d75789f..c95ac84 100644 --- a/contrib/gcc/rtl.h +++ b/contrib/gcc/rtl.h @@ -1639,6 +1639,7 @@ extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode, extern rtx simplify_replace_rtx (rtx, rtx, rtx); extern rtx simplify_rtx (rtx); extern rtx avoid_constant_pool_reference (rtx); +extern bool constant_pool_reference_p (rtx); /* In function.c */ extern rtx gen_mem_addressof (rtx, tree, int); diff --git a/contrib/gcc/sched-rgn.c b/contrib/gcc/sched-rgn.c index b8e474d..7107445 100644 --- a/contrib/gcc/sched-rgn.c +++ b/contrib/gcc/sched-rgn.c @@ -2078,6 +2078,42 @@ add_branch_dependences (rtx head, rtx tail) insn = PREV_INSN (insn); } +#ifdef HAVE_cc0 + /* There may be other cc0 setters earlier on in this block. + Look for them and include them in the set not to be disturbed. */ + if (insn != head && last != NULL_RTX) + { + rtx earlier_cc0_setter = NULL_RTX; + + for (insn = last; insn != NULL_RTX && insn != head;) + { + insn = prev_nonnote_insn (insn); + if (sets_cc0_p (insn)) + earlier_cc0_setter = insn; + } + + if (earlier_cc0_setter != NULL_RTX) + { + insn = last; + do + { + insn = prev_nonnote_insn (insn); + + if (last != 0 && ! find_insn_list (insn, LOG_LINKS (last))) + { + add_dependence (last, insn, REG_DEP_ANTI); + INSN_REF_COUNT (insn)++; + } + + CANT_MOVE (insn) = 1; + + last = insn; + } + while (insn != earlier_cc0_setter); + } + } +#endif + /* Make sure these insns are scheduled last in their block. */ insn = last; if (insn != 0) diff --git a/contrib/gcc/simplify-rtx.c b/contrib/gcc/simplify-rtx.c index fb222f7..d6d8f89 100644 --- a/contrib/gcc/simplify-rtx.c +++ b/contrib/gcc/simplify-rtx.c @@ -188,6 +188,14 @@ simplify_gen_ternary (enum rtx_code code, enum machine_mode mode, return gen_rtx_fmt_eee (code, mode, op0, op1, op2); } + +/* Return true if X is a MEM referencing the constant pool. */ + +bool +constant_pool_reference_p (rtx x) +{ + return avoid_constant_pool_reference (x) != x; +} /* Likewise, for relational operations. CMP_MODE specifies mode comparison is done in. @@ -3126,7 +3134,7 @@ simplify_immed_subreg (enum machine_mode outermode, rtx op, } /* It shouldn't matter what's done here, so fill it with zero. */ - for (; i < max_bitsize; i += value_bit) + for (; i < elem_bitsize; i += value_bit) *vp++ = 0; } else if (GET_MODE_CLASS (GET_MODE (el)) == MODE_FLOAT) diff --git a/contrib/gcc/stmt.c b/contrib/gcc/stmt.c index 3827175..a72e064 100644 --- a/contrib/gcc/stmt.c +++ b/contrib/gcc/stmt.c @@ -3353,6 +3353,12 @@ tail_recursion_args (tree actuals, tree formals) argvec[i] = copy_to_reg (argvec[i]); } + /* Insert the pre-call sequence point. This is important in cases + where the actual values post-modify the formals: we want the final + values of the formals to be the ones that we assign below, not the + result of the post-modification. */ + emit_queue (); + /* Store the values of the actuals into the formals. */ for (f = formals, a = actuals, i = 0; f; diff --git a/contrib/gcc/tree.c b/contrib/gcc/tree.c index 1d1a8e3..a9b6d1a 100644 --- a/contrib/gcc/tree.c +++ b/contrib/gcc/tree.c @@ -3417,10 +3417,8 @@ simple_cst_equal (tree t1, tree t2) TREE_STRING_LENGTH (t1))); case CONSTRUCTOR: - if (CONSTRUCTOR_ELTS (t1) == CONSTRUCTOR_ELTS (t2)) - return 1; - else - abort (); + return simple_cst_list_equal (CONSTRUCTOR_ELTS (t1), + CONSTRUCTOR_ELTS (t2)); case SAVE_EXPR: return simple_cst_equal (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0)); @@ -4156,6 +4154,7 @@ get_narrower (tree op, int *unsignedp_ptr) int uns = 0; int first = 1; tree win = op; + bool integral_p = INTEGRAL_TYPE_P (TREE_TYPE (op)); while (TREE_CODE (op) == NOP_EXPR) { @@ -4192,6 +4191,10 @@ get_narrower (tree op, int *unsignedp_ptr) uns = TREE_UNSIGNED (TREE_TYPE (op)); first = 0; op = TREE_OPERAND (op, 0); + /* Keep trying to narrow, but don't assign op to win if it + would turn an integral type into something else. */ + if (INTEGRAL_TYPE_P (TREE_TYPE (op)) != integral_p) + continue; } win = op; @@ -4803,6 +4806,27 @@ finish_vector_type (tree t) } } +static tree +make_or_reuse_type (unsigned size, int unsignedp) +{ + if (size == INT_TYPE_SIZE) + return unsignedp ? unsigned_type_node : integer_type_node; + if (size == CHAR_TYPE_SIZE) + return unsignedp ? unsigned_char_type_node : signed_char_type_node; + if (size == SHORT_TYPE_SIZE) + return unsignedp ? short_unsigned_type_node : short_integer_type_node; + if (size == LONG_TYPE_SIZE) + return unsignedp ? long_unsigned_type_node : long_integer_type_node; + if (size == LONG_LONG_TYPE_SIZE) + return (unsignedp ? long_long_unsigned_type_node + : long_long_integer_type_node); + + if (unsignedp) + return make_unsigned_type (size); + else + return make_signed_type (size); +} + /* Create nodes for all integer types (and error_mark_node) using the sizes of C datatypes. The caller should call set_sizetype soon after calling this function to select one of the types as sizetype. */ @@ -4845,18 +4869,20 @@ build_common_tree_nodes (int signed_char) TREE_TYPE (TYPE_MAX_VALUE (boolean_type_node)) = boolean_type_node; TYPE_PRECISION (boolean_type_node) = 1; - intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode)); - intHI_type_node = make_signed_type (GET_MODE_BITSIZE (HImode)); - intSI_type_node = make_signed_type (GET_MODE_BITSIZE (SImode)); - intDI_type_node = make_signed_type (GET_MODE_BITSIZE (DImode)); - intTI_type_node = make_signed_type (GET_MODE_BITSIZE (TImode)); - - unsigned_intQI_type_node = make_unsigned_type (GET_MODE_BITSIZE (QImode)); - unsigned_intHI_type_node = make_unsigned_type (GET_MODE_BITSIZE (HImode)); - unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode)); - unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode)); - unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode)); - + /* Fill in the rest of the sized types. Reuse existing type nodes + when possible. */ + intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 0); + intHI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (HImode), 0); + intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 0); + intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 0); + intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 0); + + unsigned_intQI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (QImode), 1); + unsigned_intHI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (HImode), 1); + unsigned_intSI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (SImode), 1); + unsigned_intDI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (DImode), 1); + unsigned_intTI_type_node = make_or_reuse_type (GET_MODE_BITSIZE (TImode), 1); + access_public_node = get_identifier ("public"); access_protected_node = get_identifier ("protected"); access_private_node = get_identifier ("private"); diff --git a/contrib/gcc/unroll.c b/contrib/gcc/unroll.c index 518e4a1..8d0d5d4 100644 --- a/contrib/gcc/unroll.c +++ b/contrib/gcc/unroll.c @@ -3691,7 +3691,8 @@ loop_iterations (struct loop *loop) ??? Without a vtop we could still perform the optimization if we check the initial and final values carefully. */ if (loop->vtop - && (reg_term = find_common_reg_term (initial_value, final_value))) + && (reg_term = find_common_reg_term (initial_value, final_value)) + && loop_invariant_p (loop, reg_term)) { initial_value = subtract_reg_term (initial_value, reg_term); final_value = subtract_reg_term (final_value, reg_term); |