diff options
author | ramana <ramana@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-10 08:13:30 +0000 |
---|---|---|
committer | ramana <ramana@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-04-10 08:13:30 +0000 |
commit | 5ad494f96e264b0b840af1e4a6a9352ed4e2a718 (patch) | |
tree | 950605bf00f8407c8e379651b34cf95a1cfbcf1d | |
parent | 71d945657fdcd082827fd39f8c0f6beea38102c1 (diff) | |
download | gcc-5ad494f96e264b0b840af1e4a6a9352ed4e2a718.tar.gz |
Fix PR debug/60655 part 2.
2014-04-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR debug/60655
* config/arm/arm.c (TARGET_CONST_NOT_OK_FOR_DEBUG_P): Define
(arm_const_not_ok_for_debug_p): Reject MINUS with SYM_REF's
ameliorating the cases where it can be.
2014-04-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
PR debug/60655
* gcc.c-torture/compile/pr60655-2.c: Copy from pr60655-1.c without
-fdata-sections.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209269 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/arm/arm.c | 46 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr60655-2.c | 30 |
4 files changed, 89 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d55168e5691..4e1ef1f3e47 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-04-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> + + PR debug/60655 + * config/arm/arm.c (TARGET_CONST_NOT_OK_FOR_DEBUG_P): Define + (arm_const_not_ok_for_debug_p): Reject MINUS with SYM_REF's + ameliorating the cases where it can be. + 2014-04-09 David Edelsohn <dje.gcc@gmail.com> Revert diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 0240cc70e81..e5cf5036631 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -72,6 +72,7 @@ struct four_ints }; /* Forward function declarations. */ +static bool arm_const_not_ok_for_debug_p (rtx); static bool arm_lra_p (void); static bool arm_needs_doubleword_align (enum machine_mode, const_tree); static int arm_compute_static_chain_stack_bytes (void); @@ -674,6 +675,9 @@ static const struct attribute_spec arm_attribute_table[] = #undef TARGET_CAN_USE_DOLOOP_P #define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost +#undef TARGET_CONST_NOT_OK_FOR_DEBUG_P +#define TARGET_CONST_NOT_OK_FOR_DEBUG_P arm_const_not_ok_for_debug_p + struct gcc_target targetm = TARGET_INITIALIZER; /* Obstack for minipool constant handling. */ @@ -31116,4 +31120,46 @@ arm_asan_shadow_offset (void) return (unsigned HOST_WIDE_INT) 1 << 29; } + +/* This is a temporary fix for PR60655. Ideally we need + to handle most of these cases in the generic part but + currently we reject minus (..) (sym_ref). We try to + ameliorate the case with minus (sym_ref1) (sym_ref2) + where they are in the same section. */ + +static bool +arm_const_not_ok_for_debug_p (rtx p) +{ + tree decl_op0 = NULL; + tree decl_op1 = NULL; + + if (GET_CODE (p) == MINUS) + { + if (GET_CODE (XEXP (p, 1)) == SYMBOL_REF) + { + decl_op1 = SYMBOL_REF_DECL (XEXP (p, 1)); + if (decl_op1 + && GET_CODE (XEXP (p, 0)) == SYMBOL_REF + && (decl_op0 = SYMBOL_REF_DECL (XEXP (p, 0)))) + { + if ((TREE_CODE (decl_op1) == VAR_DECL + || TREE_CODE (decl_op1) == CONST_DECL) + && (TREE_CODE (decl_op0) == VAR_DECL + || TREE_CODE (decl_op0) == CONST_DECL)) + return (get_variable_section (decl_op1, false) + != get_variable_section (decl_op0, false)); + + if (TREE_CODE (decl_op1) == LABEL_DECL + && TREE_CODE (decl_op0) == LABEL_DECL) + return (DECL_CONTEXT (decl_op1) + != DECL_CONTEXT (decl_op0)); + } + + return true; + } + } + + return false; +} + #include "gt-arm.h" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f73ef9b481b..a2008d6dde0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-04-10 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> + + PR debug/60655 + * gcc.c-torture/compile/pr60655-2.c: Copy from pr60655-1.c without + -fdata-sections. + 2014-04-09 Steve Ellcey <sellcey@mips.com> * gcc.dg/tree-ssa/ssa-ifcombine-13.c: Remove mips*-*-* from option diff --git a/gcc/testsuite/gcc.c-torture/compile/pr60655-2.c b/gcc/testsuite/gcc.c-torture/compile/pr60655-2.c new file mode 100644 index 00000000000..f33db643f72 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr60655-2.c @@ -0,0 +1,30 @@ + +typedef unsigned char unit; +typedef unit *unitptr; +extern short global_precision; +typedef __SIZE_TYPE__ size_t; +extern void *memcpy (void *dest, const void *src, size_t n); + +short mp_compare(const unit* r1, const unit* r2) +{ + register short precision; + precision = global_precision; + (r1) = ((r1)+(precision)-1); + (r2) = ((r2)+(precision)-1); + do + { if (*r1 < *r2) + return(-1); + if (*((r1)--) > *((r2)--)) + return(1); + } while (--precision); +} + +static unit modulus[((1280+(2*8))/8)]; +static unit d_data[((1280+(2*8))/8)*2]; + +int upton_modmult (unitptr prod, unitptr multiplicand, unitptr multiplier) +{ + unitptr d = d_data; + while (mp_compare(d,modulus) > 0) + memcpy((void*)(prod), (const void*)(d), (global_precision)); +} |