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

Compilation warnings in re2 with -Wpedantic #11917

Closed
2 tasks done
krlmlr opened this issue May 3, 2024 · 10 comments
Closed
2 tasks done

Compilation warnings in re2 with -Wpedantic #11917

krlmlr opened this issue May 3, 2024 · 10 comments
Assignees

Comments

@krlmlr
Copy link
Collaborator

krlmlr commented May 3, 2024

What happens?

Building duckdb v0.10.2 with -Wpedantic gives four warnings in re2:

  duckdb/third_party/re2/re2/prog.h:148:14: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  duckdb/third_party/re2/re2/prog.h:426:12: warning: ISO C++ prohibits anonymous structs [-Wpedantic]
  duckdb/third_party/re2/re2/dfa.cc:124:25: warning: ISO C++ forbids flexible array member ‘next_’ [-Wpedantic]
  duckdb/third_party/re2/re2/onepass.cc:146:12: warning: ISO C++ forbids flexible array member ‘action’ [-Wpedantic]

This affects the R package because CRAN checks this: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-fedora-gcc/duckdb-00check.html

To Reproduce

Compile duckdb with gcc13 and -Wpedantic .

OS:

Linux

DuckDB Version:

v0.10.2

DuckDB Client:

R

Full Name:

Kirill Müller

Affiliation:

cynkra GmbH

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a source build

Did you include all relevant data sets for reproducing the issue?

Not applicable - the reproduction does not require a data set

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have
@krlmlr
Copy link
Collaborator Author

krlmlr commented May 5, 2024

@szarnyasg: Thanks for looking into it.

In gcc14, there are even more warnings:

    /usr/local/gcc14/include/c++/14.0.1/bits/move.h:221:11: warning: '((__vector(2) long unsigned int*)this)[1]' is used uninitialized [-Wuninitialized]
    /usr/local/gcc14/include/c++/14.0.1/bits/move.h:221:11: warning: '*(__vector(2) long unsigned int*)this' is used uninitialized [-Wuninitialized]
    /usr/local/gcc14/include/c++/14.0.1/bits/move.h:221:11: warning: '((void (**)(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >))this)[2]' is used uninitialized [-Wuninitialized]
    /usr/local/gcc14/include/c++/14.0.1/bits/move.h:221:11: warning: '((duckdb::FileBuffer**)this)[2]' is used uninitialized [-Wuninitialized]

Check results: https://cran.r-project.org/web/checks/check_results_duckdb.html

@hannes
Copy link
Member

hannes commented May 6, 2024

The first two issues are easily fixable, but found this comment:

// Work around the bug affecting flexible array members in GCC 6.x (for x >= 1).
// (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70932)
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && __GNUC_MINOR__ >= 1
    std::atomic<State*> next_[0];   // Outgoing arrows from State,
#else
    std::atomic<State*> next_[];    // Outgoing arrows from State,
#endif

So this seems intentional to work around a GCC bug?

@hannes
Copy link
Member

hannes commented May 6, 2024

@hannes
Copy link
Member

hannes commented May 6, 2024

PR for first part is here: #11956

@hannes
Copy link
Member

hannes commented May 8, 2024

The re2 package on CRAN has this fixed, will copy their fix over.

@hannes hannes self-assigned this May 8, 2024
@hannes
Copy link
Member

hannes commented May 8, 2024

second PR is here: #11978

@hannes
Copy link
Member

hannes commented May 8, 2024

@krlmlr do we have a CI run already that would have found those?

@krlmlr
Copy link
Collaborator Author

krlmlr commented May 8, 2024

Yes. Easiest when that PR is merged and vendored here.

@hannes
Copy link
Member

hannes commented May 15, 2024

Fixed in upstream

@hannes hannes closed this as completed May 15, 2024
@krlmlr
Copy link
Collaborator Author

krlmlr commented May 20, 2024

Looks super-green now: https://github.com/duckdb/duckdb-r/actions/runs/9162129815/job/25188491799 .

Filed the clang-asan problem: #12142 .

The atlas check is not a problem.

I don't understand why valgrind still finds problems. Investigating.

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

No branches or pull requests

4 participants