Re: [hatari-devel] Current compile warning

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On lauantai 10 maaliskuu 2012, Laurent Sallafranque wrote:
> For your info, I send you the warning I get while compiling hatari :
> 
> [ 28%] Building C object src/debug/CMakeFiles/Debug.dir/68kDisass.c.o
> /home/laurent/Atari/hatari/src/debug/68kDisass.c: In function
> ‘Disass68k_loop’:
> /home/laurent/Atari/hatari/src/debug/68kDisass.c:2374:15: attention :
> array subscript is above array bounds [-Warray-bounds]

You asked about that already in 2011-05-22.  :-)

According to comment in code on that line it's supposed to be harmless
and looking at the code I don't see how it could get out of bounds.

I don't get the warning, but does the attached patch change anything?



	- Eero
diff -r e4412685ff0c src/debug/68kDisass.c
--- a/src/debug/68kDisass.c	Fri Mar 09 18:48:37 2012 +0100
+++ b/src/debug/68kDisass.c	Sat Mar 10 20:54:35 2012 +0200
@@ -32,12 +32,12 @@
 static Diss68kOptions	options = doptOpcodesSmall | doptRegisterSmall | doptStackSP | doptNoBrackets;
 
 // values <0 will hide the group
-static int				optionPosAddress = 0;	// current address
-static int				optionPosHexdump = 10;	// 16-bit words at this address
-static int				optionPosLabel = 35;	// label, if defined
-static int				optionPosOpcode = 47;	// opcode
-static int				optionPosOperand = 57;	// operands for the opcode
-static int				optionPosComment = 82;	// comment, if defined
+static const int			optionPosAddress = 0;	// current address
+static const int			optionPosHexdump = 10;	// 16-bit words at this address
+static const int			optionPosLabel = 35;	// label, if defined
+static const int			optionPosOpcode = 47;	// opcode
+static const int			optionPosOperand = 57;	// operands for the opcode
+static const int			optionPosComment = 82;	// comment, if defined
 
 /***
  *	Motorola 16-/32-Bit Microprocessor and coprocessor types


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/