diff options
author | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-02-20 20:16:49 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2007-02-20 20:16:49 +0000 |
commit | fd08c1f3c60128f7c7c72d8403d55b014984c92f (patch) | |
tree | d8ebb3a71e447692194c65cb7a89b31be10dcf81 | |
parent | 8bd117bacae1851567f1116e0b4b41ba6d121f6e (diff) |
svn merge -r121963:122172 svn+ssh://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch/redhat/gcc-4_1-branch-java-merge-20070117
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_1-branch-java-merge-20070117@122173 138bc75d-0d04-0410-961f-82ee72b054a4
36 files changed, 724 insertions, 103 deletions
diff --git a/ChangeLog b/ChangeLog index 71d931e8941..5eaa4ed9595 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-02-16 Gerald Pfeifer <gerald@pfeifer.com> + + * ltconfig (freebsd*): Default to elf. + 2007-02-13 Release Manager * GCC 4.1.2 released. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f9f4d47724..aa3132cbb27 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,96 @@ +2007-02-20 Ira Rosen <irar@il.ibm.com> + + * tree-ssa-alias.c: Include pointer-set.h. + (may_aliases_intersect): Use the correct type (varray) for + may_aliases sets. + +2007-02-18 Kaz Kojima <kkojima@gcc.gnu.org> + + Backport from mainline. + PR rtl-optimization/29599 + * reload1.c (eliminate_regs_in_insn): Take the destination + mode into account when computing the offset. + +2007-02-18 Roger Sayle <roger@eyesopen.com> + + Backport from mainline. + PR middle-end/24427 + PR rtl-optimization/28173 + * fold-const.c (fold_binary) <BIT_IOR_EXPR>: Transform (X&C1)|C2 + into (X,C2) if C1 is a subset of the bits of C2. Transform + (X&C1)|C2 into X|C2 if C1|C2 == ~0. Canonicalize (X&C1)|C2 as + (X&(C1&~C2))|C2. + <BIT_AND_EXPR>: Canonicalize (X|C1)&C2 as (X&C2)|(C1&C2). + +2007-02-18 Ira Rosen <irar@il.ibm.com> + + * tree-ssa-alias.c (may_aliases_intersect): New function. + * tree-data-ref.c (ptr_ptr_may_alias_p): Call may_aliases_intersect + for different tags. + * tree-flow.h (may_aliases_intersect): Add function declaration. + +2007-02-17 Alexandre Oliva <aoliva@redhat.com> + + PR tree-optimization/30823 + * tree-sra.c (sra_build_assignment): Drop type-checking assert. + +2007-02-16 Guy Martin <gmsoft@gentoo.org> + + * pa.md (tp_load): Correct mfctl instruction syntax. + +2007-02-16 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR rtl-optimization/30787 + * loop.c (strength_reduce): Don't reduce giv that is not always + executed and where add_val or mult_val can trap. + +2007-02-16 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + PR other/27843 + * Makefile.in (SYSTEM_HEADER_DIR): Use single quotes to avoid + nested double- and backquotes. + +2007-02-15 Anatoly Sokolov <aesok@post.ru> + + PR target/19087 + * config/avr/avr.c (DWARF2_ADDR_SIZE): Define. + +2007-02-15 Bob Wilson <bob.wilson@acm.org> + + * config/xtensa/xtensa.c (constantpool_mem_p): Skip over SUBREGs. + +2007-02-15 Alexandre Oliva <aoliva@redhat.com> + + * tree-sra.c (instantiate_missing_elements): Canonicalize + bit-field types. + (sra_build_assignment): New. + (generate_copy_inout, generate_element_copy, + generate_element_zero, generate_one_element_init): Use it. + +2007-02-15 Alexandre Oliva <aoliva@redhat.com> + + PR debug/30189 + * dwarf2out.c (modified_type_die): Follow DECL_ORIGINAL_TYPE + even if cv-qualification is the same. + +2007-02-14 Eric Botcazou <ebotcazou@adacore.com> + Maxim Kuvyrkov <mkuvyrkov@ispras.ru> + + PR rtl-optimization/28772 + * Makefile.in (haifa-sched.o): Add dependency on $(PARAMS_H). + + Backport from mainline: + 2006-04-13 Eric Botcazou <ebotcazou@adacore.com> + + * params.def (PARAM_MAX_SCHED_READY_INSNS): New parameter, + defaulting to 100. + * params.h (MAX_SCHED_READY_INSNS): New macro. + * haifa-sched.c: (queue_to_ready): Re-queue insns for the next cycle + past MAX_SCHED_READY_INSNS during the first scheduling pass. + (schedule_block): Delay insns past MAX_SCHED_READY_INSNS in + the ready list for 1 cycle during the first scheduling pass. + * doc/invoke.texi (--param): New parameter max-sched-ready-insns. + 2007-02-14 Jakub Jelinek <jakub@redhat.com> PR middle-end/30473 @@ -850,7 +943,7 @@ 2006-11-02 Eric Botcazou <ebotcazou@libertysurf.fr> * doc/install.texi (sparc-sun-solaris2*): Update GMP/MPFR build - instructions. + (sparc64-sun-solaris2*): Likewise. 2006-11-02 Zdenek Dvorak <dvorakz@suse.cz> diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4ac23d4e4d7..7b36930cce1 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20070214 +20070220 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 07dbebd64f4..4f2a926442e 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -391,7 +391,9 @@ CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ # Purge it of unneccessary internal relative paths # to directories that might not exist yet. # The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta. -SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta` +# Use single quotes here to avoid nested double- and backquotes, this +# macro is also used in a double-quoted context. +SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta` # Control whether to run fixproto and fixincludes. STMP_FIXPROTO = @STMP_FIXPROTO@ @@ -2438,7 +2440,7 @@ modulo-sched.o : modulo-sched.c $(DDG_H) $(CONFIG_H) $(CONFIG_H) $(SYSTEM_H) \ cfghooks.h $(DF_H) $(GCOV_IO_H) hard-reg-set.h $(TM_H) timevar.h tree-pass.h haifa-sched.o : haifa-sched.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h function.h \ - $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) + $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h $(TM_P_H) $(TARGET_H) $(PARAMS_H) sched-deps.o : sched-deps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(RTL_H) $(SCHED_INT_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \ function.h $(INSN_ATTR_H) toplev.h $(RECOG_H) except.h cselib.h \ diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index bcd651bb1ed..0c2852d3188 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for ATMEL AVR at90s8515, ATmega103/103L, ATmega603/603L microcontrollers. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. Contributed by Denis Chertykov (denisc@overta.ru) @@ -869,4 +869,6 @@ extern int avr_case_values_threshold; #define DWARF2_DEBUGGING_INFO 1 +#define DWARF2_ADDR_SIZE 4 + #define OBJECT_FORMAT_ELF diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 95893ebef4e..8f3e05e1f8d 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -9573,7 +9573,7 @@ add,l %2,%3,%3\;bv,n %%r0(%3)" [(set (match_operand:SI 0 "register_operand" "=r") (unspec:SI [(const_int 0)] UNSPEC_TP))] "" - "{mfctl|mfctl,w} %%cr27,%0" + "mfctl %%cr27,%0" [(set_attr "type" "multi") (set_attr "length" "4")]) diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 32cb94d0320..177970b92f0 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -528,6 +528,8 @@ constantpool_address_p (rtx addr) int constantpool_mem_p (rtx op) { + if (GET_CODE (op) == SUBREG) + op = SUBREG_REG (op); if (GET_CODE (op) == MEM) return constantpool_address_p (XEXP (op, 0)); return FALSE; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dcedbab4db1..53b566cc854 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-02-19 Mark Mitchell <mark@codesourcery.com> + + * call.c (build_new_method_call): Ensure that explicit calls of + destructors have type "void". + 2007-02-14 Jakub Jelinek <jakub@redhat.com> PR c++/30536 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 12315901c41..c28ddc3b1db 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5481,6 +5481,20 @@ build_new_method_call (tree instance, tree fns, tree args, && TREE_SIDE_EFFECTS (instance_ptr)) call = build2 (COMPOUND_EXPR, TREE_TYPE (call), instance_ptr, call); + else if (call != error_mark_node + && DECL_DESTRUCTOR_P (cand->fn) + && !VOID_TYPE_P (TREE_TYPE (call))) + /* An explicit call of the form "x->~X()" has type + "void". However, on platforms where destructors + return "this" (i.e., those where + targetm.cxx.cdtor_returns_this is true), such calls + will appear to have a return value of pointer type + to the low-level call machinery. We do not want to + change the low-level machinery, since we want to be + able to optimize "delete f()" on such platforms as + "operator delete(~X(f()))" (rather than generating + "t = f(), ~X(t), operator delete (t)"). */ + call = build_nop (void_type_node, call); } } } diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 4b468f65e51..98e461eb26e 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -6083,6 +6083,12 @@ feedback is available and may be set to higher values than @option{reorder-block-duplicate} since information about the hot spots is more accurate. +@item max-sched-ready-insns +The maximum number of instructions ready to be issued the scheduler should +consider at any given time during the first scheduling pass. Increasing +values mean more thorough searches, making the compilation time increase +with probably little benefit. The default value is 100. + @item max-sched-region-blocks The maximum number of blocks in a region to be considered for interblock scheduling. The default value is 10. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index a6816d4f04f..5196c13a16a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -8407,7 +8407,10 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type, mod_type_die = lookup_type_die (qualified_type); } else if (is_const_type < TYPE_READONLY (dtype) - || is_volatile_type < TYPE_VOLATILE (dtype)) + || is_volatile_type < TYPE_VOLATILE (dtype) + || (is_const_type <= TYPE_READONLY (dtype) + && is_volatile_type <= TYPE_VOLATILE (dtype) + && DECL_ORIGINAL_TYPE (type_name) != type)) /* cv-unqualified version of named type. Just use the unnamed type to which it refers. */ mod_type_die diff --git a/gcc/fold-const.c b/gcc/fold-const.c index b92f21ba677..49e3a910313 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1,6 +1,7 @@ /* Fold a constant sub-tree into a single node for C-compiler Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -8072,6 +8073,53 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) return omit_one_operand (type, t1, arg0); } + /* Canonicalize (X & C1) | C2. */ + if (TREE_CODE (arg0) == BIT_AND_EXPR + && TREE_CODE (arg1) == INTEGER_CST + && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) + { + unsigned HOST_WIDE_INT hi1, lo1, hi2, lo2, mlo, mhi; + int width = TYPE_PRECISION (type); + hi1 = TREE_INT_CST_HIGH (TREE_OPERAND (arg0, 1)); + lo1 = TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)); + hi2 = TREE_INT_CST_HIGH (arg1); + lo2 = TREE_INT_CST_LOW (arg1); + + /* If (C1&C2) == C1, then (X&C1)|C2 becomes (X,C2). */ + if ((hi1 & hi2) == hi1 && (lo1 & lo2) == lo1) + return omit_one_operand (type, arg1, TREE_OPERAND (arg0, 0)); + + if (width > HOST_BITS_PER_WIDE_INT) + { + mhi = (unsigned HOST_WIDE_INT) -1 + >> (2 * HOST_BITS_PER_WIDE_INT - width); + mlo = -1; + } + else + { + mhi = 0; + mlo = (unsigned HOST_WIDE_INT) -1 + >> (HOST_BITS_PER_WIDE_INT - width); + } + + /* If (C1|C2) == ~0 then (X&C1)|C2 becomes X|C2. */ + if ((~(hi1 | hi2) & mhi) == 0 && (~(lo1 | lo2) & mlo) == 0) + return fold_build2 (BIT_IOR_EXPR, type, + TREE_OPERAND (arg0, 0), arg1); + + /* Minimize the number of bits set in C1, i.e. C1 := C1 & ~C2. */ + hi1 &= mhi; + lo1 &= mlo; + if ((hi1 & ~hi2) != hi1 || (lo1 & ~lo2) != lo1) + return fold_build2 (BIT_IOR_EXPR, type, + fold_build2 (BIT_AND_EXPR, type, + TREE_OPERAND (arg0, 0), + build_int_cst_wide (type, + lo1 & ~lo2, + hi1 & ~hi2)), + arg1); + } + t1 = distribute_bit_expr (code, type, arg0, arg1); if (t1 != NULL_TREE) return t1; @@ -8214,6 +8262,16 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1) && operand_equal_p (arg0, TREE_OPERAND (arg1, 0), 0)) return omit_one_operand (type, integer_zero_node, arg0); + /* Canonicalize (X | C1) & C2 as (X & C2) | (C1 & C2). */ + if (TREE_CODE (arg0) == BIT_IOR_EXPR + && TREE_CODE (arg1) == INTEGER_CST + && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST) + return fold_build2 (BIT_IOR_EXPR, type, + fold_build2 (BIT_AND_EXPR, type, + TREE_OPERAND (arg0, 0), arg1), + fold_build2 (BIT_AND_EXPR, type, + TREE_OPERAND (arg0, 1), arg1)); + t1 = distribute_bit_expr (code, type, arg0, arg1); if (t1 != NULL_TREE) return t1; diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ea90d12b116..ef28e189c8d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,22 @@ +2007-02-15 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/30799 + * primary.c (match_logical_constant): Return MATCH_ERROR on invalid + kind. + +2007-02-15 Tobias Schlueter <tobi@gcc.gnu.org> + + PR fortran/30478 + * decl.c (create_enum_history, gfc_free_enum_history): Formatting + fixes. + (add_init_expr_to_sym): Remove ENUM-specific code-path. + (variable_decl): Likewise. Formatting fix. + (match_attr_spec): Remove ENUM-specific codepath. + (gfc_match_enum): Fix typo in error message. + (enumerator_decl): New. + (gfc_match_enumerator_def): Strip down to code necessary for + ENUMs, use enumerator_decl. + 2007-02-13 Release Manager * GCC 4.1.2 released. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index e69ae3cbe28..df362014668 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -758,7 +758,7 @@ gfc_set_constant_character_len (int len, gfc_expr * expr) INIT points to its enumerator value. */ static void -create_enum_history(gfc_symbol *sym, gfc_expr *init) +create_enum_history (gfc_symbol *sym, gfc_expr *init) { enumerator_history *new_enum_history; gcc_assert (sym != NULL && init != NULL); @@ -789,7 +789,7 @@ create_enum_history(gfc_symbol *sym, gfc_expr *init) /* Function to free enum kind history. */ void -gfc_free_enum_history(void) +gfc_free_enum_history (void) { enumerator_history *current = enum_history; enumerator_history *next; @@ -805,7 +805,7 @@ gfc_free_enum_history(void) } -/* Function called by variable_decl() that adds an initialization +/* Function called by variabl_decl() that adds an initialization expression to a symbol. */ static try @@ -911,10 +911,6 @@ add_init_expr_to_sym (const char *name, gfc_expr ** initp, *initp = NULL; } - /* Maintain enumerator history. */ - if (gfc_current_state () == COMP_ENUM) - create_enum_history (sym, init); - return SUCCESS; } @@ -1073,14 +1069,6 @@ variable_decl (int elem) if (m == MATCH_NO) as = gfc_copy_array_spec (current_as); - else if (gfc_current_state () == COMP_ENUM) - { - gfc_error ("Enumerator cannot be array at %C"); - gfc_free_enum_history (); - m = MATCH_ERROR; - goto cleanup; - } - char_len = NULL; cl = NULL; @@ -1179,10 +1167,11 @@ variable_decl (int elem) goto cleanup; } - /* An interface body specifies all of the procedure's characteristics and these - shall be consistent with those specified in the procedure definition, except - that the interface may specify a procedure that is not pure if the procedure - is defined to be pure(12.3.2). */ + /* An interface body specifies all of the procedure's + characteristics and these shall be consistent with those + specified in the procedure definition, except that the interface + may specify a procedure that is not pure if the procedure is + defined to be pure(12.3.2). */ if (current_ts.type == BT_DERIVED && gfc_current_ns->proc_name->attr.if_source == IFSRC_IFBODY && current_ts.derived->ns != gfc_current_ns) @@ -1288,30 +1277,6 @@ variable_decl (int elem) } } - /* Check if we are parsing an enumeration and if the current enumerator - variable has an initializer or not. If it does not have an - initializer, the initialization value of the previous enumerator - (stored in last_initializer) is incremented by 1 and is used to - initialize the current enumerator. */ - if (gfc_current_state () == COMP_ENUM) - { - if (initializer == NULL) - initializer = gfc_enum_initializer (last_initializer, old_locus); - - if (initializer == NULL || initializer->ts.type != BT_INTEGER) - { - gfc_error("ENUMERATOR %L not initialized with integer expression", - &var_locus); - m = MATCH_ERROR; - gfc_free_enum_history (); - goto cleanup; - } - - /* Store this current initializer, for the next enumerator - variable to be parsed. */ - last_initializer = initializer; - } - /* Add the initializer. Note that it is fine if initializer is NULL here, because we sometimes also need to check if a declaration *must* have an initialization expression. */ @@ -2033,12 +1998,6 @@ match_attr_spec (void) if (d == DECL_NONE || d == DECL_COLON) break; - if (gfc_current_state () == COMP_ENUM) - { - gfc_error ("Enumerator cannot have attributes %C"); - return MATCH_ERROR; - } - seen[d]++; seen_at[d] = gfc_current_locus; @@ -2057,18 +2016,6 @@ match_attr_spec (void) } } - /* If we are parsing an enumeration and have ensured that no other - attributes are present we can now set the parameter attribute. */ - if (gfc_current_state () == COMP_ENUM) - { - t = gfc_add_flavor (¤t_attr, FL_PARAMETER, NULL, NULL); - if (t == FAILURE) - { - m = MATCH_ERROR; - goto cleanup; - } - } - /* No double colon, so assume that we've been looking at something else the whole time. */ if (d == DECL_NONE) @@ -4081,7 +4028,7 @@ gfc_match_enum (void) return m; if (gfc_notify_std (GFC_STD_F2003, - "New in Fortran 2003: ENUM AND ENUMERATOR at %C") + "New in Fortran 2003: ENUM and ENUMERATOR at %C") == FAILURE) return MATCH_ERROR; @@ -4089,19 +4036,116 @@ gfc_match_enum (void) } +/* Match a variable name with an optional initializer. When this + subroutine is called, a variable is expected to be parsed next. + Depending on what is happening at the moment, updates either the + symbol table or the current interface. */ + +static match +enumerator_decl (void) +{ + char name[GFC_MAX_SYMBOL_LEN + 1]; + gfc_expr *initializer; + gfc_array_spec *as = NULL; + gfc_symbol *sym; + locus var_locus; + match m; + try t; + locus old_locus; + + initializer = NULL; + old_locus = gfc_current_locus; + + /* When we get here, we've just matched a list of attributes and + maybe a type and a double colon. The next thing we expect to see + is the name of the symbol. */ + m = gfc_match_name (name); + if (m != MATCH_YES) + goto cleanup; + + var_locus = gfc_current_locus; + + /* OK, we've successfully matched the declaration. Now put the + symbol in the current namespace. If we fail to create the symbol, + bail out. */ + if (build_sym (name, NULL, &as, &var_locus) == FAILURE) + { + m = MATCH_ERROR; + goto cleanup; + } + + /* The double colon must be present in order to have initializers. + Otherwise the statement is ambiguous with an assignment statement. */ + if (colon_seen) + { + if (gfc_match_char ('=') == MATCH_YES) + { + m = gfc_match_init_expr (&initializer); + if (m == MATCH_NO) + { + gfc_error ("Expected an initialization expression at %C"); + m = MATCH_ERROR; + } + + if (m != MATCH_YES) + goto cleanup; + } + } + + /* If we do not have an initializer, the initialization value of the + previous enumerator (stored in last_initializer) is incremented + by 1 and is used to initialize the current enumerator. */ + if (initializer == NULL) + initializer = gfc_enum_initializer (last_initializer, old_locus); + + if (initializer == NULL || initializer->ts.type != BT_INTEGER) + { + gfc_error("ENUMERATOR %L not initialized with integer expression", + &var_locus); + m = MATCH_ERROR; + gfc_free_enum_history (); + goto cleanup; + } + + /* Store this current initializer, for the next enumerator variable + to be parsed. add_init_expr_to_sym() zeros initializer, so we + use last_initializer below. */ + last_initializer = initializer; + t = add_init_expr_to_sym (name, &initializer, &var_locus); + + /* Maintain enumerator history. */ + gfc_find_symbol (name, NULL, 0, &sym); + create_enum_history (sym, last_initializer); + + return (t == SUCCESS) ? MATCH_YES : MATCH_ERROR; + +cleanup: + /* Free stuff up and return. */ + gfc_free_expr (initializer); + + return m; +} + + /* Match the enumerator definition statement. */ match gfc_match_enumerator_def (void) { match m; - int elem; + try t; gfc_clear_ts (¤t_ts); m = gfc_match (" enumerator"); if (m != MATCH_YES) return m; + + m = gfc_match (" :: "); + if (m == MATCH_ERROR) + return m; + + colon_seen = (m == MATCH_YES); if (gfc_current_state () != COMP_ENUM) { @@ -4113,17 +4157,17 @@ gfc_match_enumerator_def (void) (¤t_ts)->type = BT_INTEGER; (¤t_ts)->kind = gfc_c_int_kind; - m = match_attr_spec (); - if (m == MATCH_ERROR) + gfc_clear_attr (¤t_attr); + t = gfc_add_flavor (¤t_attr, FL_PARAMETER, NULL, NULL); + if (t == FAILURE) { - m = MATCH_NO; + m = MATCH_ERROR; goto cleanup; } - elem = 1; for (;;) { - m = variable_decl (elem++); + m = enumerator_decl (); if (m == MATCH_ERROR) goto cleanup; if (m == MATCH_NO) diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 182cb4c47e8..e5bdd79c74e 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1039,7 +1039,10 @@ match_logical_constant (gfc_expr ** result) kind = gfc_default_logical_kind; if (gfc_validate_kind (BT_LOGICAL, kind, true) < 0) - gfc_error ("Bad kind for logical constant at %C"); + { + gfc_error ("Bad kind for logical constant at %C"); + return MATCH_ERROR; + } e = gfc_get_expr (); diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 5713e9a2cfb..6a94f77b852 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -142,6 +142,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "recog.h" #include "sched-int.h" #include "target.h" +#include "params.h" #ifdef INSN_SCHEDULING @@ -1379,9 +1380,22 @@ queue_to_ready (struct ready_list *ready) fprintf (sched_dump, ";;\t\tQ-->Ready: insn %s: ", (*current_sched_info->print_insn) (insn, 0)); - ready_add (ready, insn); - if (sched_verbose >= 2) - fprintf (sched_dump, "moving to ready without stalls\n"); + /* If the ready list is full, delay the insn for 1 cycle. + See the comment in schedule_block for the rationale. */ + if (!reload_completed + && ready->n_ready > MAX_SCHED_READY_INSNS + && !SCHED_GROUP_P (insn)) + { + if (sched_verbose >= 2) + fprintf (sched_dump, "requeued because ready full\n"); + queue_insn (insn, 1); + } + else + { + ready_add (ready, insn); + if (sched_verbose >= 2) + fprintf (sched_dump, "moving to ready without stalls\n"); + } } insn_queue[q_ptr] = 0; @@ -1903,6 +1917,31 @@ schedule_block (int b, int rgn_n_insns) memset (insn_queue, 0, (max_insn_queue_index + 1) * sizeof (rtx)); last_clock_var = -1; + /* The algorithm is O(n^2) in the number of ready insns at any given + time in the worst case. Before reload we are more likely to have + big lists so truncate them to a reasonable size. */ + if (!reload_completed && ready.n_ready > MAX_SCHED_READY_INSNS) + { + ready_sort (&ready); + + /* Find first free-standing insn past MAX_SCHED_READY_INSNS. */ + for (i = MAX_SCHED_READY_INSNS; i < ready.n_ready; i++) + if (!SCHED_GROUP_P (ready_element (&ready, i))) + break; + + if (sched_verbose >= 2) + { + fprintf (sched_dump, + ";;\t\tReady list on entry: %d insns\n", ready.n_ready); + fprintf (sched_dump, + ";;\t\t before reload => truncated to %d insns\n", i); + } + + /* Delay all insns past it for 1 cycle. */ + while (i < ready.n_ready) + queue_insn (ready_remove (&ready, i), 1); + } + /* Start just before the beginning of time. */ clock_var = -1; advance = 0; diff --git a/gcc/loop.c b/gcc/loop.c index f9d7493a03b..e37a806ba9b 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -6493,13 +6493,13 @@ strength_reduce (struct loop *loop, int flags) v->ignore = 1; bl->all_reduced = 0; } - else if (!v->always_computable + else if (! v->always_executed && (may_trap_or_fault_p (v->add_val) || may_trap_or_fault_p (v->mult_val))) { if (loop_dump_stream) fprintf (loop_dump_stream, - "giv of insn %d: not always computable.\n", + "giv of insn %d: not always executed.\n", INSN_UID (v->insn)); v->ignore = 1; bl->all_reduced = 0; diff --git a/gcc/params.def b/gcc/params.def index a9f5c8b9fdd..23b3113d63a 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -560,6 +560,12 @@ DEFPARAM (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE, "max-fields-for-field-sensitive", "Maximum number of fields in a structure before pointer analysis treats the structure as a single variable", 100, 0, 0) + +DEFPARAM(PARAM_MAX_SCHED_READY_INSNS, + "max-sched-ready-insns", + "The maximum number of instructions ready to be issued to be considered by the scheduler during the first scheduling pass", + 100, 0, 0) + /* Local variables: mode:c diff --git a/gcc/params.h b/gcc/params.h index 90ccabb2556..bb5f097c548 100644 --- a/gcc/params.h +++ b/gcc/params.h @@ -147,4 +147,6 @@ typedef enum compiler_param PARAM_VALUE (PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO) #define MAX_FIELDS_FOR_FIELD_SENSITIVE \ ((size_t) PARAM_VALUE (PARAM_MAX_FIELDS_FOR_FIELD_SENSITIVE)) +#define MAX_SCHED_READY_INSNS \ + PARAM_VALUE (PARAM_MAX_SCHED_READY_INSNS) #endif /* ! GCC_PARAMS_H */ diff --git a/gcc/reload1.c b/gcc/reload1.c index 42f186f7bc8..9ef2f6f5ec2 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1,6 +1,7 @@ /* Reload pseudo regs into hard regs for insns that require hard regs. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of GCC. @@ -3054,6 +3055,7 @@ eliminate_regs_in_insn (rtx insn, int replace) { rtx to_rtx = ep->to_rtx; offset += ep->offset; + offset = trunc_int_for_mode (offset, GET_MODE (reg)); if (GET_CODE (XEXP (plus_cst_src, 0)) == SUBREG) to_rtx = gen_lowpart (GET_MODE (XEXP (plus_cst_src, 0)), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dcf63303c4e..f1aeffe2b18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,45 @@ +2007-02-20 Ira Rosen <irar@il.ibm.com> + + * gfortran.dg/vect/vect-2.f90: Xfail to vectorize one of the loops + because of aliasing. + +2007-02-18 Roger Sayle <roger@eyesopen.com> + + PR middle-end/24427 + PR rtl-optimization/28173 + * gcc.dg/tree-ssa/andor-1.c: New test case. + +2007-02-18 Ira Rosen <irar@il.ibm.com> + + * gcc.dg/vect/vect-106-alias.c: New test. + +2007-02-16 Eric Botcazou <ebotcazou@libertysurf.fr> + + * gcc.c-torture/execute/20070216-1.c: New test. + +2007-02-15 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/30799 + * gfortran.dg/logical_2.f90: New test. + +2007-02-15 Alexandre Oliva <aoliva@redhat.com> + + * g++.dg/tree-ssa/sra-1.C: New. + +2007-02-10 Tobias Schlueter <tobi@gcc.gnu.org> + + PR fortran/30478 + * gfortran.dg/enum_4.f90: Update expected error message. + +2007-02-15 Alexandre Oliva <aoliva@redhat.com> + + PR debug/30189 + * gcc.dg/pr30189.c: New test. + +2007-02-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * g++.dg/tree-ssa/nothrow-1.C: Skip test if -fpic/-fPIC is used. + 2007-02-14 Jakub Jelinek <jakub@redhat.com> PR c++/30536 diff --git a/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C b/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C index 6dbf1393a39..4bb71589de3 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/nothrow-1.C @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O1 -fdump-tree-cfg" } */ +/* { dg-skip-if "" { "*-*-*" } { "-fpic" "-fPIC" } { "" } } */ double a; void t() { diff --git a/gcc/testsuite/g++.dg/tree-ssa/sra-1.C b/gcc/testsuite/g++.dg/tree-ssa/sra-1.C new file mode 100644 index 00000000000..e3e3918eb78 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/sra-1.C @@ -0,0 +1,29 @@ +/* https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=223576 */ + +/* SRA failed to canonicalize bit-field types, introducing type + mismatches. */ + +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +struct A +{ + int a:16; + /* These dummy bit-fields are here to prevent GCC 4.2+ from merging + the bit-field compares into a single word compare, which disables + SRA. */ + int a2:16; + int a3:16; + int a4:16; + int b:8; + bool operator==(A const x) const + { + return (this->a == x.a && this->b == x.b); + } +}; + +bool +foo (A const x, A const y) +{ + return x == y; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/20070216-1.c b/gcc/testsuite/gcc.c-torture/execute/20070216-1.c new file mode 100644 index 00000000000..fc235606926 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20070216-1.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/30787 */ +/* Testcase by Jakub Jelinek <jakub@gcc.gnu.org> */ + +struct S +{ + int *s; +}; + +void test (int x, struct S *y) +{ + int i; + for (i = 0; i < x; i++) + { + if (y) + y->s[i] += 1; + } +} + +int main (void) +{ + test (1, (void *) 0); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr30189.c b/gcc/testsuite/gcc.dg/pr30189.c new file mode 100644 index 00000000000..6aa963e7a10 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr30189.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-g -O" } */ + +extern void foo (void); + +static +void baz (int i) +{ + foo (); + typedef char A[i]; + struct { A b; } *x = 0; +} + +void +bar (i) +{ + baz (i); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/andor-1.c b/gcc/testsuite/gcc.dg/tree-ssa/andor-1.c new file mode 100644 index 00000000000..1a53857401c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/andor-1.c @@ -0,0 +1,65 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-original" } */ + +unsigned int test1(unsigned int a) +{ + return (a & 1) | 1; +} + +int test2(int b) +{ + return (b & 1) | 1; +} + +unsigned int test3(unsigned int c) +{ + return (c | 1) & 1; +} + +int test4(int d) +{ + return (d | 1) & 1; +} + +unsigned int test5(unsigned int e) +{ + return (e | 4) & 6; +} + +int test6(int f) +{ + return (f | 4) & 6; +} + +unsigned int test7(unsigned int g) +{ + return (g & -2) | 1; +} + +int test8(int h) +{ + return (h & -2) | 1; +} + +unsigned int test9(unsigned int i) +{ + return (i & 3) | 1; +} + +int test10(int j) +{ + return (j & 3) | 1; +} + +/* { dg-final { scan-tree-dump-times "a \& 1 \\| 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "b \& 1 \\| 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "\\(c \\| 1\\) \& 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "\\(d \\| 1\\) \& 1" 0 "original" } } */ +/* { dg-final { scan-tree-dump-times "e \& 2 \\| 4" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "f \& 2 \\| 4" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "g \\| 1" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "h \\| 1" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "i \& 2 \\| 1" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "j \& 2 \\| 1" 1 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-106-alias.c b/gcc/testsuite/gcc.dg/vect/vect-106-alias.c new file mode 100755 index 00000000000..011e7e4c2e7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-106-alias.c @@ -0,0 +1,51 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdlib.h> +#include <stdarg.h> +#include "tree-vect.h" + +#define N 9 + +static int a[N] = {1,2,3,4,5,6,7,8,9}; +static int b[N] = {2,3,4,5,6,7,8,9,0}; + +int main1 () { + int i; + int *p, *q, *p1, *q1; + p = (unsigned int *) malloc (sizeof (unsigned int) * N); + q = (unsigned int *) malloc (sizeof (unsigned int) * N); + + p1 = p; q1 = q; + + /* Not vectorizable: because of the redundant cast (caused by ponter + arithmetics), alias analysis fails to distinguish between + the pointers. */ + for (i = 0; i < N; i++) + { + *(q + i) = a[i]; + *(p + i) = b[i]; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (*q != a[i] || *p != b[i]) + abort(); + q++; + p++; + } + + return 0; +} + +int main (void) +{ + check_vect (); + + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "can't determine dependence" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gfortran.dg/enum_4.f90 b/gcc/testsuite/gfortran.dg/enum_4.f90 index 99acda0c818..be506b400db 100644 --- a/gcc/testsuite/gfortran.dg/enum_4.f90 +++ b/gcc/testsuite/gfortran.dg/enum_4.f90 @@ -5,12 +5,12 @@ program main implicit none enum, bind (c) enumerator :: red, black = 2 - enumerator :: blue = 1, red ! { dg-error "already" } + enumerator :: blue = 1, red ! { dg-error "already has basic type" } end enum enum, bind (c) - enumerator :: r, b(10) = 2 ! { dg-error "cannot be array" } - enumerator , save :: g = 1 ! { dg-error "cannot have attributes" } + enumerator :: r, b(10) = 2 ! { dg-error "Syntax error" } + enumerator , save :: g = 1 ! { dg-error "Syntax error" } end ! { dg-error " END ENUM" } end program main ! { dg-excess-errors "" } diff --git a/gcc/testsuite/gfortran.dg/logical_2.f90 b/gcc/testsuite/gfortran.dg/logical_2.f90 new file mode 100644 index 00000000000..1a28fefd50c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/logical_2.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! PR fortran/30799 +! Inconsistent handling of bad (invalid) LOGICAL kinds +! Reporter: Harald Anlauf <anlauf@gmx.de> +! Testcase altered by Steven G. Kargl +program gfcbug57 + implicit none + ! + ! These are logical kinds known by gfortran and many other compilers: + ! + print *, kind (.true._1) ! This prints "1" + print *, kind (.true._2) ! This prints "2" + print *, kind (.true._4) ! This prints "4" + print *, kind (.true._8) ! This prints "8" + ! + ! These are very strange (read: bad (invalid?)) logical kinds, + ! handled inconsistently by gfortran (there's no logical(kind=0) etc.) + ! + print *, kind (.true._0) ! { dg-error "kind for logical constant" } + print *, kind (.true._3) ! { dg-error "kind for logical constant" } + print *, kind (.true._123) ! { dg-error "kind for logical constant" } + ! + ! Here gfortran bails out with a runtime error: + ! + print *, .true._3 ! { dg-error "kind for logical constant" } +end program gfcbug57 diff --git a/gcc/testsuite/gfortran.dg/vect/vect-2.f90 b/gcc/testsuite/gfortran.dg/vect/vect-2.f90 index a881d9726d3..c7f0ad07c53 100644 --- a/gcc/testsuite/gfortran.dg/vect/vect-2.f90 +++ b/gcc/testsuite/gfortran.dg/vect/vect-2.f90 @@ -14,9 +14,7 @@ END ! support unaligned loads) or using peeling to align the store (on targets that ! support unaligned loads). -! { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } -! { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail vect_no_align } } } -! { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target vect_no_align } } } -! { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail vect_no_align } } } -! { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 3 "vect" {target vect_no_align } } } +! { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } +! { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } +! { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } ! { dg-final { cleanup-tree-dump "vect" } } diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 10a223e2251..2128fb9cc81 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -146,7 +146,12 @@ ptr_ptr_may_alias_p (tree ptr_a, tree ptr_b, tag_b = DR_MEMTAG (drb); if (!tag_b) return false; - *aliased = (tag_a == tag_b); + + if (tag_a == tag_b) + *aliased = true; + else + *aliased = may_aliases_intersect (tag_a, tag_b); + return true; } diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 84ad171adbf..07fc8c28393 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -661,6 +661,7 @@ extern void dump_points_to_info_for (FILE *, tree); extern void debug_points_to_info_for (tree); extern bool may_be_aliased (tree); extern bool is_aliased_with (tree, tree); +extern bool may_aliases_intersect (tree, tree); extern struct ptr_info_def *get_ptr_info (tree); extern void add_type_alias (tree, tree); extern void new_type_alias (tree, tree); diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index a4773b75e94..9e61723b2d2 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1,7 +1,7 @@ /* Scalar Replacement of Aggregates (SRA) converts some structure references into scalar references, exposing them to the scalar optimizers. - Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc. Contributed by Diego Novillo <dnovillo@redhat.com> This file is part of GCC. @@ -1246,7 +1246,23 @@ instantiate_missing_elements (struct sra_elt *elt) tree f; for (f = TYPE_FIELDS (type); f ; f = TREE_CHAIN (f)) if (TREE_CODE (f) == FIELD_DECL) - instantiate_missing_elements_1 (elt, f, TREE_TYPE (f)); + { + tree field_type = TREE_TYPE (f); + + /* canonicalize_component_ref() unwidens some bit-field + types (not marked as DECL_BIT_FIELD in C++), so we + must do the same, lest we may introduce type + mismatches. */ + if (INTEGRAL_TYPE_P (field_type) + && DECL_MODE (f) != TYPE_MODE (field_type)) + field_type = TREE_TYPE (get_unwidened (build3 (COMPONENT_REF, + field_type, + elt->element, + f, NULL_TREE), + NULL_TREE)); + + instantiate_missing_elements_1 (elt, f, field_type); + } break; } @@ -1539,6 +1555,14 @@ generate_element_ref (struct sra_elt *elt) return elt->element; } +static tree +sra_build_assignment (tree dst, tree src) +{ + /* We need TYPE_CANONICAL to compare the types of dst and src + efficiently, but that's only introduced in GCC 4.3. */ + return build (MODIFY_EXPR, void_type_node, dst, src); +} + /* Generate a set of assignment statements in *LIST_P to copy all instantiated elements under ELT to or from the equivalent structure rooted at EXPR. COPY_OUT controls the direction of the copy, with @@ -1562,16 +1586,16 @@ generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr, i = c->replacement; t = build (COMPLEX_EXPR, elt->type, r, i); - t = build (MODIFY_EXPR, void_type_node, expr, t); + t = sra_build_assignment (expr, t); SSA_NAME_DEF_STMT (expr) = t; append_to_statement_list (t, list_p); } else if (elt->replacement) { if (copy_out) - t = build (MODIFY_EXPR, void_type_node, elt->replacement, expr); + t = sra_build_assignment (elt->replacement, expr); else - t = build (MODIFY_EXPR, void_type_node, expr, elt->replacement); + t = sra_build_assignment (expr, elt->replacement); append_to_statement_list (t, list_p); } else @@ -1606,8 +1630,7 @@ generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p) gcc_assert (src->replacement); - t = build (MODIFY_EXPR, void_type_node, dst->replacement, - src->replacement); + t = sra_build_assignment (dst->replacement, src->replacement); append_to_statement_list (t, list_p); } } @@ -1638,7 +1661,7 @@ generate_element_zero (struct sra_elt *elt, tree *list_p) gcc_assert (elt->is_scalar); t = fold_convert (elt->type, integer_zero_node); - t = build (MODIFY_EXPR, void_type_node, elt->replacement, t); + t = sra_build_assignment (elt->replacement, t); append_to_statement_list (t, list_p); } } @@ -1650,7 +1673,9 @@ static void generate_one_element_init (tree var, tree init, tree *list_p) { /* The replacement can be almost arbitrarily complex. Gimplify. */ - tree stmt = build (MODIFY_EXPR, void_type_node, var, init); + tree stmt; + + stmt = sra_build_assignment (var, init); gimplify_and_add (stmt, list_p); } diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e8803722445..2dac169cf09 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -46,6 +46,7 @@ Boston, MA 02110-1301, USA. */ #include "ipa-type-escape.h" #include "vec.h" #include "bitmap.h" +#include "pointer-set.h" /* Obstack used to hold grouping bitmaps and other temporary bitmaps used by aliasing */ @@ -2231,6 +2232,38 @@ is_aliased_with (tree tag, tree sym) } +/* Given two tags return TRUE if their may-alias sets intersect. */ + +bool +may_aliases_intersect (tree tag1, tree tag2) +{ + struct pointer_set_t *set1 = pointer_set_create (); + unsigned i; + varray_type may_aliases1 = var_ann (tag1)->may_aliases; + varray_type may_aliases2 = var_ann (tag2)->may_aliases; + + if (may_aliases1 == NULL || may_aliases2 == NULL) + return false; + + /* Insert all the symbols from the first may-alias set into the + pointer-set. */ + for (i = 0; i < VARRAY_ACTIVE_SIZE (may_aliases1); i++) + pointer_set_insert (set1, VARRAY_TREE (may_aliases1, i)); + + /* Go through the second may-alias set and check if it contains symbols that + are common with the first set. */ + for (i = 0; i < VARRAY_ACTIVE_SIZE (may_aliases2); i++) + if (pointer_set_contains (set1, VARRAY_TREE (may_aliases2, i))) + { + pointer_set_destroy (set1); + return true; + } + + pointer_set_destroy (set1); + return false; +} + + /* Add VAR to the list of may-aliases of PTR's type tag. If PTR doesn't already have a type tag, create one. */ diff --git a/gcc/version.c b/gcc/version.c index 4b81a03cbcc..927ce3b43dc 100644 --- a/gcc/version.c +++ b/gcc/version.c @@ -8,7 +8,7 @@ in parentheses. You may also wish to include a number indicating the revision of your modified compiler. */ -#define VERSUFFIX " (Red Hat 4.1.2-1)" +#define VERSUFFIX " (Red Hat 4.1.2-2)" /* This is the location of the online document giving instructions for reporting bugs. If you distribute a modified version of GCC, @@ -1133,7 +1133,7 @@ freebsd1*) ;; freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` version_type=freebsd-$objformat case $version_type in freebsd-elf*) |