This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14516] [3.4/3.5 regression] -fleading-underscore does not work correctly for file static variables
- From: "ian at wasabisystems dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jun 2004 01:43:30 -0000
- Subject: [Bug c/14516] [3.4/3.5 regression] -fleading-underscore does not work correctly for file static variables
- References: <20040310192451.14516.ian@wasabisystems.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ian at wasabisystems dot com 2004-06-13 01:43 -------
This patch fixes the reported problem. It doesn't fix the problem which Geoff
mentions.
I haven't really tested this patch, and I don't know whether it is completely
correct. I also don't know whose code this is.
--- langhooks.c 14 May 2004 02:29:20 -0000 1.63
+++ langhooks.c 13 Jun 2004 01:42:32 -0000
@@ -35,6 +35,7 @@ Boston, MA 02111-1307, USA. */
#include "langhooks-def.h"
#include "ggc.h"
#include "diagnostic.h"
+#include "output.h"
/* Do nothing; in many cases the default hook. */
@@ -188,8 +189,15 @@ lhd_set_decl_assembler_name (tree decl)
if (!TREE_PUBLIC (decl) && DECL_CONTEXT (decl))
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
+ char *a;
char *label;
-
+
+ if (user_label_prefix[0] != '\0')
+ {
+ a = alloca (strlen (user_label_prefix) + strlen (name) + 1);
+ sprintf (a, "%s%s", user_label_prefix, name);
+ name = a;
+ }
ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
var_labelno++;
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (label));
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14516