This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix local static vars with asm() after lazy DECL_RTL changes
- To: mark at codesourcery dot com
- Subject: [PATCH] Fix local static vars with asm() after lazy DECL_RTL changes
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 20 Mar 2001 17:03:56 +0100
- Cc: gcc-patches at gcc dot gnu dot org
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
Lazy DECL_RTL changes cause the snippet below
int foo(void)
{
static int i asm ("foobar") = 4;
}
to use foobar.0 for the static variable's name unlike the previously used
foobar.
IMHO as soon as DECL_ASSEMBLER_NAME is different from DECL_NAME
make_decl_rtl has no businness in modifying the assembler name and it should
be sole responsibility of the routine which set DECL_ASSEMBLER_NAME.
Note that this patch either requires the static local discriminator for
VAR_DECLs patch I've sent today, or C++ not to use mangle_decl
unconditionally for set_decl_assembler_name (ie. don't mangle if
make_decl_rtl would be appending .<number>).
Bootstrapped on i386-redhat-linux together with the DECL_DISCRIMINATOR
patch, no regressions.
2001-03-20 Jakub Jelinek <jakub@redhat.com>
* varasm.c (make_decl_rtl): Don't append var_labelno discriminator
to variable names where DECL_NAME is different from
DECL_ASSEMBLER_NAME.
--- gcc/varasm.c.jj Tue Mar 20 13:44:48 2001
+++ gcc/varasm.c Tue Mar 20 15:05:31 2001
@@ -714,7 +714,8 @@ make_decl_rtl (decl, asmspec)
Concatenate a distinguishing number. */
if (!top_level && !TREE_PUBLIC (decl)
&& ! (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)))
- && asmspec == 0)
+ && asmspec == 0
+ && name == IDENTIFIER_POINTER (DECL_NAME (decl)))
{
char *label;
ASM_FORMAT_PRIVATE_NAME (label, name, var_labelno);
Jakub