[Bug tree-optimization/114952] False positive -Wmaybe-uninitialized starting at -O3 in libbpf

2024-06-08 Thread manu at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114952

Manuel López-Ibáñez  changed:

   What|Removed |Added

 CC||manu at gcc dot gnu.org

--- Comment #4 from Manuel López-Ibáñez  ---
Possibly duplicate of bug 61846

[Bug tree-optimization/114952] False positive -Wmaybe-uninitialized starting at -O3 in libbpf

2024-05-07 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114952

--- Comment #3 from Andrew Pinski  ---
Note I don't think this is a `False positive` exactly because GCC has no
knowledge that errno could be non-zero after a fail call to open.

[Bug tree-optimization/114952] False positive -Wmaybe-uninitialized starting at -O3 in libbpf

2024-05-07 Thread sjames at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114952

Sam James  changed:

   What|Removed |Added

 CC||jemarch at gcc dot gnu.org

--- Comment #2 from Sam James  ---
We hit this when poking at wiring up BPF support properly in Gentoo. It's a
pain because both default to building with -Werror=maybe-uninitialized.

[Bug tree-optimization/114952] False positive -Wmaybe-uninitialized starting at -O3 in libbpf

2024-05-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114952

--- Comment #1 from Andrew Pinski  ---
Most likely GCC does not know errno is non-zero after the call to elf_open and
checking `fd < 0`.
Adding:
  if (ret == 0) __builtin_unreachable();
After the assignment of `ret = -errono;` fixes the warning.