On Saturday, December 24, 2022 12:26:30 AM PST AMADOR BARRAGAN AGUILERA wrote:
> AFAICT I'm not building from source, just installing the software, which
> happens to require compiling some C sources. I tried building 11.2 on a
> fresh Fedora 37 and gcc 12.1.2 install and the build failed. The errors
> from the output are in the 11.2 attached file.
> 
> I noticed that 12.0.9 allegedly supports compiling in newer toolchains but
> the build failed again and the errors I got are in the 12.0.9 file.
> 
> I'm new to building software and submitting bugs and hopefully this is the
> right place to ask: should I submit this via Savannah?
> 

Please try the attached patch.

The “newer toolchains” referred to are from Ubuntu 22.04, which uses gcc 11 by 
default.  I haven’t tried gcc 12.
diff --git a/src/microcode/regex.c b/src/microcode/regex.c
index d2c46adf0..b9832eb48 100644
--- a/src/microcode/regex.c
+++ b/src/microcode/regex.c
@@ -138,21 +138,18 @@ USA.
 {									\
   if (stack_pointer == stack_end)					\
     {									\
-      long stack_length;						\
-      unsigned char **stack_temporary;					\
-									\
-      stack_length = ((stack_end - stack_start) * 2);			\
+      unsigned long stack_length = ((stack_end - stack_start) * 2);	\
       if (stack_length > (re_max_failures * 2))				\
 	RE_RETURN (-4);							\
-      stack_temporary =							\
+      unsigned long stack_used = (stack_pointer - stack_start);		\
+      unsigned char ** stack_temporary =				\
 	((unsigned char **)						\
 	 (realloc							\
 	  (stack_start, (stack_length * (sizeof (unsigned char *))))));	\
       if (stack_temporary == NULL)					\
 	RE_RETURN (-3);							\
       stack_end = (& (stack_temporary [stack_length]));			\
-      stack_pointer =							\
-	(& (stack_temporary [(stack_pointer - stack_start)]));		\
+      stack_pointer = (& (stack_temporary [stack_used]));		\
       stack_start = stack_temporary;					\
     }									\
   (*stack_pointer++) = (pattern_pc);					\

Reply via email to