Re: O3 versus O2 weirdness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Eljay and thanks for the answer.


  char komb[13];

The buffer isn't large enough to hold the output, so the output
overflows
and (probably) overwrites something important.


That buffer you pointed at was not the culprit of the problem (I increased
it to 64 and the program still had erratic behaviour), but it pointed me
into a right direction.

The problem was atoi function call:

..
 char c;
..
l=atoi(&c);
..

when I changed it to:

..
 char c[2]="";
..
 c[0]=konfig[i];
 l=atoi(c);
..

It seems to work fine.

I know it is my programming error (atoi manpage states it takes a string as input), but isnt there really a way of detecting such ?

This was particularly easy sample but chasing such bugs in a big code
can be a really painful task...

Thanks,
B


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux