Skip to content
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

Build with -ftrivial-auto-var-init=zero #133

Closed
z3ntu opened this issue Feb 16, 2024 · 4 comments · Fixed by #139
Closed

Build with -ftrivial-auto-var-init=zero #133

z3ntu opened this issue Feb 16, 2024 · 4 comments · Fixed by #139
Labels
bug Something isn't working

Comments

@z3ntu
Copy link

z3ntu commented Feb 16, 2024

According to upstream[0] there are several cases of variables or struct members not being initialized, but since they're using -ftrivial-auto-var-init=zero to build the code, those will be zero-initialized by the compiler already.

The CMake files should add this flag also to not hit bugs[1] due to uninitialized variables.

I assume we should be able to add these lines here https://github.com/nmeum/android-tools/blob/master/vendor/CMakeLists.txt#L18

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrivial-auto-var-init=zero")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrivial-auto-var-init=zero")

Let me know if I should open a pull request with this or if you have other suggestions.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/comments/233c6468_46a055c5

[1] https://gitlab.archlinux.org/archlinux/packaging/packages/android-tools/-/issues/4

@Biswa96
Copy link
Collaborator

Biswa96 commented Feb 16, 2024

Please wait until the pending pull request is being resolved.

@z3ntu
Copy link
Author

z3ntu commented Feb 19, 2024

I don't see how it could conflict with #132 though, is there some concern there?

@anatol
Copy link
Collaborator

anatol commented Mar 20, 2024

@z3ntu could you please send a pull request for this patch? It will help to move changes forward.

z3ntu pushed a commit to z3ntu/android-tools that referenced this issue Mar 20, 2024
As per upstream guidance [0] we should compile the sources with this
flag in order to not hit issues with using uninitialized variables.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/1#message-01ebff378bb51f7815b6ed8b035a57fbce0418ab

Fixes nmeum#133
@z3ntu
Copy link
Author

z3ntu commented Mar 20, 2024

@anatol #139

anatol pushed a commit to z3ntu/android-tools that referenced this issue Mar 20, 2024
As per upstream guidance [0] we should compile the sources with this
flag in order to not hit issues with using uninitialized variables.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/1#message-01ebff378bb51f7815b6ed8b035a57fbce0418ab

Fixes nmeum#133
z3ntu pushed a commit to z3ntu/android-tools that referenced this issue Mar 20, 2024
As per upstream guidance [0] we should compile the sources with this
flag in order to not hit issues with using uninitialized variables.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/1#message-01ebff378bb51f7815b6ed8b035a57fbce0418ab

Fixes nmeum#133

Co-authored-by: munix9 <44939650+munix9@users.noreply.github.com>
z3ntu pushed a commit to z3ntu/android-tools that referenced this issue Mar 20, 2024
As per upstream guidance [0] we should compile the sources with this
flag in order to not hit issues with using uninitialized variables.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/1#message-01ebff378bb51f7815b6ed8b035a57fbce0418ab

Fixes nmeum#133

Co-authored-by: munix9 <44939650+munix9@users.noreply.github.com>
anatol pushed a commit that referenced this issue Mar 20, 2024
As per upstream guidance [0] we should compile the sources with this
flag in order to not hit issues with using uninitialized variables.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/1#message-01ebff378bb51f7815b6ed8b035a57fbce0418ab

Fixes #133

Co-authored-by: munix9 <44939650+munix9@users.noreply.github.com>
@Biswa96 Biswa96 added the bug Something isn't working label Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants