On Sat, 15 Jan 2005, Sam Ravnborg wrote:
> 
> When playing with spare I noticed that again it emitted
> 
> kernel/audit.c:172:9: warning: unreplaced symbol '<noident>'
> 
> A few days ago I reported this as fixed - but apparently I did something
> wrong.
> 
> The following snippet provokes the same warning:
> 
> static inline int fun(void)
> {
>         static int x = (int) {1};
> }

Ahhh...

Indeed. The inliner knows that static (or extern) symbols should not be 
replaced, but it does _not_ know that static _initializers_ end up being 
static too.

So what we have is an anonymous node for the initializer, and sparse
hasn't marked it static, so when inlining it we try to replace it, but we
don't have any replacement for it.

This should fix it.. (Only duplicate the initializer if the symbol itself
has been duplicated)

                Linus

----
===== linearize.c 1.49 vs edited =====
--- 1.49/linearize.c    2004-08-20 11:43:58 -07:00
+++ edited/linearize.c  2004-09-04 17:52:44 -07:00
@@ -1114,7 +1114,7 @@
        }
 }
 
-void pack_basic_blocks(struct basic_block_list **bblist)
+void pack_basic_blocks(struct basic_block *entry, struct basic_block_list 
**bblist)
 {
        struct basic_block *bb;
        struct list_iterator iterator;
@@ -1129,7 +1129,8 @@
 
                if (!is_branch_goto(jmp=last_instruction(bb->insns)))
                        continue;
-
+               if (bb == entry)
+                       continue;
                target = jmp->bb_true ? jmp->bb_true : jmp->bb_false;
                if (target == bb)
                        continue;
@@ -1189,7 +1190,7 @@
                                insn->src = result;
                                add_one_insn(ep, pos, insn);
                        }
-                       pack_basic_blocks(&ep->bbs);
+                       pack_basic_blocks(bb, &ep->bbs);
                        ret_ep = ep;
                }
        }
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to