Skip to content

Segfault on FPC when FPC_REQUIRES_PROPER_ALIGNMENT is enabled #251

@foxpas

Description

@foxpas

Thanks for the great library.

I just wanted to point out an issue on platforms for which FPC defines FPC_REQUIRES_PROPER_ALIGNMENT. In my case I am using TRegExpr on macOS with FPC.

When compiling for macOS x86_64 FPC_REQUIRES_PROPER_ALIGNMENT is not defined and TRegExpr works fine.

When compiling for macOS aarch64 FPC_REQUIRES_PROPER_ALIGNMENT is defined, which makes TRegExpr use pointer alignment. The following code causes a segfault:

X := TRegExpr.Create('^([0-9A-F]{2}[:-]?){5}([0-9A-F]{2})$');
X.Exec('aabbccddeeff')

I can work around this by undefining FPC_REQUIRES_PROPER_ALIGNMENT, so TRegExpr will not align pointers for aarch64. It works, but to the best of my knowledge when FPC_REQUIRES_PROPER_ALIGNMENT is defined, pointers should be aligned.

Therefore, there seems to be a bug in TRegExpr on platforms that require aligned pointers.

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