diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-25 12:31:29 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-25 12:31:29 +0000 |
commit | 0bab3365ab64388aec5a25060aa40f6022d2db47 (patch) | |
tree | 88c621c773a19487886fc4758388f68856812312 /gcc | |
parent | f0741be49ab8138a5448c6bbe293357ae6a3b854 (diff) | |
download | gcc-0bab3365ab64388aec5a25060aa40f6022d2db47.tar.gz |
2008-06-25 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r137105
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@137106 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
50 files changed, 1220 insertions, 305 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0cc5d09454c..2516b26bdef 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,113 @@ +2008-06-25 Richard Guenther <rguenther@suse.de> + + * tree-ssa-structalias.c (fieldoff_compare): Make sure to + not overflow the result type. + +2008-06-25 Richard Guenther <rguenther@suse.de> + + * tree-vn.c (vn_add): Handle TRUTH_*_EXPR. + (vn_lookup): Likewise. + +2008-06-25 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/35518 + * fold-const.c (fold_ternary): Strip trivial BIT_FIELD_REFs. + * tree-sra.c (instantiate_element): Use fold_build3 to build + BIT_FIELD_REFs. + (try_instantiate_multiple_fields): Likewise. + +2008-06-24 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * config/rs6000/rs6000.md: Change all string instruction's clobber to + be early clobbers. + +2008-06-24 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * config/rs6000/rs6000.c (rs6000_emit_epilogue): Set + use_backchain_to_restore_sp to true + if the offset of the link register save area would go over the 32k - 1 + offset limit of the load + instructions. + +2008-06-25 Hans-Peter Nilsson <hp@axis.com> + + * doc/invoke.texi (Optimize Options) <fstrict-aliasing>: Add + anchor for the type-punning blurb. Cross-reference "Structures + unions enumerations and bit-fields implementation". Provide a + cast-through-pointer example. Make final sentence self-contained. + * doc/implement-c.texi (Structures unions enumerations and + bit-fields implementation): Cross-reference the type-punning blurb + in the -fstrict-aliasing documentation. + +2008-06-24 Andrew Pinski <andrew_pinski@playstation.sony.com> + + PR middle-end/36594 + * builtins.c (expand_builtin_nonlocal_goto): Stabilize the address of + the memory instead of the memory itself for the save area. + +2008-06-24 Olivier Hainque <hainque@adacore.com> + Nicolas Roche <roche@adacore.com> + + * gengtype.c (srcdir_len): size_t instead of int. + (get_file_realbasename): New function. For F a filename, the real + basename of F, with all the path components stripped. + (get_file_srcdir_relative_path): New function. For F a filename, the + relative path to F from $(srcdir). + (get_file_basename): Rewrite using get_file_srcdir_relative_path and + get_file_realbasename. Adjust the head comment. + (get_prefix_langdir_index): New function. For F a filename, return the + lang_dir_names[] relative index of the language directory that is + a prefix in F. + (get_file_langdir): For F a filename, return the name of the language + directory where F is located. + (get_file_gtfilename): New function. The gt- output file name for an + input filename F. + (get_output_file_with_visibility): Replace in-line computations with + uses of get_file_gtfilename and get_prefix_langdir_index. + * Makefile.in (GTFILES_H): Adjust to match what gengtype generates. + +2008-06-24 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/36504 + * tree-ssa-loop-prefetch.c (gather_memory_references_ref): Skip + references without base address. + +2008-06-23 Uros Bizjak <ubizjak@gmail.com> + + PR middle-end/PR36584 + * calls.c (expand_call): Increase alignment for recursive functions. + +2008-06-23 Anatoly Sokolov <aesok@post.ru> + + * config/avr/avr.c (avr_function_value): Add new 'outgoing' argument. + (TARGET_FUNCTION_VALUE): New define. + * config/avr/avr-protos.h (avr_function_value): Remove declaration. + * config/avr/avr.h (FUNCTION_VALUE): Remove. + +2008-06-23 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (fmodxf3): Change sequence of move instructions. + (fmod<mode>3): Ditto. + (remainderxf3): Ditto. + (remainder<mode>3): Ditto. + +2008-06-23 Jakub Jelinek <jakub@redhat.com> + + PR target/36533 + * emit-rtl.c (set_reg_attrs_from_value): Do nothing if + REG is a hard register. + + PR tree-optimization/36508 + * tree-ssa-pre.c (compute_antic): Allow num_iterations up to + 499, don't check it at all in release compilers. + +2008-06-23 Uros Bizjak <ubizjak@gmail.com> + + * config/i386/i386.md (*fop_<mode>_1_i387): Use SSE_FLOAT_MODE_P + together with SSE_TARGET_MATH to disable insn pattern. + (*fop_<MODEF:mode>_2_i387): Ditto. + (*fop_<MODEF:mode>_3_i387): Ditto. + 2008-06-22 Andy Hutchinson <hutchinsonandy@aim.com> * config/avr/avr.h (SUPPORTS_INIT_PRIORITY): Define. @@ -116,8 +226,7 @@ * ggc.h (GGC_RESIZEVAR): New, reorder macros. * tracer.c (tail_duplicate): Fix for -Wc++-compat. - * tree-affine.c (aff_combination_expand, free_name_expansion): - Likewise. + * tree-affine.c (aff_combination_expand, free_name_expansion): Likewise. * tree-cfg.c (replace_by_duplicate_decl, replace_ssa_name, move_stmt_r, new_label_mapper): Likewise. * tree-complex.c (cvc_lookup): Likewise. @@ -143,10 +252,8 @@ create_stores_for_reduction, create_loads_and_stores_for_name): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. - * tree-predcom.c (order_drefs, execute_pred_commoning_cbck): - Likewise. - * tree-sra.c (sra_elt_hash, sra_elt_eq, lookup_element): - Likewise. + * tree-predcom.c (order_drefs, execute_pred_commoning_cbck): Likewise. + * tree-sra.c (sra_elt_hash, sra_elt_eq, lookup_element): Likewise. * tree-ssa-alias.c (get_mem_sym_stats_for): Likewise. * tree-ssa-coalesce.c (compare_pairs): Likewise. * tree-ssa-loop-im.c (mem_ref_in_stmt, memref_hash, memref_eq, @@ -176,8 +283,7 @@ unshare_variable, variable_union_info_cmp_pos, variable_union, dataflow_set_different_1, dataflow_set_different_2, vt_find_locations, variable_was_changed, set_variable_part, - emit_notes_for_differences_1, emit_notes_for_differences_2): - Likewise. + emit_notes_for_differences_1, emit_notes_for_differences_2): Likewise. * varasm.c (prefix_name, emutls_decl, section_entry_eq, section_entry_hash, object_block_entry_eq, object_block_entry_hash, create_block_symbol, diff --git a/gcc/ChangeLog.melt b/gcc/ChangeLog.melt index fdcf35a560d..c909154bb02 100644 --- a/gcc/ChangeLog.melt +++ b/gcc/ChangeLog.melt @@ -1,4 +1,7 @@ 2008-06-25 Basile Starynkevitch <basile@starynkevitch.net> + MELT branch merged with trunk r137105 + +2008-06-25 Basile Starynkevitch <basile@starynkevitch.net> * common.opt: added -fbasilys-arglist= & basilys_arglist_string * basilys.c: (do_initial_command) handle basilys_arglist_string. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 74640075471..476e175ea0f 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20080623 +20080625 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index ce1e98cdd58..ce8f74bc558 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -3233,8 +3233,17 @@ GTFILES = $(CPP_ID_DATA_H) $(srcdir)/input.h $(srcdir)/coretypes.h \ $(BASILYS_C) \ @all_gtfiles@ -GTFILES_H = $(subst /,-, $(patsubst $(srcdir)/%,gt-%, $(patsubst %.c,%.h, \ - $(filter %.c, $(GTFILES))))) +# Compute the list of GT header files from the corresponding C sources, +# possibly nested within config or language subdirectories. Match gengtype's +# behavior in this respect: gt-LANG-file.h for "file" anywhere within a LANG +# language subdir, gt-file.h otherwise (no subdir indication for config/ +# related sources). + +GTFILES_H = $(subst /,-, \ + $(shell echo $(patsubst $(srcdir)/%,gt-%, \ + $(patsubst %.c,%.h, \ + $(filter %.c, $(GTFILES)))) \ + | sed -e "s;/[^ ]*/;/;g" -e "s;gt-config/;gt-;g")) GTFILES_LANG_H = $(patsubst [%], gtype-%.h, $(filter [%], $(GTFILES))) ALL_GTFILES_H := $(sort $(GTFILES_H) $(GTFILES_LANG_H)) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 74728b2ae3e..be34816b3f4 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2008-06-24 Eric Botcazou <ebotcazou@adacore.com> + + * utils2.c (known_alignment): Derive the alignment from pointed-to + types only if it is otherwise unknown. + <INTEGER_CST>: Tidy. + <MULT_EXPR>: Likewise. + <POINTER_PLUS_EXPR>: If the alignment of the offset is unknown, use + that of the base. + 2008-06-20 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> PR ada/36573 diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index 891463ce49c..300fbd37d01 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.c @@ -136,23 +136,6 @@ known_alignment (tree exp) { unsigned int this_alignment; unsigned int lhs, rhs; - unsigned int type_alignment; - - /* For pointer expressions, we know that the designated object is always at - least as strictly aligned as the designated subtype, so we account for - both type and expression information in this case. - - Beware that we can still get a dummy designated subtype here (e.g. Taft - Amendment types), in which the alignment information is meaningless and - should be ignored. - - We always compute a type_alignment value and return the MAX of it - compared with what we get from the expression tree. Just set the - type_alignment value to 0 when the type information is to be ignored. */ - type_alignment - = ((POINTER_TYPE_P (TREE_TYPE (exp)) - && !TYPE_IS_DUMMY_P (TREE_TYPE (TREE_TYPE (exp)))) - ? TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp))) : 0); switch (TREE_CODE (exp)) { @@ -170,7 +153,6 @@ known_alignment (tree exp) break; case PLUS_EXPR: - case POINTER_PLUS_EXPR: case MINUS_EXPR: /* If two address are added, the alignment of the result is the minimum of the two alignments. */ @@ -179,6 +161,17 @@ known_alignment (tree exp) this_alignment = MIN (lhs, rhs); break; + case POINTER_PLUS_EXPR: + lhs = known_alignment (TREE_OPERAND (exp, 0)); + rhs = known_alignment (TREE_OPERAND (exp, 1)); + /* If we don't know the alignment of the offset, we assume that + of the base. */ + if (rhs == 0) + this_alignment = lhs; + else + this_alignment = MIN (lhs, rhs); + break; + case COND_EXPR: /* If there is a choice between two values, use the smallest one. */ lhs = known_alignment (TREE_OPERAND (exp, 1)); @@ -187,12 +180,12 @@ known_alignment (tree exp) break; case INTEGER_CST: - /* The first part of this represents the lowest bit in the constant, - but is it in bytes, not bits. */ - this_alignment - = MIN (BITS_PER_UNIT - * (TREE_INT_CST_LOW (exp) & - TREE_INT_CST_LOW (exp)), - BIGGEST_ALIGNMENT); + { + unsigned HOST_WIDE_INT c = TREE_INT_CST_LOW (exp); + /* The first part of this represents the lowest bit in the constant, + but it is originally in bytes, not bits. */ + this_alignment = MIN (BITS_PER_UNIT * (c & -c), BIGGEST_ALIGNMENT); + } break; case MULT_EXPR: @@ -201,10 +194,12 @@ known_alignment (tree exp) lhs = known_alignment (TREE_OPERAND (exp, 0)); rhs = known_alignment (TREE_OPERAND (exp, 1)); - if (lhs == 0 || rhs == 0) - this_alignment = MIN (BIGGEST_ALIGNMENT, MAX (lhs, rhs)); + if (lhs == 0) + this_alignment = rhs; + else if (rhs == 0) + this_alignment = lhs; else - this_alignment = MIN (BIGGEST_ALIGNMENT, lhs * rhs); + this_alignment = MIN (lhs * rhs, BIGGEST_ALIGNMENT); break; case BIT_AND_EXPR: @@ -220,11 +215,19 @@ known_alignment (tree exp) break; default: - this_alignment = 0; + /* For other pointer expressions, we assume that the pointed-to object + is at least as aligned as the pointed-to type. Beware that we can + have a dummy type here (e.g. a Taft Amendment type), for which the + alignment is meaningless and should be ignored. */ + if (POINTER_TYPE_P (TREE_TYPE (exp)) + && !TYPE_IS_DUMMY_P (TREE_TYPE (TREE_TYPE (exp)))) + this_alignment = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (exp))); + else + this_alignment = 0; break; } - return MAX (type_alignment, this_alignment); + return this_alignment; } /* We have a comparison or assignment operation on two types, T1 and T2, which diff --git a/gcc/builtins.c b/gcc/builtins.c index cdc5ab31375..06ae07adaa9 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -873,6 +873,9 @@ expand_builtin_nonlocal_goto (tree exp) r_label = convert_memory_address (Pmode, r_label); r_save_area = expand_normal (t_save_area); r_save_area = convert_memory_address (Pmode, r_save_area); + /* Copy the address of the save location to a register just in case it was based + on the frame pointer. */ + r_save_area = copy_to_reg (r_save_area); r_fp = gen_rtx_MEM (Pmode, r_save_area); r_sp = gen_rtx_MEM (STACK_SAVEAREA_MODE (SAVE_NONLOCAL), plus_constant (r_save_area, GET_MODE_SIZE (Pmode))); @@ -887,7 +890,6 @@ expand_builtin_nonlocal_goto (tree exp) #endif { r_label = copy_to_reg (r_label); - r_sp = copy_to_reg (r_sp); emit_clobber (gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (VOIDmode))); emit_clobber (gen_rtx_MEM (BLKmode, hard_frame_pointer_rtx)); diff --git a/gcc/calls.c b/gcc/calls.c index e7799f0e2ad..92ff9050e3b 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -2298,11 +2298,9 @@ expand_call (tree exp, rtx target, int ignore) || !lang_hooks.decls.ok_for_sibcall (fndecl)) try_tail_call = 0; - /* Ensure current function's preferred stack boundary is at least - what we need. We don't have to increase alignment for recursive - functions. */ - if (crtl->preferred_stack_boundary < preferred_stack_boundary - && fndecl != current_function_decl) + /* Ensure current function's preferred stack + boundary is at least what we need. */ + if (crtl->preferred_stack_boundary < preferred_stack_boundary) crtl->preferred_stack_boundary = preferred_stack_boundary; preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT; diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h index 73e70c6f8cb..b8493101fb9 100644 --- a/gcc/config/avr/avr-protos.h +++ b/gcc/config/avr/avr-protos.h @@ -44,7 +44,6 @@ extern void asm_output_external (FILE *file, tree decl, char *name); extern int avr_progmem_p (tree decl, tree attributes); #ifdef RTX_CODE /* inside TREE_CODE */ -extern rtx avr_function_value (const_tree type, const_tree func); extern void init_cumulative_args (CUMULATIVE_ARGS *cum, tree fntype, rtx libname, tree fndecl); extern rtx function_arg (CUMULATIVE_ARGS *cum, enum machine_mode mode, diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 45f816f5d56..0176a2aac8f 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -71,6 +71,7 @@ static void avr_file_start (void); static void avr_file_end (void); static void avr_asm_function_end_prologue (FILE *); static void avr_asm_function_begin_epilogue (FILE *); +static rtx avr_function_value (const_tree, const_tree, bool); static void avr_insert_attributes (tree, tree *); static void avr_asm_init_sections (void); static unsigned int avr_section_type_flags (tree, const char *, int); @@ -308,6 +309,8 @@ int avr_case_values_threshold = 30000; #define TARGET_ASM_FUNCTION_END_PROLOGUE avr_asm_function_end_prologue #undef TARGET_ASM_FUNCTION_BEGIN_EPILOGUE #define TARGET_ASM_FUNCTION_BEGIN_EPILOGUE avr_asm_function_begin_epilogue +#undef TARGET_FUNCTION_VALUE +#define TARGET_FUNCTION_VALUE avr_function_value #undef TARGET_ATTRIBUTE_TABLE #define TARGET_ATTRIBUTE_TABLE avr_attribute_table #undef TARGET_ASM_FUNCTION_RODATA_SECTION @@ -5703,7 +5706,9 @@ avr_libcall_value (enum machine_mode mode) function returns a value of data type VALTYPE. */ rtx -avr_function_value (const_tree type, const_tree func ATTRIBUTE_UNUSED) +avr_function_value (const_tree type, + const_tree func ATTRIBUTE_UNUSED, + bool outgoing ATTRIBUTE_UNUSED) { unsigned int offs; diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index daf1130a784..2b72112822c 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -385,8 +385,6 @@ extern int avr_reg_order[]; #define RET_REGISTER avr_ret_register () -#define FUNCTION_VALUE(VALTYPE, FUNC) avr_function_value (VALTYPE, FUNC) - #define LIBCALL_VALUE(MODE) avr_libcall_value (MODE) #define FUNCTION_VALUE_REGNO_P(N) ((int) (N) == RET_REGISTER) diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index b6b19a1a734..f6e0f4b12b2 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -16136,7 +16136,7 @@ (match_operator:MODEF 3 "binary_fp_operator" [(match_operand:MODEF 1 "nonimmediate_operand" "0,fm") (match_operand:MODEF 2 "nonimmediate_operand" "fm,0")]))] - "TARGET_80387 && !TARGET_SSE_MATH + "TARGET_80387 && !(SSE_FLOAT_MODE_P (<MODE>mode) && TARGET_SSE_MATH) && !COMMUTATIVE_ARITH_P (operands[3]) && !(MEM_P (operands[1]) && MEM_P (operands[2]))" "* return output_387_binary_op (insn, operands);" @@ -16156,7 +16156,7 @@ [(float:MODEF (match_operand:X87MODEI12 1 "nonimmediate_operand" "m,?r")) (match_operand:MODEF 2 "register_operand" "0,0")]))] - "TARGET_80387 && !TARGET_SSE_MATH + "TARGET_80387 && !(SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH) && (TARGET_USE_<X87MODEI12:MODE>MODE_FIOP || optimize_size)" "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);" [(set (attr "type") @@ -16175,7 +16175,7 @@ [(match_operand:MODEF 1 "register_operand" "0,0") (float:MODEF (match_operand:X87MODEI12 2 "nonimmediate_operand" "m,?r"))]))] - "TARGET_80387 && !TARGET_SSE_MATH + "TARGET_80387 && !(SSE_FLOAT_MODE_P (<MODEF:MODE>mode) && TARGET_SSE_MATH) && (TARGET_USE_<X87MODEI12:MODE>MODE_FIOP || optimize_size)" "* return which_alternative ? \"#\" : output_387_binary_op (insn, operands);" [(set (attr "type") @@ -16520,8 +16520,8 @@ rtx op1 = gen_reg_rtx (XFmode); rtx op2 = gen_reg_rtx (XFmode); - emit_move_insn (op1, operands[1]); emit_move_insn (op2, operands[2]); + emit_move_insn (op1, operands[1]); emit_label (label); emit_insn (gen_fpremxf4_i387 (op1, op2, op1, op2)); @@ -16543,8 +16543,8 @@ rtx op1 = gen_reg_rtx (XFmode); rtx op2 = gen_reg_rtx (XFmode); - emit_insn (gen_extend<mode>xf2 (op1, operands[1])); emit_insn (gen_extend<mode>xf2 (op2, operands[2])); + emit_insn (gen_extend<mode>xf2 (op1, operands[1])); emit_label (label); emit_insn (gen_fpremxf4_i387 (op1, op2, op1, op2)); @@ -16588,8 +16588,8 @@ rtx op1 = gen_reg_rtx (XFmode); rtx op2 = gen_reg_rtx (XFmode); - emit_move_insn (op1, operands[1]); emit_move_insn (op2, operands[2]); + emit_move_insn (op1, operands[1]); emit_label (label); emit_insn (gen_fprem1xf4_i387 (op1, op2, op1, op2)); @@ -16611,8 +16611,8 @@ rtx op1 = gen_reg_rtx (XFmode); rtx op2 = gen_reg_rtx (XFmode); - emit_insn (gen_extend<mode>xf2 (op1, operands[1])); emit_insn (gen_extend<mode>xf2 (op2, operands[2])); + emit_insn (gen_extend<mode>xf2 (op1, operands[1])); emit_label (label); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 66e4b51773d..68280a5ff9b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -16313,6 +16313,9 @@ rs6000_emit_epilogue (int sibcall) frame pointer for alloca, but the generic parts of the compiler give us one anyway. */ use_backchain_to_restore_sp = (info->total_size > 32767 + || info->total_size + + (info->lr_save_p ? info->lr_save_offset : 0) + > 32767 || (cfun->calls_alloca && !frame_pointer_needed)); diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index 1f63454e694..e3912c76646 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -9669,7 +9669,7 @@ (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b"))) (use (match_operand:SI 2 "immediate_operand" "i")) (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_operand:SI 4 "gpc_reg_operand" "=r")) + (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r")) (clobber (reg:SI 6)) (clobber (reg:SI 7)) (clobber (reg:SI 8)) @@ -9693,7 +9693,7 @@ (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b"))) (use (match_operand:SI 2 "immediate_operand" "i")) (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_operand:SI 4 "gpc_reg_operand" "=r")) + (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r")) (clobber (reg:SI 6)) (clobber (reg:SI 7)) (clobber (reg:SI 8)) @@ -9735,7 +9735,7 @@ (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b"))) (use (match_operand:SI 2 "immediate_operand" "i")) (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_operand:SI 4 "gpc_reg_operand" "=r")) + (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r")) (clobber (reg:SI 6)) (clobber (reg:SI 7)) (clobber (reg:SI 8)) @@ -9756,7 +9756,7 @@ (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b"))) (use (match_operand:SI 2 "immediate_operand" "i")) (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_operand:SI 4 "gpc_reg_operand" "=r")) + (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r")) (clobber (reg:SI 6)) (clobber (reg:SI 7)) (clobber (reg:SI 8)) @@ -9793,7 +9793,7 @@ (mem:BLK (match_operand:SI 1 "gpc_reg_operand" "b"))) (use (match_operand:SI 2 "immediate_operand" "i")) (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_operand:SI 4 "gpc_reg_operand" "=r")) + (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r")) (clobber (reg:SI 6)) (clobber (reg:SI 7)) (clobber (reg:SI 8)) @@ -9812,7 +9812,7 @@ (mem:BLK (match_operand:P 1 "gpc_reg_operand" "b"))) (use (match_operand:SI 2 "immediate_operand" "i")) (use (match_operand:SI 3 "immediate_operand" "i")) - (clobber (match_operand:SI 4 "gpc_reg_operand" "=r")) + (clobber (match_operand:SI 4 "gpc_reg_operand" "=&r")) (clobber (reg:SI 6)) (clobber (reg:SI 7)) (clobber (reg:SI 8)) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 78f1d87a447..df1a46bdf94 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-06-24 Jonathan Wakely <jwakely.gcc@gmail.com> + + PR c++/23194 + * typeck.c (cp_build_function_call): Show example syntax in + diagnostic. + 2008-06-21 Jonathan Wakely <jwakely.gcc@gmail.com> * typeck.c (composite_pointer_type_r, cxx_sizeof_expr, diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 8fd3be2c68d..e34fa675b9f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2850,8 +2850,8 @@ cp_build_function_call (tree function, tree params, tsubst_flags_t complain) { if (complain & tf_error) error ("must use %<.*%> or %<->*%> to call pointer-to-member " - "function in %<%E (...)%>", - original); + "function in %<%E (...)%>, e.g. %<(... ->* %E) (...)%>", + original, original); return error_mark_node; } diff --git a/gcc/doc/implement-c.texi b/gcc/doc/implement-c.texi index b7d34ee290c..6a1b59b7e85 100644 --- a/gcc/doc/implement-c.texi +++ b/gcc/doc/implement-c.texi @@ -433,8 +433,8 @@ used to determine if a function has not been inlined and why not. different type (C90 6.3.2.3).} The relevant bytes of the representation of the object are treated as -an object of the type used for the access. This may be a trap -representation. +an object of the type used for the access. @xref{Type-punning}. This +may be a trap representation. @item @cite{Whether a ``plain'' @code{int} bit-field is treated as a diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index fd438122f5b..f69f0019dec 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6146,7 +6146,7 @@ example, an @code{unsigned int} can alias an @code{int}, but not a @code{void*} or a @code{double}. A character type may alias any other type. -Pay special attention to code like this: +@anchor{Type-punning}Pay special attention to code like this: @smallexample union a_union @{ int i; @@ -6163,7 +6163,8 @@ The practice of reading from a different union member than the one most recently written to (called ``type-punning'') is common. Even with @option{-fstrict-aliasing}, type-punning is allowed, provided the memory is accessed through the union type. So, the code above will work as -expected. However, this code might not: +expected. @xref{Structures unions enumerations and bit-fields +implementation}. However, this code might not: @smallexample int f() @{ a_union t; @@ -6174,7 +6175,18 @@ int f() @{ @} @end smallexample -Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}. +Similarly, access by taking the address, casting the resulting pointer +and dereferencing the result has undefined behavior, even if the cast +uses a union type, e.g.: +@smallexample +int f() @{ + double d = 3.0; + return ((union a_union *) &d)->i; +@} +@end smallexample + +The @option{-fstrict-aliasing} option is enabled at levels +@option{-O2}, @option{-O3}, @option{-Os}. @item -fstrict-overflow @opindex fstrict-overflow diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index d6929cf154b..fa2b78a4d95 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -963,6 +963,12 @@ set_reg_attrs_from_value (rtx reg, rtx x) { int offset; + /* Hard registers can be reused for multiple purposes within the same + function, so setting REG_ATTRS, REG_POINTER and REG_POINTER_ALIGN + on them is wrong. */ + if (HARD_REGISTER_P (reg)) + return; + offset = byte_lowpart_offset (GET_MODE (reg), GET_MODE (x)); if (MEM_P (x)) { diff --git a/gcc/fold-const.c b/gcc/fold-const.c index aaae9d66c51..fc72b9b38a2 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13117,6 +13117,13 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2) return fold_convert (type, integer_zero_node); } } + + /* A bit-field-ref that referenced the full argument can be stripped. */ + if (INTEGRAL_TYPE_P (TREE_TYPE (arg0)) + && TYPE_PRECISION (TREE_TYPE (arg0)) == tree_low_cst (arg1, 1) + && integer_zerop (op2)) + return fold_convert (type, arg0); + return NULL_TREE; default: diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7c145e1222b..420218fa57c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,14 @@ +2008-06-24 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/34371 + * expr.c (gfc_check_assign): Change message and locus for + error when conform == 0. + +2008-06-23 Jakub Jelinek <jakub@redhat.com> + + PR fortran/36597 + * cpp.c (cpp_define_builtins): Change _OPENMP value to 200805. + 2008-06-20 Laurynas Biveinis <laurynas.biveinis@gmail.com> Tobias Burnus <burnus@net-b.de> diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c index 76ab9a3bad5..0498130396e 100644 --- a/gcc/fortran/cpp.c +++ b/gcc/fortran/cpp.c @@ -167,7 +167,7 @@ cpp_define_builtins (cpp_reader *pfile) cpp_define (pfile, "_LANGUAGE_FORTRAN=1"); if (gfc_option.flag_openmp) - cpp_define (pfile, "_OPENMP=200505"); + cpp_define (pfile, "_OPENMP=200805"); /* More builtins that might be useful, but are not documented diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index ace09de4347..2f7030ed833 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -2829,6 +2829,7 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) if (gfc_compare_types (&lvalue->ts, &rvalue->ts)) return SUCCESS; + /* Only DATA Statements come here. */ if (!conform) { /* Numeric can be converted to any other numeric. And Hollerith can be @@ -2840,9 +2841,9 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL) return SUCCESS; - gfc_error ("Incompatible types in assignment at %L; attempted assignment " - "of %s to %s", &rvalue->where, gfc_typename (&rvalue->ts), - gfc_typename (&lvalue->ts)); + gfc_error ("Incompatible types in DATA statement at %L; attempted " + "conversion of %s to %s", &lvalue->where, + gfc_typename (&rvalue->ts), gfc_typename (&lvalue->ts)); return FAILURE; } diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 724d662aaa8..26b4591166a 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2379,7 +2379,7 @@ check_intents (gfc_formal_arglist *f, gfc_actual_arglist *a) return FAILURE; } - if (a->expr->symtree->n.sym->attr.pointer) + if (f->sym->attr.pointer) { gfc_error ("Procedure argument at %L is local to a PURE " "procedure and has the POINTER attribute", diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 49e60e019c7..4237926a9d8 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -148,10 +148,16 @@ static outf_p header_file; static const char *srcdir; /* Length of srcdir name. */ -static int srcdir_len = 0; +static size_t srcdir_len = 0; static outf_p create_file (const char *, const char *); + static const char * get_file_basename (const char *); +static const char * get_file_realbasename (const char *); +static const char * get_file_srcdir_relative_path (const char *); + +static int get_prefix_langdir_index (const char *); +static const char * get_file_langdir (const char *); /* Nonzero iff an error has occurred. */ @@ -1549,41 +1555,114 @@ open_base_files (void) } } -/* Determine the pathname to F relative to $(srcdir). */ +/* For F a filename, return the real basename of F, with all the directory + components skipped. */ + +static const char * +get_file_realbasename (const char *f) +{ + const char * lastslash = strrchr (f, '/'); + + return (lastslash != NULL) ? lastslash + 1 : f; +} + +/* For F a filename, return the relative path to F from $(srcdir) if the + latter is a prefix in F, NULL otherwise. */ + +static const char * +get_file_srcdir_relative_path (const char *f) +{ + if (strlen (f) > srcdir_len + && IS_DIR_SEPARATOR (f[srcdir_len]) + && memcmp (f, srcdir, srcdir_len) == 0) + return f + srcdir_len + 1; + else + return NULL; +} + +/* For F a filename, return the relative path to F from $(srcdir) if the + latter is a prefix in F, or the real basename of F otherwise. */ static const char * get_file_basename (const char *f) { - const char *basename; - unsigned i; + const char * srcdir_path = get_file_srcdir_relative_path (f); - basename = strrchr (f, '/'); + return (srcdir_path != NULL) ? srcdir_path : get_file_realbasename (f); +} - if (!basename) - return f; +/* For F a filename, return the lang_dir_names relative index of the language + directory that is a prefix in F, if any, -1 otherwise. */ - basename++; +static int +get_prefix_langdir_index (const char *f) +{ + size_t f_len = strlen (f); + size_t lang_index; - for (i = 0; i < num_lang_dirs; i++) + for (lang_index = 0; lang_index < num_lang_dirs; lang_index++) { - const char * s1; - const char * s2; - int l1; - int l2; - s1 = basename - strlen (lang_dir_names [i]) - 1; - s2 = lang_dir_names [i]; - l1 = strlen (s1); - l2 = strlen (s2); - if (l1 >= l2 && IS_DIR_SEPARATOR (s1[-1]) && !memcmp (s1, s2, l2)) - { - basename -= l2 + 1; - if ((basename - f - 1) != srcdir_len) - fatal ("filename `%s' should be preceded by $srcdir", f); - break; - } + const char * langdir = lang_dir_names [lang_index]; + size_t langdir_len = strlen (langdir); + + if (f_len > langdir_len + && IS_DIR_SEPARATOR (f[langdir_len]) + && memcmp (f, langdir, langdir_len) == 0) + return lang_index; } - return basename; + return -1; +} + +/* For F a filename, return the name of language directory where F is located, + if any, NULL otherwise. */ + +static const char * +get_file_langdir (const char *f) +{ + /* Get the relative path to F from $(srcdir) and find the language by + comparing the prefix with language directory names. If F is not even + srcdir relative, no point in looking further. */ + + int lang_index; + const char * srcdir_relative_path = get_file_srcdir_relative_path (f); + + if (!srcdir_relative_path) + return NULL; + + lang_index = get_prefix_langdir_index (srcdir_relative_path); + + return (lang_index >= 0) ? lang_dir_names [lang_index] : NULL; +} + +/* The gt- output file name for F. */ + +static const char * +get_file_gtfilename (const char *f) +{ + /* Cook up an initial version of the gt- file name from the file real + basename and the language name, if any. */ + + const char *basename = get_file_realbasename (f); + const char *langdir = get_file_langdir (f); + + char * result = + (langdir ? xasprintf ("gt-%s-%s", langdir, basename) + : xasprintf ("gt-%s", basename)); + + /* Then replace all non alphanumerics characters by '-' and change the + extenstion to ".h". We expect the input filename extension was at least + one character long. */ + + char *s = result; + + for (; *s != '.'; s++) + if (! ISALNUM (*s) && *s != '-') + *s = '-'; + + memcpy (s, ".h", sizeof (".h")); + + return result; } /* An output file, suitable for definitions, that can see declarations @@ -1613,13 +1692,7 @@ get_output_file_with_visibility (const char *input_file) || (len > 2 && memcmp (basename+len-2, ".y", 2) == 0) || (len > 3 && memcmp (basename+len-3, ".in", 3) == 0)) { - char *s; - - output_name = s = xasprintf ("gt-%s", basename); - for (; *s != '.'; s++) - if (! ISALNUM (*s) && *s != '-') - *s = '-'; - memcpy (s, ".h", sizeof (".h")); + output_name = get_file_gtfilename (input_file); for_name = basename; } /* Some headers get used by more than one front-end; hence, it @@ -1645,12 +1718,10 @@ get_output_file_with_visibility (const char *input_file) output_name = "gt-objc-objc-act.h", for_name = "objc/objc-act.c"; else { - size_t i; + int lang_index = get_prefix_langdir_index (basename); - for (i = 0; i < num_lang_dirs; i++) - if (memcmp (basename, lang_dir_names[i], strlen (lang_dir_names[i])) == 0 - && basename[strlen(lang_dir_names[i])] == '/') - return base_files[i]; + if (lang_index >= 0) + return base_files[lang_index]; output_name = "gtype-desc.c"; for_name = NULL; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 775b82b5fd7..65a28f4f853 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,27 @@ +2008-06-24 Tom Tromey <tromey@redhat.com> + + * jcf-path.c (jcf_path_init): Don't name variable 'try'. + * expr.c (add_type_assertion): Rename argument. + (build_java_arrayaccess): Don't name variable 'throw'. + (ARRAY_NEW_MULTI): Don't name variable 'class'. + * jcf-io.c (find_class): Don't name variable 'class'. + * mangle.c (compression_table_add): Don't name variable 'new'. + * constants.c (cpool_for_class): Rename argument. + (alloc_constant_fieldref): Likewise. + * jcf-parse.c (handle_innerclass_attribute): Don't name variable + 'class'. + (read_class): Likewise. + (parse_zip_file_entries): Likewise. + (process_zip_dir): Likewise. + * decl.c (java_mark_class_local): Rename argument. + * class.c (GEN_TABLE): Use type_name, not typename. + (gen_indirect_dispatch_tables): Likewise. + (add_field): Rename argument. + (is_compiled_class): Likewise. + (safe_layout_class): Likewise. + (emit_assertion_table): Likewise. + * typeck.c (has_method): Rename argument. + 2008-06-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * class.c (ident_subst, mangled_classname, unmangle_classname, diff --git a/gcc/java/class.c b/gcc/java/class.c index bf53b4755be..ef5cc0f8956 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -412,11 +412,12 @@ unmangle_classname (const char *name, int name_length) #define GEN_TABLE(TABLE, NAME, TABLE_TYPE, TYPE) \ do \ { \ - const char *typename = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \ - char *buf = (char *) alloca (strlen (typename) + strlen (#NAME "_syms_") + 1); \ + const char *type_name = IDENTIFIER_POINTER (mangled_classname ("", TYPE)); \ + char *buf = (char *) alloca (strlen (type_name) \ + + strlen (#NAME "_syms_") + 1); \ tree decl; \ \ - sprintf (buf, #NAME "_%s", typename); \ + sprintf (buf, #NAME "_%s", type_name); \ TYPE_## TABLE ##_DECL (type) = decl = \ build_decl (VAR_DECL, get_identifier (buf), TABLE_TYPE); \ DECL_EXTERNAL (decl) = 1; \ @@ -428,7 +429,7 @@ do \ pushdecl (decl); \ MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (decl); \ DECL_OWNER (decl) = TYPE; \ - sprintf (buf, #NAME "_syms_%s", typename); \ + sprintf (buf, #NAME "_syms_%s", type_name); \ TYPE_## TABLE ##_SYMS_DECL (TYPE) = \ build_decl (VAR_DECL, get_identifier (buf), symbols_array_type); \ TREE_STATIC (TYPE_## TABLE ##_SYMS_DECL (TYPE)) = 1; \ @@ -442,13 +443,14 @@ while (0) void gen_indirect_dispatch_tables (tree type) { - const char *typename = IDENTIFIER_POINTER (mangled_classname ("", type)); + const char *type_name = IDENTIFIER_POINTER (mangled_classname ("", type)); { tree field = NULL; - char *buf = (char *) alloca (strlen (typename) + strlen ("_catch_classes_") + 1); + char *buf = (char *) alloca (strlen (type_name) + + strlen ("_catch_classes_") + 1); tree catch_class_type = make_node (RECORD_TYPE); - sprintf (buf, "_catch_classes_%s", typename); + sprintf (buf, "_catch_classes_%s", type_name); PUSH_FIELD (catch_class_type, field, "address", utf8const_ptr_type); PUSH_FIELD (catch_class_type, field, "classname", ptr_type_node); FINISH_RECORD (catch_class_type); @@ -837,14 +839,14 @@ add_method (tree this_class, int access_flags, tree name, tree method_sig) } tree -add_field (tree class, tree name, tree field_type, int flags) +add_field (tree klass, tree name, tree field_type, int flags) { int is_static = (flags & ACC_STATIC) != 0; tree field; field = build_decl (is_static ? VAR_DECL : FIELD_DECL, name, field_type); - TREE_CHAIN (field) = TYPE_FIELDS (class); - TYPE_FIELDS (class) = field; - DECL_CONTEXT (field) = class; + TREE_CHAIN (field) = TYPE_FIELDS (klass); + TYPE_FIELDS (klass) = field; + DECL_CONTEXT (field) = klass; MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC (field); if (flags & ACC_PUBLIC) FIELD_PUBLIC (field) = 1; @@ -871,7 +873,7 @@ add_field (tree class, tree name, tree field_type, int flags) java_hide_decl (field); /* Considered external unless we are compiling it into this object file. */ - DECL_EXTERNAL (field) = (is_compiled_class (class) != 2); + DECL_EXTERNAL (field) = (is_compiled_class (klass) != 2); } return field; @@ -2227,43 +2229,43 @@ finish_class (void) rest_of_decl_compilation (TYPE_NAME (current_class), 1, 0); } -/* Return 2 if CLASS is compiled by this compilation job; - return 1 if CLASS can otherwise be assumed to be compiled; - return 0 if we cannot assume that CLASS is compiled. +/* Return 2 if KLASS is compiled by this compilation job; + return 1 if KLASS can otherwise be assumed to be compiled; + return 0 if we cannot assume that KLASS is compiled. Returns 1 for primitive and 0 for array types. */ int -is_compiled_class (tree class) +is_compiled_class (tree klass) { int seen_in_zip; - if (TREE_CODE (class) == POINTER_TYPE) - class = TREE_TYPE (class); - if (TREE_CODE (class) != RECORD_TYPE) /* Primitive types are static. */ + if (TREE_CODE (klass) == POINTER_TYPE) + klass = TREE_TYPE (klass); + if (TREE_CODE (klass) != RECORD_TYPE) /* Primitive types are static. */ return 1; - if (TYPE_ARRAY_P (class)) + if (TYPE_ARRAY_P (klass)) return 0; - seen_in_zip = (TYPE_JCF (class) && JCF_SEEN_IN_ZIP (TYPE_JCF (class))); - if (CLASS_FROM_CURRENTLY_COMPILED_P (class)) + seen_in_zip = (TYPE_JCF (klass) && JCF_SEEN_IN_ZIP (TYPE_JCF (klass))); + if (CLASS_FROM_CURRENTLY_COMPILED_P (klass)) { /* The class was seen in the current ZIP file and will be available as a compiled class in the future but may not have been loaded already. Load it if necessary. This prevent build_class_ref () from crashing. */ - if (seen_in_zip && !CLASS_LOADED_P (class) && (class != current_class)) - load_class (class, 1); + if (seen_in_zip && !CLASS_LOADED_P (klass) && (klass != current_class)) + load_class (klass, 1); /* We return 2 for class seen in ZIP and class from files belonging to the same compilation unit */ return 2; } - if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (class))))) + if (assume_compiled (IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (klass))))) { - if (!CLASS_LOADED_P (class)) + if (!CLASS_LOADED_P (klass)) { - if (class != current_class) - load_class (class, 1); + if (klass != current_class) + load_class (klass, 1); } return 1; } @@ -2382,12 +2384,12 @@ maybe_layout_super_class (tree super_class, tree this_class ATTRIBUTE_UNUSED) about the class processed currently. */ void -safe_layout_class (tree class) +safe_layout_class (tree klass) { tree save_current_class = current_class; location_t save_location = input_location; - layout_class (class); + layout_class (klass); current_class = save_current_class; input_location = save_location; @@ -3010,14 +3012,14 @@ add_assertion_table_entry (void **htab_entry, void *ptr) return true; } -/* Generate the type assertion table for CLASS, and return its DECL. */ +/* Generate the type assertion table for KLASS, and return its DECL. */ static tree -emit_assertion_table (tree class) +emit_assertion_table (tree klass) { tree null_entry, ctor, table_decl; tree list = NULL_TREE; - htab_t assertions_htab = TYPE_ASSERTIONS (class); + htab_t assertions_htab = TYPE_ASSERTIONS (klass); /* Iterate through the hash table. */ htab_traverse (assertions_htab, add_assertion_table_entry, &list); @@ -3035,7 +3037,7 @@ emit_assertion_table (tree class) list = nreverse (list); ctor = build_constructor_from_list (assertion_table_type, list); - table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", class), + table_decl = build_decl (VAR_DECL, mangled_classname ("_type_assert_", klass), assertion_table_type); TREE_STATIC (table_decl) = 1; diff --git a/gcc/java/constants.c b/gcc/java/constants.c index f3436cf08bf..265557ec241 100644 --- a/gcc/java/constants.c +++ b/gcc/java/constants.c @@ -1,6 +1,6 @@ /* Handle the constant pool of the Java(TM) Virtual Machine. Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, - 2007 Free Software Foundation, Inc. + 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -327,14 +327,14 @@ get_tag_node (int tag) /* Given a class, return its constant pool, creating one if necessary. */ CPool * -cpool_for_class (tree class) +cpool_for_class (tree klass) { - CPool *cpool = TYPE_CPOOL (class); + CPool *cpool = TYPE_CPOOL (klass); if (cpool == NULL) { cpool = GGC_CNEW (struct CPool); - TYPE_CPOOL (class) = cpool; + TYPE_CPOOL (klass) = cpool; } return cpool; } @@ -370,13 +370,13 @@ find_name_and_type_constant_tree (CPool *cpool, tree name, tree type) } /* Look for a field ref that matches DECL in the constant pool of - CLASS. + KLASS. Return the index of the entry. */ int -alloc_constant_fieldref (tree class, tree decl) +alloc_constant_fieldref (tree klass, tree decl) { - CPool *outgoing_cpool = cpool_for_class (class); + CPool *outgoing_cpool = cpool_for_class (klass); int class_index = find_tree_constant (outgoing_cpool, CONSTANT_Class, DECL_NAME (TYPE_NAME (DECL_CONTEXT (decl)))); diff --git a/gcc/java/decl.c b/gcc/java/decl.c index 8ed8926ec77..d249157371d 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1899,15 +1899,15 @@ java_mark_cni_decl_local (tree decl) /* Use the preceding two functions and mark all members of the class. */ void -java_mark_class_local (tree class) +java_mark_class_local (tree klass) { tree t; - for (t = TYPE_FIELDS (class); t ; t = TREE_CHAIN (t)) + for (t = TYPE_FIELDS (klass); t ; t = TREE_CHAIN (t)) if (FIELD_STATIC (t)) java_mark_decl_local (t); - for (t = TYPE_METHODS (class); t ; t = TREE_CHAIN (t)) + for (t = TYPE_METHODS (klass); t ; t = TREE_CHAIN (t)) if (!METHOD_ABSTRACT (t)) { if (METHOD_NATIVE (t) && !flag_jni) diff --git a/gcc/java/expr.c b/gcc/java/expr.c index 654a25ebc36..c64f6d68eba 100644 --- a/gcc/java/expr.c +++ b/gcc/java/expr.c @@ -457,20 +457,20 @@ type_assertion_hash (const void *p) } /* Add an entry to the type assertion table for the given class. - CLASS is the class for which this assertion will be evaluated by the + KLASS is the class for which this assertion will be evaluated by the runtime during loading/initialization. ASSERTION_CODE is the 'opcode' or type of this assertion: see java-tree.h. OP1 and OP2 are the operands. The tree type of these arguments may be specific to each assertion_code. */ void -add_type_assertion (tree class, int assertion_code, tree op1, tree op2) +add_type_assertion (tree klass, int assertion_code, tree op1, tree op2) { htab_t assertions_htab; type_assertion as; void **as_pp; - assertions_htab = TYPE_ASSERTIONS (class); + assertions_htab = TYPE_ASSERTIONS (klass); if (assertions_htab == NULL) { assertions_htab = htab_create_ggc (7, type_assertion_hash, @@ -893,7 +893,7 @@ build_java_indirect_ref (tree type, tree expr, int check) tree build_java_arrayaccess (tree array, tree type, tree index) { - tree node, throw = NULL_TREE; + tree node, throw_expr = NULL_TREE; tree data_field; tree ref; tree array_type = TREE_TYPE (TREE_TYPE (array)); @@ -921,17 +921,18 @@ build_java_arrayaccess (tree array, tree type, tree index) len); if (! integer_zerop (test)) { - throw = build2 (TRUTH_ANDIF_EXPR, int_type_node, test, - build_java_throw_out_of_bounds_exception (index)); + throw_expr + = build2 (TRUTH_ANDIF_EXPR, int_type_node, test, + build_java_throw_out_of_bounds_exception (index)); /* allows expansion within COMPOUND */ - TREE_SIDE_EFFECTS( throw ) = 1; + TREE_SIDE_EFFECTS( throw_expr ) = 1; } } /* If checking bounds, wrap the index expr with a COMPOUND_EXPR in order to have the bounds check evaluated first. */ - if (throw != NULL_TREE) - index = build2 (COMPOUND_EXPR, int_type_node, throw, index); + if (throw_expr != NULL_TREE) + index = build2 (COMPOUND_EXPR, int_type_node, throw_expr, index); data_field = lookup_field (&array_type, get_identifier ("data")); @@ -3447,9 +3448,9 @@ process_jvm_instruction (int PC, const unsigned char* byte_ops, } #define ARRAY_NEW_MULTI() \ { \ - tree class = get_class_constant (current_jcf, IMMEDIATE_u2 ); \ + tree klass = get_class_constant (current_jcf, IMMEDIATE_u2 ); \ int ndims = IMMEDIATE_u1; \ - expand_java_multianewarray( class, ndims ); \ + expand_java_multianewarray( klass, ndims ); \ } #define UNOP(OPERAND_TYPE, OPERAND_VALUE) \ diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index fb8f756ee16..52120971fa2 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -1,6 +1,6 @@ /* Utility routines for finding and reading Java(TM) .class files. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -448,7 +448,7 @@ const char * find_class (const char *classname, int classname_length, JCF *jcf) { int fd; - int i, k, class = -1; + int i, k, klass = -1; struct stat class_buf; char *dep_file; void *entry; @@ -478,7 +478,7 @@ find_class (const char *classname, int classname_length, JCF *jcf) for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry)) { const char *path_name = jcf_path_name (entry); - if (class != 0) + if (klass != 0) { int dir_len; @@ -521,12 +521,12 @@ find_class (const char *classname, int classname_length, JCF *jcf) else continue; } - class = caching_stat(buffer, &class_buf); + klass = caching_stat(buffer, &class_buf); } } dep_file = buffer; - if (!class) + if (!klass) { SOURCE_FRONTEND_DEBUG ((stderr, "[Class selected: %s]\n", classname+classname_length- diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index c53e871c6b3..8757c5b7981 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1160,8 +1160,8 @@ handle_innerclass_attribute (int count, JCF *jcf, int attribute_length) /* If icii is 0, don't try to read the class. */ if (icii >= 0) { - tree class = get_class_constant (jcf, icii); - tree decl = TYPE_NAME (class); + tree klass = get_class_constant (jcf, icii); + tree decl = TYPE_NAME (klass); /* Skip reading further if ocii is null */ if (DECL_P (decl) && !CLASS_COMPLETE_P (decl) && ocii) { @@ -1253,7 +1253,7 @@ int read_class (tree name) { JCF this_jcf, *jcf; - tree icv, class = NULL_TREE; + tree icv, klass = NULL_TREE; tree save_current_class = current_class; tree save_output_class = output_class; location_t save_location = input_location; @@ -1261,8 +1261,8 @@ read_class (tree name) if ((icv = IDENTIFIER_CLASS_VALUE (name)) != NULL_TREE) { - class = TREE_TYPE (icv); - jcf = TYPE_JCF (class); + klass = TREE_TYPE (icv); + jcf = TYPE_JCF (klass); } else jcf = NULL; @@ -1284,21 +1284,21 @@ read_class (tree name) current_jcf = jcf; - if (class == NULL_TREE || ! CLASS_PARSED_P (class)) + if (klass == NULL_TREE || ! CLASS_PARSED_P (klass)) { - output_class = current_class = class; + output_class = current_class = klass; if (JCF_SEEN_IN_ZIP (current_jcf)) read_zip_member(current_jcf, current_jcf->zipd, current_jcf->zipd->zipf); jcf_parse (current_jcf); /* Parsing might change the class, in which case we have to put it back where we found it. */ - if (current_class != class && icv != NULL_TREE) + if (current_class != klass && icv != NULL_TREE) TREE_TYPE (icv) = current_class; - class = current_class; + klass = current_class; } - layout_class (class); - load_inner_classes (class); + layout_class (klass); + load_inner_classes (klass); output_class = save_output_class; current_class = save_current_class; @@ -2025,7 +2025,7 @@ parse_zip_file_entries (void) for (i = 0, zdir = (ZipDirectory *)localToFile->central_directory; i < localToFile->count; i++, zdir = ZIPDIR_NEXT (zdir)) { - tree class; + tree klass; switch (classify_zip_file (zdir)) { @@ -2036,14 +2036,14 @@ parse_zip_file_entries (void) { char *class_name = compute_class_name (zdir); int previous_alias_set = -1; - class = lookup_class (get_identifier (class_name)); + klass = lookup_class (get_identifier (class_name)); FREE (class_name); - current_jcf = TYPE_JCF (class); - output_class = current_class = class; + current_jcf = TYPE_JCF (klass); + output_class = current_class = klass; /* This is a dummy class, and now we're compiling it for real. */ - gcc_assert (! TYPE_DUMMY (class)); + gcc_assert (! TYPE_DUMMY (klass)); /* This is for a corner case where we have a superclass but no superclass fields. @@ -2058,17 +2058,17 @@ parse_zip_file_entries (void) FIXME: this really is a kludge. We should figure out a way to lay out the class properly before this happens. */ - if (TYPE_SIZE (class) && CLASSTYPE_SUPER (class) - && integer_zerop (TYPE_SIZE (class))) + if (TYPE_SIZE (klass) && CLASSTYPE_SUPER (klass) + && integer_zerop (TYPE_SIZE (klass))) { - TYPE_SIZE (class) = NULL_TREE; - previous_alias_set = TYPE_ALIAS_SET (class); - TYPE_ALIAS_SET (class) = -1; + TYPE_SIZE (klass) = NULL_TREE; + previous_alias_set = TYPE_ALIAS_SET (klass); + TYPE_ALIAS_SET (klass) = -1; } - if (! CLASS_LOADED_P (class)) + if (! CLASS_LOADED_P (klass)) { - if (! CLASS_PARSED_P (class)) + if (! CLASS_PARSED_P (klass)) { read_zip_member (current_jcf, zdir, localToFile); jcf_parse (current_jcf); @@ -2078,7 +2078,7 @@ parse_zip_file_entries (void) } if (previous_alias_set != -1) - TYPE_ALIAS_SET (class) = previous_alias_set; + TYPE_ALIAS_SET (klass) = previous_alias_set; if (TYPE_SIZE (current_class) != error_mark_node) { @@ -2146,7 +2146,7 @@ process_zip_dir (FILE *finput) i < localToFile->count; i++, zdir = ZIPDIR_NEXT (zdir)) { char *class_name, *file_name, *class_name_in_zip_dir; - tree class; + tree klass; JCF *jcf; class_name_in_zip_dir = ZIPDIR_FILENAME (zdir); @@ -2163,9 +2163,9 @@ process_zip_dir (FILE *finput) strncpy (file_name, class_name_in_zip_dir, zdir->filename_length); file_name [zdir->filename_length] = '\0'; - class = lookup_class (get_identifier (class_name)); + klass = lookup_class (get_identifier (class_name)); - if (CLASS_FROM_CURRENTLY_COMPILED_P (class)) + if (CLASS_FROM_CURRENTLY_COMPILED_P (klass)) { /* We've already compiled this class. */ duplicate_class_warning (file_name); @@ -2173,7 +2173,7 @@ process_zip_dir (FILE *finput) } /* This function is only called when processing a zip file seen on the command line. */ - CLASS_FROM_CURRENTLY_COMPILED_P (class) = 1; + CLASS_FROM_CURRENTLY_COMPILED_P (klass) = 1; jcf->read_state = finput; jcf->filbuf = jcf_filbuf_from_stdio; @@ -2181,7 +2181,7 @@ process_zip_dir (FILE *finput) jcf->filename = file_name; jcf->zipd = zdir; - TYPE_JCF (class) = jcf; + TYPE_JCF (klass) = jcf; } } diff --git a/gcc/java/jcf-path.c b/gcc/java/jcf-path.c index ca7875ce30f..7e21770ec51 100644 --- a/gcc/java/jcf-path.c +++ b/gcc/java/jcf-path.c @@ -1,6 +1,6 @@ /* Handle CLASSPATH, -classpath, and path searching. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, - 2007 Free Software Foundation, Inc. + 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -213,7 +213,7 @@ void jcf_path_init (void) { char *cp; - char *try, sep[2]; + char *attempt, sep[2]; struct stat stat_b; int found = 0, len; @@ -227,56 +227,56 @@ jcf_path_init (void) GET_ENVIRONMENT (cp, "GCC_EXEC_PREFIX"); if (cp) { - try = (char *) alloca (strlen (cp) + 50); + attempt = (char *) alloca (strlen (cp) + 50); /* The exec prefix can be something like /usr/local/bin/../lib/gcc-lib/. We want to change this into a pointer to the share/java directory. We support two configurations: one where prefix and exec-prefix are the same, and one where exec-prefix is `prefix/SOMETHING'. */ - strcpy (try, cp); - strcat (try, DIR_UP); - strcat (try, sep); - strcat (try, DIR_UP); - strcat (try, sep); - len = strlen (try); - - strcpy (try + len, "share"); - strcat (try, sep); - strcat (try, "java"); - strcat (try, sep); - strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar"); - if (! stat (try, &stat_b)) + strcpy (attempt, cp); + strcat (attempt, DIR_UP); + strcat (attempt, sep); + strcat (attempt, DIR_UP); + strcat (attempt, sep); + len = strlen (attempt); + + strcpy (attempt + len, "share"); + strcat (attempt, sep); + strcat (attempt, "java"); + strcat (attempt, sep); + strcat (attempt, "libgcj-" DEFAULT_TARGET_VERSION ".jar"); + if (! stat (attempt, &stat_b)) { - add_entry (&sys_dirs, try, 1); + add_entry (&sys_dirs, attempt, 1); found = 1; - strcpy (&try[strlen (try) - - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")], + strcpy (&attempt[strlen (attempt) + - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")], sep); - strcat (try, "ext"); - strcat (try, sep); - if (! stat (try, &stat_b)) - jcf_path_extdirs_arg (try); + strcat (attempt, "ext"); + strcat (attempt, sep); + if (! stat (attempt, &stat_b)) + jcf_path_extdirs_arg (attempt); } else { - strcpy (try + len, DIR_UP); - strcat (try, sep); - strcat (try, "share"); - strcat (try, sep); - strcat (try, "java"); - strcat (try, sep); - strcat (try, "libgcj-" DEFAULT_TARGET_VERSION ".jar"); - if (! stat (try, &stat_b)) + strcpy (attempt + len, DIR_UP); + strcat (attempt, sep); + strcat (attempt, "share"); + strcat (attempt, sep); + strcat (attempt, "java"); + strcat (attempt, sep); + strcat (attempt, "libgcj-" DEFAULT_TARGET_VERSION ".jar"); + if (! stat (attempt, &stat_b)) { - add_entry (&sys_dirs, try, 1); + add_entry (&sys_dirs, attempt, 1); found = 1; - strcpy (&try[strlen (try) - - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")], + strcpy (&attempt[strlen (attempt) + - strlen ("libgcj-" DEFAULT_TARGET_VERSION ".jar")], sep); - strcat (try, "ext"); - strcat (try, sep); - if (! stat (try, &stat_b)) - jcf_path_extdirs_arg (try); + strcat (attempt, "ext"); + strcat (attempt, sep); + if (! stat (attempt, &stat_b)) + jcf_path_extdirs_arg (attempt); } } } diff --git a/gcc/java/mangle.c b/gcc/java/mangle.c index 2e89a30f992..61594d9b5ed 100644 --- a/gcc/java/mangle.c +++ b/gcc/java/mangle.c @@ -1,6 +1,6 @@ /* Functions related to mangling class names for the GNU compiler for the Java(TM) language. - Copyright (C) 1998, 1999, 2001, 2002, 2003, 2006, 2007 + Copyright (C) 1998, 1999, 2001, 2002, 2003, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -782,13 +782,13 @@ compression_table_add (tree type) { if (compression_next == TREE_VEC_LENGTH (compression_table)) { - tree new = make_tree_vec (2*compression_next); + tree new_table = make_tree_vec (2*compression_next); int i; for (i = 0; i < compression_next; i++) - TREE_VEC_ELT (new, i) = TREE_VEC_ELT (compression_table, i); + TREE_VEC_ELT (new_table, i) = TREE_VEC_ELT (compression_table, i); - compression_table = new; + compression_table = new_table; } TREE_VEC_ELT (compression_table, compression_next++) = type; } diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c index 403639dafa6..1028c73ad14 100644 --- a/gcc/java/typeck.c +++ b/gcc/java/typeck.c @@ -1,5 +1,5 @@ /* Handle types for the GNU compiler for the Java(TM) language. - Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007 + Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc. This file is part of GCC. @@ -691,11 +691,11 @@ lookup_java_method (tree searched_class, tree method_name, method_signature, build_java_signature); } -/* Return true iff CLASS (or its ancestors) has a method METHOD_NAME. */ +/* Return true iff KLASS (or its ancestors) has a method METHOD_NAME. */ int -has_method (tree class, tree method_name) +has_method (tree klass, tree method_name) { - return lookup_do (class, SEARCH_INTERFACE, + return lookup_do (klass, SEARCH_INTERFACE, method_name, NULL_TREE, build_null_signature) != NULL_TREE; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71de4be63ce..6bcc8e70ead 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,39 @@ +2008-06-25 Richard Guenther <rguenther@suse.de> + + * gcc.c-torture/compile/20080625-1.c: New testcase. + +2008-06-25 Richard Guenther <rguenther@suse.de> + + * g++.dg/torture/20080625-1.C: New testcase. + +2008-06-24 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/36371 + * gfortran.dg/data_array_5.f90: New test. + +2008-06-24 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/warn5.adb: New test. + +2008-06-24 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/36504 + * gcc.dg/pr36504.c: New test. + +2008-06-23 Uros Bizjak <ubizjak@gmail.com> + + PR middle-end/PR36584 + * testsuite/gcc.dg/pr36584.c: New test. + * testsuite/gcc.target/i386/local2.c: Remove invalid test. + +2008-06-23 Jakub Jelinek <jakub@redhat.com> + + PR target/36533 + * gcc.target/i386/pr36533.c: New test. + + PR tree-optimization/36508 + * gcc.dg/pr36508.c: New test. + 2008-06-20 Joseph Myers <joseph@codesourcery.com> * gcc.dg/inline-31.c: New test. diff --git a/gcc/testsuite/g++.dg/torture/20080625-1.C b/gcc/testsuite/g++.dg/torture/20080625-1.C new file mode 100644 index 00000000000..b18c28226b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/20080625-1.C @@ -0,0 +1,27 @@ +extern "C" { + typedef unsigned char sal_Bool; + typedef struct _rtl_uString { + } rtl_uString; + void rtl_uString_release( rtl_uString * str ) throw (); +} +class OUString { + rtl_uString * pData; +public: + OUString() {} + ~OUString() { + rtl_uString_release( pData ); + } + sal_Bool equalsIgnoreAsciiCase( const OUString & str ) const; +}; +bool findAndRemove(); +long getAttributeProps() +{ + long nAttrs = 0; + OUString aValue; + if (findAndRemove() + && aValue.equalsIgnoreAsciiCase(OUString())) + ; + else + nAttrs |= 1; + return nAttrs; +} diff --git a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c new file mode 100644 index 00000000000..f0900fd9693 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c @@ -0,0 +1,16 @@ +struct peakbufStruct { + unsigned int lnum [5000]; + int lscan [5000][4000]; + double lmz [5000][4000]; + double lint [5000][4000]; + int PeaksInBuf; + unsigned char freelists [350000]; + unsigned char freelistl [5000]; + unsigned int LastFreeL; +} peakbuf; +void foo(int); +void findmzROI(int i, int *p_scan) +{ + foo(peakbuf.PeaksInBuf); + __builtin_memmove(p_scan, peakbuf.lscan[i], peakbuf.lnum[i]*sizeof(int)); +} diff --git a/gcc/testsuite/gcc.dg/pr36504.c b/gcc/testsuite/gcc.dg/pr36504.c new file mode 100644 index 00000000000..0db6ebced8d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr36504.c @@ -0,0 +1,25 @@ +/* PR tree-optimization/36504 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fprefetch-loop-arrays" } */ + +struct A { struct { int a; } b[8]; }; +struct B { int c; int d; }; +struct C { struct B d; }; + +void bar (struct C *, int); + +struct B +foo (struct C *p, struct A *e, int b) +{ + struct B q; + bar (p, e->b[b].a); + return q; +} + +void +baz (int b, struct A *e) +{ + struct C p; + for (; b; ++b) + p.d = foo (&p, e, b); +} diff --git a/gcc/testsuite/gcc.dg/pr36508.c b/gcc/testsuite/gcc.dg/pr36508.c new file mode 100644 index 00000000000..30489923642 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr36508.c @@ -0,0 +1,29 @@ +/* PR tree-optimization/36508 */ +/* { dg-do compile } */ +/* { dg-options "-O -ftree-pre" } */ + +void +foo (short *sp) +{ + int k; + k = 1; +#define SP0 *sp++ = 1; + while (1) + { + if (k > 6) + break; + SP0 + k++; + } + k = 1; + while (1) + { + if (k > 6) + break; + SP0 + k++; + } +#define SP1 SP0 SP0 SP0 SP0 SP0 SP0 SP0 SP0 SP0 SP0 SP0 +#define SP2 SP1 SP1 SP1 SP1 SP1 SP1 SP1 SP1 SP1 SP1 SP1 + SP2 +} diff --git a/gcc/testsuite/gcc.dg/pr36584.c b/gcc/testsuite/gcc.dg/pr36584.c new file mode 100644 index 00000000000..7d83ece3339 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr36584.c @@ -0,0 +1,281 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -lm" } */ +/* { dg-options "-O2 -msse2 -mfpmath=sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + + +#ifdef __i386__ +#include "cpuid.h" +#endif + +extern double fabs (double); +extern void abort (void); + +const int MAX_ITERATIONS = 50; +const double SMALL_ENOUGH = 1.0e-10; +const double RELERROR = 1.0e-12; + +typedef struct p +{ + int ord; + double coef[7]; +} +polynomial; + +static double +polyeval (double x, int n, double *Coeffs) +{ + register int i; + double val; + + val = Coeffs[n]; + for (i = n - 1; i >= 0; i--) + val = val * x + Coeffs[i]; + + return (val); +} + +static int +regula_falsa (int order, double *coef, double a, double b, double *val) +{ + int its; + double fa, fb, x, fx, lfx; + + fa = polyeval (a, order, coef); + fb = polyeval (b, order, coef); + + if (fa * fb > 0.0) + return 0; + + if (fabs (fa) < SMALL_ENOUGH) + { + *val = a; + return 1; + } + + if (fabs (fb) < SMALL_ENOUGH) + { + *val = b; + return 1; + } + + lfx = fa; + + for (its = 0; its < MAX_ITERATIONS; its++) + { + x = (fb * a - fa * b) / (fb - fa); + fx = polyeval (x, order, coef); + if (fabs (x) > RELERROR) + { + if (fabs (fx / x) < RELERROR) + { + *val = x; + return 1; + } + } + else + { + if (fabs (fx) < RELERROR) + { + *val = x; + return 1; + } + } + + if (fa < 0) + { + if (fx < 0) + { + a = x; + fa = fx; + if ((lfx * fx) > 0) + fb /= 2; + } + else + { + b = x; + fb = fx; + if ((lfx * fx) > 0) + fa /= 2; + } + } + else + { + if (fx < 0) + { + b = x; + fb = fx; + if ((lfx * fx) > 0) + fa /= 2; + } + else + { + a = x; + fa = fx; + if ((lfx * fx) > 0) + fb /= 2; + } + } + + if (fabs (b - a) < RELERROR) + { + *val = x; + return 1; + } + + lfx = fx; + } + + return 0; +} + +static int +numchanges (int np, polynomial * sseq, double a) +{ + int changes; + double f, lf; + polynomial *s; + changes = 0; + + lf = polyeval (a, sseq[0].ord, sseq[0].coef); + + for (s = sseq + 1; s <= sseq + np; s++) + { + f = polyeval (a, s->ord, s->coef); + if (lf == 0.0 || lf * f < 0) + changes++; + + lf = f; + } + + return changes; +} + +int +sbisect (int np, polynomial * sseq, double min_value, double max_value, + int atmin, int atmax, double *roots) +{ + double mid; + int n1, n2, its, atmid; + + if ((atmin - atmax) == 1) + { + if (regula_falsa (sseq->ord, sseq->coef, min_value, max_value, roots)) + return 1; + else + { + for (its = 0; its < MAX_ITERATIONS; its++) + { + mid = (min_value + max_value) / 2; + atmid = numchanges (np, sseq, mid); + if ((atmid < atmax) || (atmid > atmin)) + return 0; + + if (fabs (mid) > RELERROR) + { + if (fabs ((max_value - min_value) / mid) < RELERROR) + { + roots[0] = mid; + return 1; + } + } + else + { + if (fabs (max_value - min_value) < RELERROR) + { + roots[0] = mid; + return 1; + } + } + + if ((atmin - atmid) == 0) + min_value = mid; + else + max_value = mid; + } + + roots[0] = mid; + return 1; + } + } + + for (its = 0; its < MAX_ITERATIONS; its++) + { + mid = (min_value + max_value) / 2; + atmid = numchanges (np, sseq, mid); + if ((atmid < atmax) || (atmid > atmin)) + return 0; + + if (fabs (mid) > RELERROR) + { + if (fabs ((max_value - min_value) / mid) < RELERROR) + { + roots[0] = mid; + return 1; + } + } + else + { + if (fabs (max_value - min_value) < RELERROR) + { + roots[0] = mid; + return 1; + } + } + + n1 = atmin - atmid; + n2 = atmid - atmax; + + if ((n1 != 0) && (n2 != 0)) + { + n1 = sbisect (np, sseq, min_value, mid, atmin, atmid, roots); + n2 = sbisect (np, sseq, mid, max_value, atmid, atmax, &roots[n1]); + + return (n1 + n2); + } + + if (n1 == 0) + min_value = mid; + else + max_value = mid; + } + + roots[0] = mid; + return 1; +} + +int +main () +{ + polynomial sseq[7] = { + {6, {0.15735259075109281, -5.1185263411378736, 1.8516070705868664, + 7.348009172322695, -2.2152395279161343, -2.7543325329350692, 1.0}}, + {5, {-0.8530877235229789, 0.61720235686228875, 3.6740045861613475, + -1.4768263519440896, -2.2952771107792245, 1.0}}, + {4, {0.13072124257049417, 2.2220687798791126, -1.6299431586726509, + -1.6718404582408546, 1.0}}, + {3, {0.86776597575462633, -2.1051099695282511, -0.49008580100694688, + 1.0}}, + {2, {-11.117984175064155, 10.89886635045883, 1.0}}, + {1, {0.94453099602191237, -1.0}}, + {0, {-0.068471716890574186}} + }; + + double roots[7]; + int nroots; + +#ifdef __i386__ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + if (!(edx & bit_SSE2)) + return 0; +#endif + + nroots = sbisect (6, sseq, 0.0, 10000000.0, 5, 1, roots); + if (nroots != 4) + abort (); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/local2.c b/gcc/testsuite/gcc.target/i386/local2.c deleted file mode 100644 index b6d960cbc12..00000000000 --- a/gcc/testsuite/gcc.target/i386/local2.c +++ /dev/null @@ -1,25 +0,0 @@ -/* { dg-do compile } */ -/* { dg-require-effective-target ilp32 } */ -/* { dg-require-effective-target nonpic } */ -/* { dg-options "-O2 -funit-at-a-time -fomit-frame-pointer" } */ -/* { dg-final { scan-assembler-not "sub\[^\\n\]*sp" } } */ - -static __attribute__ ((noinline)) q (); -int a; - -/* This function should not require any stack manipulation - for preferred stack bounday. */ -void -e () -{ - if (a) - { - e (); - a--; - } - q (); -} - -static __attribute__ ((noinline)) q () -{ -} diff --git a/gcc/testsuite/gcc.target/i386/pr36533.c b/gcc/testsuite/gcc.target/i386/pr36533.c new file mode 100644 index 00000000000..a271fea1cac --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr36533.c @@ -0,0 +1,174 @@ +/* PR target/36533 */ +/* { dg-do run { target { { i?86-*-linux* x86_64-*-linux* } && ilp32 } } } */ +/* { dg-options "-Os" } */ +#include <string.h> +#include <sys/mman.h> +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + +typedef struct S1 +{ + unsigned long s1; + struct S1 *s2; + char *s3; +} S1; + +typedef struct +{ + unsigned int s4; + unsigned int s5; + int s6; + unsigned int *s7; +} S2; + +typedef struct +{ + unsigned int s8; + unsigned short s9; + unsigned char s10; + unsigned char s11; + char s12[255]; +} S3; + +typedef struct +{ + unsigned int s4; + unsigned short s13; + unsigned short s14; +} S4; + +typedef struct +{ + char s15[16]; + unsigned long s16; +} S5; + +typedef struct +{ + char s15[48]; + S5 *s17; +} S6; + +typedef struct +{ + S1 *s18; +} S7; + +__attribute__((regparm (3), noinline)) int +fn1 (const char *x, void *y, S1 *z) +{ + asm volatile ("" : : : "memory"); + return *x + (y != 0); +} + +__attribute__((regparm (3), noinline)) int +fn2 (const char *x, int y, S2 *z) +{ + asm volatile ("" : : : "memory"); + return 0; +} + +static inline __attribute__ ((always_inline)) unsigned int +fn4 (unsigned short x) +{ + unsigned len = x; + if (len == ((1 << 16) - 1)) + return 1 << 16; + return len; +} + +static inline __attribute__ ((always_inline)) S3 * +fn3 (S3 *p) +{ + return (S3 *) ((char *) p + fn4 (p->s9)); +} + +__attribute__((regparm (3), noinline)) int +fn5 (void) +{ + asm volatile ("" : : : "memory"); + return 0; +} + +static inline __attribute__ ((always_inline)) int +fn6 (S3 *w, int x, S2 *y, S4 *z) +{ + int a = 2; + char *b = (char *) w; + S2 c = *y; + + while ((char *) w < b + x - 2 * sizeof (S4)) + { + if (w->s10 && w->s8) + { + fn2 (w->s12, w->s10, &c); + z--; + z->s4 = c.s4; + z->s13 = (unsigned short) ((char *) w - b); + z->s14 = w->s9; + a++; + fn5 (); + } + + w = fn3 (w); + } + return a; +} + +__attribute__((regparm (3), noinline)) unsigned int +test (void *u, S6 *v, S1 **w, S7 *x, S2 *y, S1 *z) +{ + unsigned b = v->s17->s16; + unsigned a; + S4 *c; + unsigned d, e, f, i; + + fn1 (__func__, u, x->s18); + c = (S4 *) (z->s3 + b); + a = fn6 ((S3 *) (*w)->s3, b, y, c); + c -= a; + f = 0; + e = 2; + for (i = a - 1; ; i--) + { + if (f + (unsigned short) (c[i].s14 / 2) > b / 2) + break; + f += c[i].s14; + e++; + } + d = a - e; + return c[d].s4; +} + +int main (void) +{ + char *p = mmap (NULL, 131072, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + S1 wb, z, *w; + S6 v; + S7 x; + S2 y; + S5 vb; + S4 s4; + if (p == MAP_FAILED) + return 0; + if (munmap (p + 65536, 65536) < 0) + return 0; + memset (&wb, 0, sizeof (wb)); + memset (&z, 0, sizeof (z)); + memset (&v, 0, sizeof (v)); + memset (&x, 0, sizeof (x)); + memset (&y, 0, sizeof (y)); + memset (&vb, 0, sizeof (vb)); + memset (&s4, 0, sizeof (s4)); + s4.s14 = 254; + z.s3 = p + 65536 - 2 * sizeof (S4); + w = &wb; + v.s17 = &vb; + vb.s16 = 2 * sizeof (S4); + memcpy (z.s3, &s4, sizeof (s4)); + memcpy (z.s3 + sizeof (s4), &s4, sizeof (s4)); + test ((void *) 0, &v, &w, &x, &y, &z); + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/data_array_5.f90 b/gcc/testsuite/gfortran.dg/data_array_5.f90 new file mode 100644 index 00000000000..1d4e4e758a7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_array_5.f90 @@ -0,0 +1,14 @@ +! { dg-do compile } +! Tests the fix for PR36371, in which the locus for the errors pointed to +! the paramter declaration rather than the data statement. +! +! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr> +! +program chkdata + character(len=3), parameter :: mychar(3) = [ "abc", "def", "ghi" ] + integer, parameter :: myint(3) = [1, 2, 3] + integer :: c(2) + character(4) :: i(2) + data c / mychar(1), mychar(3) / ! { dg-error "Incompatible types in DATA" } + data i / myint(3), myint(2) / ! { dg-error "Incompatible types in DATA" } +end program chkdata diff --git a/gcc/testsuite/gnat.dg/warn5.adb b/gcc/testsuite/gnat.dg/warn5.adb new file mode 100644 index 00000000000..108bc594c0c --- /dev/null +++ b/gcc/testsuite/gnat.dg/warn5.adb @@ -0,0 +1,34 @@ +-- { dg-do compile } + +with System; +with Unchecked_Conversion; + +procedure Warn5 is + + type Digit_Type is range 0..15; + + type Frequency_Type is array( 1..12) of Digit_Type; + pragma Pack(Frequency_Type); + + type Element_Type is record + F : Frequency_Type; + end record; + + type Array_Type is array (Natural range <>) of Element_Type; + + type List_Type is record + A : Array_Type (0..1); + end record; + for List_Type'Alignment use 4; + + type Pointer_Type is access Element_Type; + function To_Ptr is new Unchecked_Conversion(System.Address, Pointer_Type); + + function Pointer (Pos : Natural; List : List_Type) return Pointer_Type is + begin + return To_Ptr(List.A(Pos)'Address); -- { dg-warning "source alignment" "" { target alpha*-*-* hppa*-*-* ia64-*-* mips*-*-* sparc*-*-* } } + end; + +begin + null; +end; diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 69d0700b7d2..391511f56a7 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1284,13 +1284,13 @@ instantiate_element (struct sra_elt *elt) DECL_SIZE_UNIT (var) = DECL_SIZE_UNIT (elt->element); elt->in_bitfld_block = 1; - elt->replacement = build3 (BIT_FIELD_REF, elt->type, var, - DECL_SIZE (var), - BYTES_BIG_ENDIAN - ? size_binop (MINUS_EXPR, - TYPE_SIZE (elt->type), - DECL_SIZE (var)) - : bitsize_int (0)); + elt->replacement = fold_build3 (BIT_FIELD_REF, elt->type, var, + DECL_SIZE (var), + BYTES_BIG_ENDIAN + ? size_binop (MINUS_EXPR, + TYPE_SIZE (elt->type), + DECL_SIZE (var)) + : bitsize_int (0)); } /* For vectors, if used on the left hand side with BIT_FIELD_REF, @@ -1698,8 +1698,7 @@ try_instantiate_multiple_fields (struct sra_elt *elt, tree f) type = build_nonstandard_integer_type (size, 1); gcc_assert (type); var = build3 (BIT_FIELD_REF, type, NULL_TREE, - bitsize_int (size), - bitsize_int (bit)); + bitsize_int (size), bitsize_int (bit)); block = instantiate_missing_elements_1 (elt, var, type); gcc_assert (block && block->is_scalar); @@ -1709,10 +1708,10 @@ try_instantiate_multiple_fields (struct sra_elt *elt, tree f) if ((bit & ~alchk) || (HOST_WIDE_INT)size != tree_low_cst (DECL_SIZE (var), 1)) { - block->replacement = build3 (BIT_FIELD_REF, - TREE_TYPE (block->element), var, - bitsize_int (size), - bitsize_int (bit & ~alchk)); + block->replacement = fold_build3 (BIT_FIELD_REF, + TREE_TYPE (block->element), var, + bitsize_int (size), + bitsize_int (bit & ~alchk)); } block->in_bitfld_block = 2; @@ -1727,14 +1726,14 @@ try_instantiate_multiple_fields (struct sra_elt *elt, tree f) gcc_assert (fld && fld->is_scalar && !fld->replacement); - fld->replacement = build3 (BIT_FIELD_REF, field_type, var, - DECL_SIZE (f), - bitsize_int - ((TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f)) - * BITS_PER_UNIT - + (TREE_INT_CST_LOW - (DECL_FIELD_BIT_OFFSET (f)))) - & ~alchk)); + fld->replacement = fold_build3 (BIT_FIELD_REF, field_type, var, + DECL_SIZE (f), + bitsize_int + ((TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f)) + * BITS_PER_UNIT + + (TREE_INT_CST_LOW + (DECL_FIELD_BIT_OFFSET (f)))) + & ~alchk)); fld->in_bitfld_block = 1; } diff --git a/gcc/tree-ssa-loop-prefetch.c b/gcc/tree-ssa-loop-prefetch.c index 651ccbb5227..14044c407d7 100644 --- a/gcc/tree-ssa-loop-prefetch.c +++ b/gcc/tree-ssa-loop-prefetch.c @@ -457,6 +457,9 @@ gather_memory_references_ref (struct loop *loop, struct mem_ref_group **refs, HOST_WIDE_INT step, delta; struct mem_ref_group *agrp; + if (get_base_address (ref) == NULL) + return false; + if (!analyze_ref (loop, &ref, &base, &step, &delta, stmt)) return false; diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 3f3aae777e1..423afe04785 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -2094,8 +2094,10 @@ compute_antic (void) block->index)); } } +#ifdef ENABLE_CHECKING /* Theoretically possible, but *highly* unlikely. */ - gcc_assert (num_iterations < 50); + gcc_assert (num_iterations < 500); +#endif } statistics_histogram_event (cfun, "compute_antic iterations", @@ -2124,8 +2126,10 @@ compute_antic (void) block->index)); } } +#ifdef ENABLE_CHECKING /* Theoretically possible, but *highly* unlikely. */ - gcc_assert (num_iterations < 50); + gcc_assert (num_iterations < 500); +#endif } statistics_histogram_event (cfun, "compute_partial_antic iterations", num_iterations); diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 338e190d4c8..052903da76b 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -3999,14 +3999,20 @@ fieldoff_compare (const void *pa, const void *pb) { const fieldoff_s *foa = (const fieldoff_s *)pa; const fieldoff_s *fob = (const fieldoff_s *)pb; - HOST_WIDE_INT foasize, fobsize; + unsigned HOST_WIDE_INT foasize, fobsize; - if (foa->offset != fob->offset) - return foa->offset - fob->offset; + if (foa->offset < fob->offset) + return -1; + else if (foa->offset > fob->offset) + return 1; foasize = TREE_INT_CST_LOW (foa->size); fobsize = TREE_INT_CST_LOW (fob->size); - return foasize - fobsize; + if (foasize < fobsize) + return - 1; + else if (foasize > fobsize) + return 1; + return 0; } /* Sort a fieldstack according to the field offset and sizes. */ diff --git a/gcc/tree-vn.c b/gcc/tree-vn.c index c3cc239b19f..7ec19cd4b39 100644 --- a/gcc/tree-vn.c +++ b/gcc/tree-vn.c @@ -196,12 +196,19 @@ vn_add (tree expr, tree val) SSA_NAME_VALUE (expr) = val; break; } - else if (TREE_CODE (expr) == ADDR_EXPR) + switch (TREE_CODE (expr)) { + case ADDR_EXPR: + case TRUTH_AND_EXPR: + case TRUTH_OR_EXPR: + case TRUTH_XOR_EXPR: + case TRUTH_NOT_EXPR: vn_nary_op_insert (expr, val); - break; + break; + default: + gcc_unreachable (); } - /* FALLTHROUGH */ + break; default: gcc_unreachable (); } @@ -263,9 +270,18 @@ vn_lookup (tree expr) return vn_reference_lookup (expr, NULL, false); else if (TREE_CODE (expr) == SSA_NAME) return SSA_NAME_VALUE (expr); - else if (TREE_CODE (expr) == ADDR_EXPR) - return vn_nary_op_lookup (expr); - /* FALLTHROUGH */ + switch (TREE_CODE (expr)) + { + case ADDR_EXPR: + case TRUTH_AND_EXPR: + case TRUTH_OR_EXPR: + case TRUTH_XOR_EXPR: + case TRUTH_NOT_EXPR: + return vn_nary_op_lookup (expr); + default: + gcc_unreachable (); + } + break; default: gcc_unreachable (); } |