This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

multi-arched alpha won't build with OSF1 4.0d's cc


OSF1 4.0d's cc complains when a non-constant value is used as the
array size of a formal parameter.  The first patch below fixes the
problem without removing the documentation value of the array size at
that point.  I wonder if just commenting out the (variable) array size
would be a better choice.

It also rightfully refuses to compile functions containing automatic
arrays of non-constant sizes.  The second patch below fixes this
problem.

With these two patches, GDB mainline builds on this platform again,
using this picky/dumb compiler.

Ok to install?

Index: gdb/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* alpha-tdep.c (alpha_extract_return_value): Don't use
	non-constant array size in prototype.

Index: gdb/alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.32
diff -u -p -r1.32 alpha-tdep.c
--- gdb/alpha-tdep.c 26 Apr 2002 07:05:34 -0000 1.32
+++ gdb/alpha-tdep.c 5 May 2002 15:56:51 -0000
@@ -1530,7 +1530,7 @@ alpha_breakpoint_from_pc (CORE_ADDR *pcp
 
 static void
 alpha_extract_return_value (struct type *valtype,
-			    char regbuf[REGISTER_BYTES], char *valbuf)
+			    char regbuf[ALPHA_REGISTER_BYTES], char *valbuf)
 {
   if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
     alpha_register_convert_to_virtual (FP0_REGNUM, valtype,
Index: gdb/gdbtk/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* generic/gdbtk-register.c (get_register, register_changed_p):
	Don't depend on variable-sized automatic arrays.

Index: gdb/gdbtk/generic/gdbtk-register.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-register.c,v
retrieving revision 1.8
diff -u -p -r1.8 gdbtk-register.c
--- gdb/gdbtk/generic/gdbtk-register.c 12 Apr 2002 18:18:58 -0000 1.8
+++ gdb/gdbtk/generic/gdbtk-register.c 5 May 2002 15:57:35 -0000
@@ -204,8 +204,8 @@ static void
 get_register (int regnum, void *fp)
 {
   struct type *reg_vtype;
-  char raw_buffer[MAX_REGISTER_RAW_SIZE];
-  char virtual_buffer[MAX_REGISTER_VIRTUAL_SIZE];
+  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
+  char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
   int format = (int) fp;
   int optim;
 
@@ -348,7 +348,7 @@ map_arg_registers (int objc, Tcl_Obj *CO
 static void
 register_changed_p (int regnum, void *argp)
 {
-  char raw_buffer[MAX_REGISTER_RAW_SIZE];
+  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
 
   if (!frame_register_read (selected_frame, regnum, raw_buffer))
     return;

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]