ridiculousfish / libdivide

Official git repository for libdivide: optimized integer division
http://libdivide.com
Other
1.09k stars 77 forks source link

Libdivide is using exit instead of abort on errors. #64

Closed alexey-milovidov closed 4 years ago

alexey-milovidov commented 4 years ago
#define LIBDIVIDE_ERROR(msg) \
    do { \
        fprintf(stderr, "libdivide.h:%d: %s(): Error: %s\n", \
            __LINE__, LIBDIVIDE_FUNCTION, msg); \
        exit(-1); \
    } while (0)

The usage of exit is wrong for two reasons:

  1. It does not quickly terminate the program because it calls global destructors (in contrast to _exit).
  2. Core won't be dumped.

The issue has been found here: https://github.com/ClickHouse/ClickHouse/issues/12119

ridiculousfish commented 4 years ago

Yeah well found, it should be fixed! If you make a PR I will merge it!

alexey-milovidov commented 4 years ago

Ok https://github.com/ridiculousfish/libdivide/pull/65 Thank you!

ridiculousfish commented 4 years ago

Thank you! Closed in #65