Mercury-Language/mercury

Memset expects `void *` but is passed MR_Word instead when compiling with `--enable-hlc-prof-grades`

Closed this issue · 3 comments

While compiling mercury-rotd 2019-08-19 the C compiler throws from memset being passed the wrong type at compilation only when using --enable-hlc-prof-grades. Included is the build log (the faliure message itself as I didn't catch all) and the guix build script for the package. To reproduce the exact build environment guix may be used with the following channel:

      (channel
        (name 'guix)
        (url "https://git.savannah.gnu.org/git/guix.git")
        (commit "c42db89ff992037841e7937059db952571af86fa"))

mercury.txt
log.txt

wangp commented

Fixed in 3c6d90f, thanks.
Note this only affects non-gc (Boehm GC) grades, which are generally not useful.

Peter, your change may have avoided a gcc abort, but I think it introduced a bug,
since new_data_ptr is NOT a pointer to the new heap cell; it is a pointer to the pointer
to the heap cell.

I am pretty sure the right fix would be to cast new_data to (void *) in the call to MR_memset.

wangp commented

You are right. I have tested it properly now.