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

Wmaybe-uninitialized with trivial auto var init #20

Open
xnox opened this issue Nov 1, 2024 · 0 comments
Open

Wmaybe-uninitialized with trivial auto var init #20

xnox opened this issue Nov 1, 2024 · 0 comments

Comments

@xnox
Copy link

xnox commented Nov 1, 2024

Description

Compiling criu with -Wall -Werror -ftrivial-auto-var-init=zero using gcc-14 spots an uninitialized variable in crui/tls

In

criu/criu/tls.c

Line 195 in e7aefe4

gnutls_packet_deinit(packet);

it is not certain that len will always be more than zero; thus it is possible to call this function with len set to zero and indeed packet is deinited without being allocated first

I have no idea why GCC's -ftrivial-auto-var-init=zero helps it find this Wmaybe-uninitialized, when such warning was already active.

Steps to reproduce the issue:

  1. Build with cflags set to -ftrivial-auto-var-init=zero

Describe the results you received:

Build failure

Describe the results you expected:

Build passes

Additional information you deem important (e.g. issue happens only occasionally):

Asserting len, or checking len input value and exiting the function straight away should help the compiler here.

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

No branches or pull requests

1 participant