1/1

|
Bug in or1ksim "generate" program
by Unknown on Oct 14, 2004 |
Not available! | ||
|
There appears to be a bug in the "generate" program in the
or1ksim build environment. The array "op" is defined as having 4 entries, but there can be up to 5 operands, and when the 5th entry is written into op[4] that overwrites the address of the "ti" array. This causes a crash on Solaris. Seems to work under Linux (Fedora FC2 at least) perhaps due to alignment restrictions? The following patch fixes this. Perhaps would have been better to fix MAX_OPERANDS in the header, but I'm not sure if there'd be further consequences to that. Not sure that this is the best place to post this, if there's a better place then please advise. Adrian Index: or1ksim/cpu/or32/generate.c =================================================================== --- or1ksim/cpu/or32/generate.c (revision 53) +++ or1ksim/cpu/or32/generate.c (working copy) @@ -41,7 +41,8 @@ } *ti; static char *in_file; -unsigned long op[MAX_OPERANDS]; +//unsigned long op[MAX_OPERANDS]; MAX_OPERANDS is 4, but we have up to 5 +unsigned long op[5]; int num_op; inline void debug(int level, const char *format, ...) |
|||
|
Bug in or1ksim "generate" program
by Unknown on Oct 14, 2004 |
Not available! | ||
|
Thanks
Matjaz can you take a look, make sure this gets into the cvs. Thanks
regards,
Damjan
----- Original Message -----
From: "Adrian Wise" adrian@adrianwise.co.uk>
To: openrisc@opencores.org>
Sent: Thursday, October 14, 2004 1:40 AM
Subject: [openrisc] Bug in or1ksim "generate" program
There appears to be a bug in the "generate" program in the
or1ksim build environment.
The array "op" is defined as having 4 entries, but there can
be up to 5 operands, and when the 5th entry is written into
op[4] that overwrites the address of the "ti" array.
This causes a crash on Solaris. Seems to work under Linux
(Fedora FC2 at least) perhaps due to alignment restrictions?
The following patch fixes this. Perhaps would have been
better to fix MAX_OPERANDS in the header, but I'm not sure if
there'd be further consequences to that.
Not sure that this is the best place to post this, if there's a
better place then please advise.
Adrian
Index: or1ksim/cpu/or32/generate.c
===================================================================
--- or1ksim/cpu/or32/generate.c (revision 53)
+++ or1ksim/cpu/or32/generate.c (working copy)
@@ -41,7 +41,8 @@
} *ti;
static char *in_file;
-unsigned long op[MAX_OPERANDS];
+//unsigned long op[MAX_OPERANDS]; MAX_OPERANDS is 4, but we have up to 5
+unsigned long op[5];
int num_op;
inline void debug(int level, const char *format, ...)
_______________________________________________
http://www.opencores.org/mailman/listinfo/openrisc
|
|||
1/1

