strtol bug?

Does anyone know anything about a bug in strtol? I was passing in a string with a time_t value and nothing else, looking something like this: “1190066927”. I was actually calling atol, but this just calls strtol under the hood.

Basically the first time I called it would timeout the debug cable connection. The second time (I can tell from an output immediately preceding) it would halt the program completely.

I’m also sure the problem is here because I commented out the atol and replaced it with a numeric constant in the same range (i.e. that would be a reasonable value), and the application worked fine. I also verified the parameter value going into the function.

Finally, the app worked fine when I wrote my own convert function. But I’d rather use the standard lib function since it’s likely faster (mine is in C, not assembler).

Thoughts? The atol call is working fine on smaller values (that evaluate to less than 16 bits, i.e. two msb’s zero) elsewhere in the program.

The compiler version is 9.21, and the target device is 3700.

Eric Ruck