Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Compilation error with gcc 10, -Werror=array-bounds and -O2 or higher #63

Open
steils opened this issue Jan 10, 2021 · 0 comments
Open

Comments

@steils
Copy link

steils commented Jan 10, 2021

gcc -O2 -g -Wall -Werror=array-bounds  -Wall -Wextra -Wsign-compare -Wno-unused-result -Wno-unused-function -Wno-missing-field-initializers -Werror -Wno-error=cpp -std=gnu11 -fshort-wchar -fPIC -fno-strict-aliasing -D_GNU_SOURCE -DCONFIG_x86_64 -I/home/stefan/projects/pesign/include   -Wmaybe-uninitialized -grecord-gcc-switches -flto     -fno-merge-constants -fvar-tracking -fvar-tracking-assignments -fkeep-inline-functions -Wl,--fatal-warnings,--no-allow-shlib-undefined,--default-symver -Wl,-O2 -Wl,--no-undefined-version -Wl,-z,relro,-z,now -Wl,--no-add-needed,--no-copy-dt-needed-entries,--as-needed   -shared \
        -Wl,-soname,libdpe.so.0.113 \
        -o libdpe.so libdpe.o pe_addcert.o pe_allocspace.o pe_begin.o pe_end.o pe_error.o pe_getdatadir.o pe_getpehdr.o pe_getscn.o pe_getshdr.o pe_nextscn.o pe_opthdr.o pe_rawfile.o pe_readall.o
pe_update.o pe_updatefile.o pe_updatenull.o -lpthread
pe_begin.c: In function ‘read_file.constprop’:
common.h:107:11: error: array subscript 1 is outside array bounds of ‘union [1]’ [-Werror=array-bounds]
  107 |   switch (le16_to_cpu(peo->magic)) {
      |           ^
pe_begin.c:176:4: note: while referencing ‘mem’
  176 |  } mem;
      |    ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

See also: https://bugs.gentoo.org/721934
I have reproduced this error with the latest source from the master branch. It does not reproduce with gcc 9, or gcc 10 with -O{0,1}.

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

No branches or pull requests

2 participants