New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compilation warning in sqlite3-binding.c #1165
Comments
I am also getting this error, as
This is out of my depth so unfortunately I have no solutions to offer, just wanted to raise awareness to this issue in builds. Edit: Saw in a related post proof to see that proper C installation exists:
|
gcc version should not above v10.0 or go-sqlite3 under v2.0 |
This was referenced Sep 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I encountered a compilation warning while attempting to build the github.com/mattn/go-sqlite3 package. The warning message is related to the sqlite3-binding.c file, specifically within the sqlite3SelectNew function. The warning suggests that the function may be returning the address of a local variable, which can lead to undefined behavior.
Steps to Reproduce
Clone the github.com/mattn/go-sqlite3 repository.
Build the package using the go build command.
Observe the compilation warning displayed.
Expected Behavior
The package should compile without any warnings, ensuring that there are no potential issues or undefined behavior within the code.
Actual Behavior
During compilation, the following warning is displayed:
sqlite3-binding.c: In function ‘sqlite3SelectNew’:
sqlite3-binding.c:128049:10: warning: function may return address of local variable [-Wreturn-local-addr]
128049 | return pNew;
| ^~~~
sqlite3-binding.c:128009:10: note: declared here
128009 | Select standin;
| ^~~~~~~
Environment
Go version: [Specify your Go version]
Operating System: [Specify your OS]
Additional Information
[Provide any additional information or context that may be relevant to the issue.]
Impact
The warning may indicate a potential issue in the code, where the function sqlite3SelectNew in sqlite3-binding.c returns the address of a local variable. This can lead to undefined behavior and should be addressed to ensure the code's correctness and stability.
Possible Solution
One possible solution would be to dynamically allocate memory for the relevant variable using malloc or a similar function and return the dynamically allocated memory. However, since the code is in a third-party package, modifying it directly may not be ideal.
The text was updated successfully, but these errors were encountered: