Skip to content

Rebooting issue with variadic arguments, zero-pointer execution #5236

Closed
@tekka007

Description

@tekka007

AVR crashes / reboots with this sketch, asm hints to a zero-pointer call.

// 20160812 tekka
// rebooting issue due to zero-pointer execution

// (un)comment
#define issue

void before(void) __attribute__((weak));

void va_pseudo(uint8_t flag, ...) {
    va_list args;
    va_start(args, flag);
    va_end(args);
}

int main(void) {
    Serial.begin(115200);
  Serial.println("start");
  Serial.flush();


#if defined(issue)
    va_pseudo(1, 2, 3, 4);
#else
    va_pseudo(1, 2, 3);
#endif

    if (before) {
    Serial.println("This should not execute");
    Serial.flush();
        before();
    }

    Serial.println("end");
  Serial.flush();

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions