jantje / hardware

Arduino eclipse plugin hardware support folders
6 stars 24 forks source link

String((unsigned int)1) crashes with pc/1.0.2 #15

Closed jml3on closed 6 years ago

jml3on commented 6 years ago

Using the following code under a blink project in local debug mode.

void setup() {}

void loop() {
  String t((unsigned int)1);
}

That program crashes when run in local mode. It works fine when removing the unsigned qualifier.

Under debugger, it appears that calling from String(unsigned int)

char *utoa (unsigned char __val, char *__s, unsigned char __radix)
{
    return utoa ((unsigned int) __val, __s, (int) __radix);
}

loops for ever.

This is because utoa is not defined in stdlib.h, like itoa` is:

_CRTIMP __cdecl __MINGW_NOTHROW  char* itoa (int, char*, int);

not sure what a proper fix is, as I'm not sure if this is a mingw or jantje issue.

jantje commented 6 years ago

not sure what a proper fix is, as I'm not sure if this is a mingw or jantje issue.

I don't know and I wont have time to look at it before half september.

jml3on commented 6 years ago

this older issue seems relevant: https://github.com/esp8266/Arduino/issues/110

It is indeed the case that ArduinoIDE has a modified stdlib under C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include that contains utoa.

So it's not a mingw issue, it should either be fixed in jantje or sloeber.