diff options
author | Paul Brook <paul@codesourcery.com> | 2006-06-06 02:01:12 +0000 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2006-06-06 02:01:12 +0000 |
commit | f9bbb7008bbc97d3bdb7d18ad6f6f321557b5aac (patch) | |
tree | 8a6ba517141746e5e04e5a07fa22d08d542f9d97 | |
parent | e77e490a1b9d366d91b3e2fbdbc30dc5ae412b9a (diff) |
Merge from csl/sourcerygxx-4_1 version 114420.csl/sourcerygxx/4.1-9csl/sourcerygxx/4.1-8csl/sourcerygxx/4.1-7csl/sourcerygxx/4.1-13csl/arm/2006q1-6csl/arm-4_1
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/csl/arm-4_1@114421 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog.csl | 53 | ||||
-rw-r--r-- | gcc/builtins.c | 23 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 11 | ||||
-rw-r--r-- | gcc/config/mips/linux-unwind.h | 14 | ||||
-rw-r--r-- | gcc/fold-const.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr26622.c | 11 | ||||
-rw-r--r-- | gcc/tree.h | 4 | ||||
-rw-r--r-- | libiberty/make-relative-prefix.c | 52 |
9 files changed, 151 insertions, 42 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl index 027c64b3db1..395b3140d4d 100644 --- a/ChangeLog.csl +++ b/ChangeLog.csl @@ -1,3 +1,56 @@ +2006-06-06 Paul Brook <paul@codesourcery.com> + + Merge from branches/csl/sourcerygxx-4_1 + + 2006-06-01 Mark Shinwell <shinwell@codesourcery.com> + * gcc/builtins.c (expand_builtin_return_addr): Always use + hard_frame_pointer_rtx and prevent frame pointer elimination + if INITIAL_FRAME_ADDRESS_RTX isn't set. + + 2006-06-01 Mark Shinwell <shinwell@codesourcery.com> + * gcc/tree.h: Declare folding_initializer. + * gcc/builtins.c (fold_builtin_constant_p): Give definite answer + if folding inside an initializer. + * gcc/fold-const.c: Define folding_initializer. + (START_FOLD_INIT): Save and then set folding_initializer. + (END_FOLD_INIT): Restore folding_initializer. + * gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c: + New test. + + 2006-05-31 Carlos O'Donell <carlos@codesourcery.com> + Backport from mainline: + 2006-05-31 Richard Earnshaw <richard.earnshaw@arm.com> + PR target/27829 + * gcc/config/arm/arm.c (arm_print_operand case 'S'): Validate + that the operand is a shift operand before calling shift_op. + Avoid redundant call of shift_op. + + 2006-05-29 Kazu Hirata <kazu@codesourcery.com> + Backport from mainline: + 2006-05-28 Kazu Hirata <kazu@codesourcery.com> + PR tree-optimization/26622. + * gcc/fold-const.c (fold_ternary) <COND_EXPR>: Call fold_convert + on arg1. + + PR tree-optimization/26622. + * gcc/testsuite/gcc.c-torture/compile/pr26622.c: New. + + 2006-05-19 Nathan Sidwell <nathan@codesourcery.com> + * libiberty/make-relative-prefix.c (split_directories): Add + ignore_final arg. + (make_relative_prefix): Keep the final path component if it was a + directory. Adjust calls to split_directories. + + 2006-05-20 Richard Sandiford <richard@codesourcery.com> + Merge from mainline: + gcc/ + 2006-05-19 Richard Sandiford <richard@codesourcery.com> + + * config/mips/linux-unwind.h: Include <asm/unistd.h> + (mips_fallback_frame_state): Use syscall numbers to determine + the appropriate li instruction for the current ABI. Only use + __NR_sigreturn for o32. + 2006-05-12 Nathan Sidwell <nathan@codesourcery.com> * Merge from csl/sourcerygxx-4_1 version 113722 diff --git a/gcc/builtins.c b/gcc/builtins.c index 0db91bd4f98..2396b6df848 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -496,20 +496,14 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count) #else rtx tem; - /* For a zero count, we don't care what frame address we return, so frame - pointer elimination is OK, and using the soft frame pointer is OK. - For a non-zero count, we require a stable offset from the current frame - pointer to the previous one, so we must use the hard frame pointer, and - we must disable frame pointer elimination. */ - if (count == 0) - tem = frame_pointer_rtx; - else - { - tem = hard_frame_pointer_rtx; + /* We require a stable offset from the current frame pointer to the + previous one, so we must use the hard frame pointer, and we must + disable frame pointer elimination. */ - /* Tell reload not to eliminate the frame pointer. */ - current_function_accesses_prior_frames = 1; - } + tem = hard_frame_pointer_rtx; + + /* Tell reload not to eliminate the frame pointer. */ + current_function_accesses_prior_frames = 1; #endif /* Some machines need special handling before we can access @@ -6562,7 +6556,8 @@ fold_builtin_constant_p (tree arglist) if (TREE_SIDE_EFFECTS (arglist) || AGGREGATE_TYPE_P (TREE_TYPE (arglist)) || POINTER_TYPE_P (TREE_TYPE (arglist)) - || cfun == 0) + || cfun == 0 + || folding_initializer) return integer_zero_node; return 0; diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index c151c83b3df..ebc00935b78 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -11573,11 +11573,18 @@ arm_print_operand (FILE *stream, rtx x, int code) case 'S': { HOST_WIDE_INT val; - const char * shift = shift_op (x, &val); + const char *shift; + if (!shift_operator (x, SImode)) + { + output_operand_lossage ("invalid shift operand"); + break; + } + + shift = shift_op (x, &val); if (shift) { - fprintf (stream, ", %s ", shift_op (x, &val)); + fprintf (stream, ", %s ", shift); if (val == -1) arm_print_operand (stream, XEXP (x, 1), 0); else diff --git a/gcc/config/mips/linux-unwind.h b/gcc/config/mips/linux-unwind.h index 4152138ae04..4f96e95e940 100644 --- a/gcc/config/mips/linux-unwind.h +++ b/gcc/config/mips/linux-unwind.h @@ -31,6 +31,7 @@ Boston, MA 02110-1301, USA. */ state data appropriately. See unwind-dw2.c for the structs. */ #include <signal.h> +#include <asm/unistd.h> /* The third parameter to the signal handler points to something with * this structure defined in asm/ucontext.h, but the name clashes with @@ -59,20 +60,23 @@ mips_fallback_frame_state (struct _Unwind_Context *context, /* or */ /* 24021017 li v0, 0x1017 (sigreturn) */ /* 0000000c syscall */ - if (*(pc + 1) != 0x0000000c) + if (pc[1] != 0x0000000c) return _URC_END_OF_STACK; - if (*(pc + 0) == 0x24021017) +#if _MIPS_SIM == _ABIO32 + if (pc[0] == (0x24020000 | __NR_sigreturn)) { struct sigframe { - u_int32_t trampoline[2]; + u_int32_t trampoline[2]; struct sigcontext sigctx; } *rt_ = context->ra; sc = &rt_->sigctx; } - else if (*(pc + 0) == 0x24021061) + else +#endif + if (pc[0] == (0x24020000 | __NR_rt_sigreturn)) { struct rt_sigframe { - u_int32_t trampoline[2]; + u_int32_t trampoline[2]; struct siginfo info; _sig_ucontext_t uc; } *rt_ = context->ra; diff --git a/gcc/fold-const.c b/gcc/fold-const.c index e40019523d6..468c1f40df1 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -59,6 +59,10 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "langhooks.h" #include "md5.h" +/* Non-zero if we are folding constants inside an initializer; zero + otherwise. */ +int folding_initializer = 0; + /* The following constants represent a bit based encoding of GCC's comparison operators. This encoding simplifies transformations on relational comparison operators, such as AND and OR. */ @@ -10072,8 +10076,10 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2) && integer_zerop (TREE_OPERAND (arg0, 1)) && integer_zerop (op2) && (tem = sign_bit_p (TREE_OPERAND (arg0, 0), arg1))) - return fold_convert (type, fold_build2 (BIT_AND_EXPR, - TREE_TYPE (tem), tem, arg1)); + return fold_convert (type, + fold_build2 (BIT_AND_EXPR, + TREE_TYPE (tem), tem, + fold_convert (TREE_TYPE (tem), arg1))); /* (A >> N) & 1 ? (1 << N) : 0 is simply A & (1 << N). A & 1 was already handled above. */ @@ -10616,16 +10622,19 @@ fold_build3_stat (enum tree_code code, tree type, tree op0, tree op1, tree op2 int saved_trapping_math = flag_trapping_math;\ int saved_rounding_math = flag_rounding_math;\ int saved_trapv = flag_trapv;\ + int saved_folding_initializer = folding_initializer;\ flag_signaling_nans = 0;\ flag_trapping_math = 0;\ flag_rounding_math = 0;\ - flag_trapv = 0 + flag_trapv = 0;\ + folding_initializer = 1; #define END_FOLD_INIT \ flag_signaling_nans = saved_signaling_nans;\ flag_trapping_math = saved_trapping_math;\ flag_rounding_math = saved_rounding_math;\ - flag_trapv = saved_trapv + flag_trapv = saved_trapv;\ + folding_initializer = saved_folding_initializer; tree fold_build1_initializer (enum tree_code code, tree type, tree op) diff --git a/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c b/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c new file mode 100644 index 00000000000..fdfe3e0da6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/builtin_constant_p.c @@ -0,0 +1,8 @@ +/* { dg-options "-O2" } */ + +int main (int argc, char *argv[]) +{ + static int a[] = { __builtin_constant_p (argc) ? 1 : 0 }; + return a[0]; +} + diff --git a/gcc/testsuite/gcc.c-torture/compile/pr26622.c b/gcc/testsuite/gcc.c-torture/compile/pr26622.c new file mode 100644 index 00000000000..aea991ece35 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr26622.c @@ -0,0 +1,11 @@ +/* PR middle-end/26622 + fold_ternary used to create a tree with mismatching types, causing + (const_int 128) to appear in QImode rtx. */ + +unsigned char g; + +unsigned long long +foo (void) +{ + return ((long long) ((g & 0x80) != 0)) << 7; +} diff --git a/gcc/tree.h b/gcc/tree.h index 98aca7f1851..cb0638d47d7 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3794,6 +3794,10 @@ extern void using_eh_for_cleanups (void); /* In fold-const.c */ +/* Non-zero if we are folding constants inside an initializer; zero + otherwise. */ +extern int folding_initializer; + /* Fold constants as much as possible in an expression. Returns the simplified expression. Acts only on the top level of the expression; diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c index 66ddcaa471b..98d1a3fdf0c 100644 --- a/libiberty/make-relative-prefix.c +++ b/libiberty/make-relative-prefix.c @@ -96,7 +96,7 @@ relative prefix can be found, return @code{NULL}. #define DIR_UP ".." static char *save_string (const char *, int); -static char **split_directories (const char *, int *); +static char **split_directories (const char *, int *, int); static void free_split_directories (char **); static char * @@ -112,7 +112,7 @@ save_string (const char *s, int len) /* Split a filename into component directories. */ static char ** -split_directories (const char *name, int *ptr_num_dirs) +split_directories (const char *name, int *ptr_num_dirs, int ignore_final) { int num_dirs = 0; char **dirs; @@ -179,7 +179,7 @@ split_directories (const char *name, int *ptr_num_dirs) } } - if (p - 1 - q > 0) + if (!ignore_final && p - 1 - q > 0) dirs[num_dirs++] = save_string (q, p - 1 - q); dirs[num_dirs] = NULL; @@ -226,6 +226,8 @@ make_relative_prefix (const char *progname, int i, n, common; int needed_len; char *ret, *ptr, *full_progname = NULL; + int len; + int isdir; if (progname == NULL || bin_prefix == NULL || prefix == NULL) return NULL; @@ -293,15 +295,18 @@ make_relative_prefix (const char *progname, if (full_progname == NULL) return NULL; - prog_dirs = split_directories (full_progname, &prog_num); - bin_dirs = split_directories (bin_prefix, &bin_num); + /* If the incoming prog is really a directory, then we need to keep + the final element, otherwise we need to remove it. */ + len = strlen (progname); + isdir = IS_DIR_SEPARATOR (progname[len - 1]); + + prog_dirs = split_directories (full_progname, &prog_num, !isdir); + + bin_dirs = split_directories (bin_prefix, &bin_num, 0); free (full_progname); if (bin_dirs == NULL || prog_dirs == NULL) return NULL; - /* Remove the program name from comparison of directory names. */ - prog_num--; - /* If we are still installed in the standard location, we don't need to specify relative directories. Also, if argv[0] still doesn't contain any directory specifiers after the search above, then there is not much @@ -323,7 +328,7 @@ make_relative_prefix (const char *progname, } } - prefix_dirs = split_directories (prefix, &prefix_num); + prefix_dirs = split_directories (prefix, &prefix_num, 0); if (prefix_dirs == NULL) { free_split_directories (prog_dirs); @@ -350,7 +355,7 @@ make_relative_prefix (const char *progname, /* Two passes: first figure out the size of the result string, and then construct it. */ - needed_len = 0; + needed_len = isdir; for (i = 0; i < prog_num; i++) needed_len += strlen (prog_dirs[i]); needed_len += sizeof (DIR_UP) * (bin_num - common); @@ -363,24 +368,37 @@ make_relative_prefix (const char *progname, return NULL; /* Build up the pathnames in argv[0]. */ - *ret = '\0'; + ptr = ret; for (i = 0; i < prog_num; i++) - strcat (ret, prog_dirs[i]); - + { + len = strlen (prog_dirs[i]); + memcpy (ptr, prog_dirs[i], len); + ptr += len; + } + + /* lrealpath will have removed the trailing '/', so put it back + now. */ + if (isdir) + *ptr++ = DIR_SEPARATOR; + /* Now build up the ..'s. */ - ptr = ret + strlen(ret); for (i = common; i < bin_num; i++) { strcpy (ptr, DIR_UP); ptr += sizeof (DIR_UP) - 1; *(ptr++) = DIR_SEPARATOR; } - *ptr = '\0'; /* Put in directories to move over to prefix. */ for (i = common; i < prefix_num; i++) - strcat (ret, prefix_dirs[i]); - + { + len = strlen (prefix_dirs[i]); + memcpy (ptr, prefix_dirs[i], len); + ptr += len; + } + + *ptr = 0; + free_split_directories (prog_dirs); free_split_directories (bin_dirs); free_split_directories (prefix_dirs); |