Bruno Haible <br...@clisp.org> writes:

> Yep, this patch would fix the compilation error, but would still have
> undefined behaviour (and the clang UBSAN actually crashes upon function
> pointer type conversion).
>
> I'm committing this patch instead. It's a little more ugly, but no undefined
> behaviour. Tested on both AIX 7.1 and AIX 7.3.

AFAIK AIX doesn't have UBSAN or ASAN support. It seems like recent XLC
versions do [1], but I always use GCC. And on cfarm119 you will get:

    $ gcc -fsanitize=address main.c 
    cc1: warning: '-fsanitize=address' not supported for this target
    collect2: fatal error: library libasan not found
    compilation terminated.
    $ gcc -fsanitize=undefined main.c 
    collect2: fatal error: library libubsan not found
    compilation terminated.

Regardless, I agree it is best to avoid messing with function casts
where possible. Your patch works better, thanks.

Collin

[1] 
https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.2?topic=options-fsanitize

Reply via email to