Skip to content

WARNING with gcc ASAN #26

@xiaocj

Description

@xiaocj

I created a test sample and ran it with GCC Address Sanitizer. It reported a warning upon exit. Could you please take a look? Thank you!

test.c

#define MINICORO_IMPL
#include "minicoro.h"
#include <stdio.h>

// Coroutine entry function.
void coro_entry(mco_coro* co) {
  printf("coroutine 1\n");
  mco_yield(co);
  printf("coroutine 2\n");
}

int main() {
  mco_coro* co;
  mco_desc desc = mco_desc_init(coro_entry, 0);
  mco_result res = mco_create(&co, &desc);

  res = mco_resume(co); // Should print "coroutine 1".

  res = mco_destroy(co);
  exit(0);
}

Build and run:

# gcc -fsanitize=address -fno-sanitize-recover=all -fno-omit-frame-pointer test.c
# ./a.out 
coroutine 1
==3017550==WARNING: ASan is ignoring requested __asan_handle_no_return: stack type: default top: 0x53000000e910; bottom 0x7ffc9c9f7000; size: 0xffffd30363617910 (-49463471015664)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189

If I change the last line of the code in main function from "exit(0)" to "return 0", everything works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions