aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-10-02 17:01:22 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-10-02 17:01:22 +0200
commite1b243a800307b7a731b5b3cf69a2d784498923b (patch)
treec18228efb40a0e59c5eb72d9e3b4378820263cdd /gcc/cfgexpand.c
parentb1d42460aef1a4c02d7c35301c2c4e81d5ed3419 (diff)
downloadgcc-e1b243a800307b7a731b5b3cf69a2d784498923b.zip
gcc-e1b243a800307b7a731b5b3cf69a2d784498923b.tar.gz
gcc-e1b243a800307b7a731b5b3cf69a2d784498923b.tar.bz2
re PR bootstrap/41404 (expr.c undefined reference while linking jc1)
PR debug/41404 PR debug/41353 * cfgexpand.c (expand_debug_expr) <case STRING_CST>: Don't create CONST_STRING if STRING_CST contains embedded '\0's or doesn't end with '\0'. (expand_debug_expr) <case VAR_DECL>: For TREE_STATIC !DECL_EXTERNAL vars use DECL_RTL with resetting it back to NULL afterwards. * dwarf2out.c (same_dw_val_p): For dw_val_class_addr compare with rtx_equal_p instead of asserting it is a SYMBOL_REF. (value_format): For dw_val_class_addr only use DW_FORM_addr if the attribute type allows it, otherwise use DW_FORM_dataN. (mem_loc_descriptor): Handle CONST_STRING. (add_const_value_attribute): Handle CONST_STRING using add_AT_addr. Handle MEM with CONST_STRING address using add_AT_string. (rtl_for_decl_init): Return MEM with CONST_STRING address instead of CONST_STRING for const arrays initialized with a string literal. (resolve_one_addr, resolve_addr_in_expr, resolve_addr): New functions. (dwarf2out_finish): Call resolve_addr. * gcc.dg/guality/pr41404-1.c: New test. * gcc.dg/guality/pr41353-2.c: New test. From-SVN: r152403
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index f4a9f5e..2117ee3 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -2337,6 +2337,9 @@ expand_debug_expr (tree exp)
case STRING_CST:
if (!lookup_constant_def (exp))
{
+ if (strlen (TREE_STRING_POINTER (exp)) + 1
+ != (size_t) TREE_STRING_LENGTH (exp))
+ return NULL_RTX;
op0 = gen_rtx_CONST_STRING (Pmode, TREE_STRING_POINTER (exp));
op0 = gen_rtx_MEM (BLKmode, op0);
set_mem_attributes (op0, exp, 0);
@@ -2368,9 +2371,23 @@ expand_debug_expr (tree exp)
/* This decl was probably optimized away. */
if (!op0)
- return NULL;
-
- op0 = copy_rtx (op0);
+ {
+ if (TREE_CODE (exp) != VAR_DECL
+ || DECL_EXTERNAL (exp)
+ || !TREE_STATIC (exp)
+ || !DECL_NAME (exp)
+ || DECL_HARD_REGISTER (exp))
+ return NULL;
+
+ op0 = DECL_RTL (exp);
+ SET_DECL_RTL (exp, NULL);
+ if (!MEM_P (op0)
+ || GET_CODE (XEXP (op0, 0)) != SYMBOL_REF
+ || SYMBOL_REF_DECL (XEXP (op0, 0)) != exp)
+ return NULL;
+ }
+ else
+ op0 = copy_rtx (op0);
if (GET_MODE (op0) == BLKmode)
{