Skip to content

Alignment issue detected by Fil-C #289

@wmww

Description

@wmww

When running under Fil-C I'm getting

filc safety error: alignment requirement of 8 bytes not met.
    pointer: 0x7f65e3da5444,0x7f65e3da53e0,0x7f65e3da58e0,aux=0x7f65e3da5a20
    expected 17 writable bytes with ptr aligned to 8 bytes.
semantic origin:
    ../thirdparty/md4c/src/md4c.c:2648:5: md_mark_store_ptr (inlined)
    ../thirdparty/md4c/src/md4c.c:3623:13: md_resolve_links (inlined)
    ../thirdparty/md4c/src/md4c.c:4122:5: md_analyze_inlines
semantic origin:
    ../thirdparty/md4c/src/md4c.c:3622:13: md_resolve_links (inlined)
    ../thirdparty/md4c/src/md4c.c:4122:5: md_analyze_inlines
check scheduled at:
    ../thirdparty/md4c/src/md4c.c:3622:13: md_resolve_links (inlined)
    ../thirdparty/md4c/src/md4c.c:4122:5: md_analyze_inlines
    ../thirdparty/md4c/src/md4c.c:4699:5: md_process_normal_block_contents
    ../thirdparty/md4c/src/md4c.c:4878:13: md_process_leaf_block (inlined)
    ../thirdparty/md4c/src/md4c.c:4960:13: md_process_all_blocks (inlined)
    ../thirdparty/md4c/src/md4c.c:6414:5: md_process_doc (inlined)
    ../thirdparty/md4c/src/md4c.c:6483:11: md_parse
    ../src/markdown.c:580:9: convert_markdown_to_html
    ../src/blogpost.c:31:16: blogpost_html_into (inlined)
    ../src/blogpost.c:80:5: blogpost_new
    ../src/config.c:131:33: handle_blogpost
    ../src/filesystem_helpers.c:74:13: for_each_item_in_dir
    ../src/config.c:88:17: handle_config_directory_list
    ../src/config.c:177:5: config_load
    ../src/main.c:10:22: main
    src/env/__libc_start_main.c:79:7: __libc_start_main
    <runtime>: start_program

This seems to be due to

/* Sometimes, we need to store a pointer into the mark. It is quite rare
 * so we do not bother to make MD_MARK use union, and it can only happen
 * for dummy marks. */
static inline void
md_mark_store_ptr(MD_CTX* ctx, int mark_index, void* ptr)
{
    MD_MARK* mark = &ctx->marks[mark_index];
    MD_ASSERT(mark->ch == 'D');

    /* Check only members beg and end are misused for this. */
    MD_ASSERT(sizeof(void*) <= 2 * sizeof(OFF));
    memcpy(mark, &ptr, sizeof(void*));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions