Skip to content

error: function may return address of local variable #38

@alopatindev

Description

@alopatindev
$ CFLAGS="-fstack-protector-strong -O2" cmake . && make -j8
...
src/ngp_search.c: In function ‘get_file_name’:
cc1: error: function may return address of local variable [-Werror=return-local-addr]
src/ngp_search.c:60:10: note: declared here
     char copy[FILENAME_MAX];

I'd also enable other warnings to see more potential issues
-pedantic-errors -pedantic -Wextra -Wall
For some weird reason it disables the local variable issue for me.

I'm using gcc 6.4.0 on Gentoo GNU/Linux.
Thank you!

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