Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THIS in doc comment substituted with incorrect name #1174

Open
rmn30 opened this issue Mar 18, 2025 · 0 comments
Open

THIS in doc comment substituted with incorrect name #1174

rmn30 opened this issue Mar 18, 2025 · 0 comments

Comments

@rmn30
Copy link
Contributor

rmn30 commented Mar 18, 2025

I updated to the recent Sail release and was pleased that doc comments in latex output are working again, but noticed a minor issue which is new. Sometimes THIS in a doc comment is substituted with an incorrect name. For example the CHERIoT sail contains:

function getCapLength(c) : Capability -> CapLen =
    let ('base, 'top) = getCapBounds(c) in {
        /* For valid capabilties we expect top >= base and hence
         * length >= 0 but representation does allow top < base in some
         * cases so might encounter on untagged capabilities. Here we just
         * pretend it is a 65-bit quantitiy and wrap.
         */
        assert (not(c.tag) | top >= base);
        (top - base) % pow2(cap_len_width)
    }

/*!
 * THIS(cap, addr, len) checks whether the capability cap includes the region
 * specified by addr and len. Specifically it checks whether
 * cap.base $\le$ addr AND addr + len $\le$ cap.top. Note that this definition
 * returns true if len is zero and addr $=$ cap.top.
 */
val inCapBounds  : (Capability, CapAddrBits, CapLen) -> bool
function inCapBounds (cap, addr, size) = ...

but in the generated latex THIS is substituted with getCapLength instead of inCapBounds! The bug is present in releases 0.18 and 0.19. Doc comments were not emitted at all in 0.17.x but this is now fixed, thanks!

@rmn30 rmn30 changed the title THIS is doc comment substituted with incorrect name THIS in doc comment substituted with incorrect name Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant