The current issue occured on gcc version 8.5.0, can not been
seen in the latest gcc version.
 $ make -j8 lzo
  symbols.c: In function ‘namespace_ctl’:
  symbols.c:3358:3: error: a label can only be part of a statement and a declaration is
not a statement
     char demangled[BUFSIZE] = {0};
     ^~~~
  make[5]: *** [Makefile:403: symbols.o] Error 1
  make[5]: *** Waiting for unfinished jobs....
  ...
  crash build failed
  ...
Let's put the declaration at the beginning of this function to
fix such cases.
Reported-by: Tao Liu <ltao(a)redhat.com>
Signed-off-by: Lianbo Jiang <lijiang(a)redhat.com>
---
 symbols.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/symbols.c b/symbols.c
index f9eb51f6cd63..112bcc630bf2 100644
--- a/symbols.c
+++ b/symbols.c
@@ -3325,6 +3325,7 @@ namespace_ctl(int cmd, struct symbol_namespace *ns, void *nsarg1,
void *nsarg2)
 	char *name;
 	long cnt;
 	int len;
+	char demangled[BUFSIZE] = {0};
 
 	switch (cmd)
 	{
@@ -3355,7 +3356,6 @@ namespace_ctl(int cmd, struct symbol_namespace *ns, void *nsarg1,
void *nsarg2)
 		return TRUE;
 
 	case NAMESPACE_INSTALL:
-		char demangled[BUFSIZE] = {0};
 		sp = (struct syment *)nsarg1;
 		name = (char *)nsarg2;
 		len = strlen(name)+1;
-- 
2.50.1
    
    
    
 
                    
                    
                        
                        Show replies by date