Skip to content

Using strncpy in full newlibc missbehave on ARC platform. #879

Open
@fgihl

Description

@fgihl

strncpy on ARC platform
When building c++ application for ARC em platform and using full newlibc (CONFIG_REQUIRES_FULL_LIBCPP=y, CONFIG_NEWLIB_LIBC=y). strncpy don't copy some string length correctly. It copies to little characters.

arc_em : strncpy copies string with len 23-30 incorrect.
arc_hs : strncpy copies string with len 23-39 incorrect.

The error only show up when using the full version of newlibc. Tested on sdk version 0.16.5-1 & 0.17.0

Repo
I created a small c++ sample to show the error.

west init -m https://github.com/fgihl/zephyr-ds18s20.git
cd zephyr
git checkout fgihl/strncpy-error
west update

west build -p -b qemu_arc/qemu_arc_em samples/strncpy_error/
west build -t run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions