Any help with this? Why does sdcc crash when an array index is type int
and work ok wiith char?
Seems like this is an sdcc issue. Has it been fixed?
a*
Anthony Asterisk wrote:
> I am unclear if this is a compiler issue or a coding problem. The
> error message is not informative....
>
> sdcc: SDCCopt.c:707: convilong: Assertion `0' failed.
> Caught signal 6: SIGABRT
> make: *** [obj_brione/timetable.o] Error 1
>
> Here is the version of sdcc I'm using, although this problem has shown
> up in multiple releases...
>
> sdcc -v
> SDCC : mcs51 2.9.7 #5718 (Feb 26 2010) (UNIX)
>
>
> The relevant code is:
>
> struct timetable {
> struct timetable_timestamp *timestamps;
> const int size;
> unsigned int * const ptr;
> };
>
> rtimer_clock_t
> timetable_timediff(struct timetable *t,
> const char *id1, const char *id2)
> {
> int i;
> int t1, t2;
>
> t1 = t2 = t->size;
>
> for(i = *t->ptr - 1; i >= 0; --i) {
> if(t->timestamps[i].id == id1) {
> t1 = i;
> break;
> }
> }
>
> for(i = i - 1; i >= 0; --i) {
> if(t->timestamps[i].id == id2) {
> t2 = i;
> break;
> }
> }
> if(t1 != t->size && t2 != t->size) {
> return t->timestamps[t1].time - t->timestamps[t2].time;
> }
>
> return 0;
> }
>
>
>
> Problem can be resolved by changing int i; to char type.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user