public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [rs6000] Fix thinko in output_profile_hook
@ 2011-03-24 14:57 Eric Botcazou
  2011-05-08 12:51 ` Eric Botcazou
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2011-03-24 14:57 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1010 bytes --]

Hi,

the problematic line is:

label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf));

On AIX, rs6000_xcoff_strip_name_encoding can return NAME + 1:

static const char *
rs6000_xcoff_strip_name_encoding (const char *name)
{
  size_t len;
  if (*name == '*')
    name++;
  len = strlen (name);
  if (name[len - 1] == ']')
    return ggc_alloc_string (name, len - 4);
  else
    return name;
}

which means that you can have (ADDR + 1) in some GC tree and gt_ggc_m_S choke:

  if (offset)
    {
      /* Here we've seen a char* which does not point to the beginning
	 of an allocated object.  We assume it points to the middle of
	 a STRING_CST.  */
      gcc_assert (offset == offsetof (struct tree_string, str));
      p = ((const char *) p) - offset;
      gt_ggc_mx_lang_tree_node (CONST_CAST (void *, p));
      return;
    }

Tested on AIX, OK for the mainline?


2011-03-24  Eric Botcazou  <ebotcazou@adacore.com>

	* config/rs6000/rs6000.c (output_profile_hook): Fix thinko.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 564 bytes --]

Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 171345)
+++ config/rs6000/rs6000.c	(working copy)
@@ -23002,7 +23002,7 @@ output_profile_hook (int labelno ATTRIBU
 	  rtx fun;
 
 	  ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno);
-	  label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf));
+	  label_name = ggc_strdup ((*targetm.strip_name_encoding) (buf));
 	  fun = gen_rtx_SYMBOL_REF (Pmode, label_name);
 
 	  emit_library_call (init_one_libfunc (RS6000_MCOUNT),

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [rs6000] Fix thinko in output_profile_hook
  2011-03-24 14:57 [rs6000] Fix thinko in output_profile_hook Eric Botcazou
@ 2011-05-08 12:51 ` Eric Botcazou
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2011-05-08 12:51 UTC (permalink / raw)
  To: gcc-patches

> 2011-03-24  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * config/rs6000/rs6000.c (output_profile_hook): Fix thinko.

Applied as obvious.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-08  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-24 14:57 [rs6000] Fix thinko in output_profile_hook Eric Botcazou
2011-05-08 12:51 ` Eric Botcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).