Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

get_{day,month}_abbrev return address of stack-local #157

Open
jrtc27 opened this issue Oct 19, 2017 · 1 comment
Open

get_{day,month}_abbrev return address of stack-local #157

jrtc27 opened this issue Oct 19, 2017 · 1 comment

Comments

@jrtc27
Copy link

jrtc27 commented Oct 19, 2017

I noticed the following warnings when compiling gsl:

sfllang.c: In function 'get_day_abbrev':
sfllang.c:611:13: warning: function may return address of local variable [-Wreturn-local-addr]
     return (handle_accents (abbrev));
            ~^~~~~~~~~~~~~~~~~~~~~~~~
sfllang.c:603:9: note: declared here
         abbrev [4];
         ^~~~~~
sfllang.c: In function 'get_month_abbrev':
sfllang.c:653:13: warning: function may return address of local variable [-Wreturn-local-addr]
     return (handle_accents (abbrev));
            ~^~~~~~~~~~~~~~~~~~~~~~~~
sfllang.c:644:9: note: declared here
         abbrev [4];
         ^~~~~~

Indeed, both warnings are correct, since handle_accents just returns the buffer it's given. Thankfully, nothing in gsl itself is using these functions, but it's just a matter of time until one of them gets used. Please fix this.

@bluca
Copy link
Contributor

bluca commented Oct 19, 2017

Fixed in zeromq#17 (note that this repo is in read-only mode now)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants