Sebastian Godelet fcac049952 Fix uint64.to_int/2 and uint32.to_int/2 on LLP64 platforms.
The C foreign_proc bodies for uint64.to_int/2 and uint32.to_int/2 use
(1UL << 63) and (1UL << 31) to build a mask of representable Mercury
int values. On LLP64 platforms (notably 64-bit Windows with both
MinGW-w64 GCC and MSVC), unsigned long is 32 bits, so 1UL << 63 has
undefined behaviour: GCC's -Wshift-count-overflow rejects it under
-Werror, breaking the build, while clang silently folds the result to
zero, which makes mask_for_int wrap to ~0, so to_int and det_to_int
report success and truncate for every uint64 value, including ones
that do not fit in a Mercury int. The same reasoning applies to the
32-bit-word branch and to the corresponding code in uint32.m.

library/uint64.m:
    Replace (1UL << 63) with (UINT64_C(1) << 63) in the
    MR_BYTES_PER_WORD == 8 branch of to_int/2 so the literal is at
    least 64 bits on every platform. Replace (1UL << 31) with
    (UINT32_C(1) << 31) in the 32-bit-word branch for consistency.

library/uint32.m:
    Replace (1UL << 31) with (UINT32_C(1) << 31) in the
    MR_BYTES_PER_WORD != 8 branch of to_int/2.
2026-04-27 21:50:47 +10:00
2026-04-11 00:29:44 +10:00
2026-04-13 08:56:20 +10:00
2026-04-02 23:22:02 +11:00
2026-03-31 10:17:27 +11:00
2026-04-26 14:45:01 +10:00

Mercury

Mercury is a logic/functional programming language which combines the clarity and the expressiveness of declarative programming with advanced static analysis and error detection features.

More information is available on the website's about pages, in other README files in the source code repository, and in the documentation.

Small sample programs written in Mercury can be found in the samples and extras directories of the source code repository.

README files

The Mercury compiler has two different backends and works on different operating systems. Specific information is contained in individual README files in the Documentation directory:

Other information

See the current release notes for the latest stable release. The news file lists any recent changes. The files in the Documentation directory whose names start with NEWS are relevant if you want to find out more about the past development of Mercury. The limitations file lists some ways in which the Mercury implementation does not yet meet its goals.

Information for developers

If you are considering contributing to the Mercury project, the website contains some documents that may be helpful. These include a document about contributions in general and specific information about contributing such as coding styles.

Contact

See our contact page.

Description
No description provided
Readme MIT 146 MiB
Languages
Mercury 85.4%
C 8.7%
Shell 1.4%
Makefile 1%
JavaScript 1%
Other 2%