Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 557486 - x11-base/xorg-server-1.17.2 fails to build with LTO ./dix/events.c:611:49: error: array subscript is below array bounds [-Werror=array-bounds] (GCC 5.2)
Summary: x11-base/xorg-server-1.17.2 fails to build with LTO ./dix/events.c:611:49: er...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matt Turner
URL:
Whiteboard:
Keywords:
Depends on: 416069
Blocks: werror lto
  Show dependency tree
 
Reported: 2015-08-13 17:02 UTC by Petros
Modified: 2024-03-11 22:44 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (x11-base:xorg-server-1.17.2:20150813-161821.log.rar,73.95 KB, application/x-rar)
2015-08-13 17:02 UTC, Petros
Details
emerge --info (info,57.23 KB, text/plain)
2015-08-13 17:03 UTC, Petros
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petros 2015-08-13 17:02:51 UTC
Created attachment 408940 [details]
build.log

While the new masked compiler is able to compile this xorg-server version, it can't build it with LTO enabled.

I am using binutils-9999 (git version) and GCC 5.2.

/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/xkb/xkbInit.c:731:22: warning: type of 'XkbDfltAccessXOptions' does not match original declaration
 extern unsigned char XkbDfltAccessXOptions;
                      ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/xkb/xkbAccessX.c:58:16: note: previously declared here
 unsigned short XkbDfltAccessXOptions =
                ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c: In function 'XineramaConfineCursorToWindow':
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:615:13: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations]
     while (i--) {
             ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:615:11: note: containing loop
     while (i--) {
           ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:611:49: error: array subscript is below array bounds [-Werror=array-bounds]
     RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize);
                                                 ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:612:31: error: array subscript is below array bounds [-Werror=array-bounds]
     off_x = screenInfo.screens[i]->x;
                               ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:616:39: error: array subscript is below array bounds [-Werror=array-bounds]
         x = off_x - screenInfo.screens[i]->x;
                                       ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:623:38: error: array subscript is below array bounds [-Werror=array-bounds]
                     &pSprite->windows[i]->borderSize);
                                      ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/events.c:625:35: error: array subscript is below array bounds [-Werror=array-bounds]
         off_x = screenInfo.screens[i]->x;
                                   ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/ptrveloc.c: In function 'AccelSetProfileProperty':
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/ptrveloc.c:204:13: warning: 'profile' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (GetAccelerationProfile(vel, profile) == NULL)
             ^
/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2/dix/ptrveloc.c:188:9: note: 'profile' was declared here
     int profile, *ptr = &profile;
         ^
LTRANS statistics
[LTRANS] read 492229 SCCs of average size 1.636370
[LTRANS] 805469 tree bodies read in total
[LTRANS] # of input files: 324
[LTRANS] # of input cgraph nodes: 6263
[LTRANS] # of function bodies: 1795
[LTRANS] Size of mmap'd section decls: 11223261 bytes
[LTRANS] Size of mmap'd section function_body: 2677122 bytes
[LTRANS] Size of mmap'd section statics: 0 bytes
[LTRANS] Size of mmap'd section symtab: 0 bytes
[LTRANS] Size of mmap'd section refs: 42734 bytes
[LTRANS] Size of mmap'd section asm: 0 bytes
[LTRANS] Size of mmap'd section jmpfuncs: 303003 bytes
[LTRANS] Size of mmap'd section pureconst: 17525 bytes
[LTRANS] Size of mmap'd section reference: 0 bytes
[LTRANS] Size of mmap'd section profile: 6358 bytes
[LTRANS] Size of mmap'd section symbol_nodes: 242135 bytes
[LTRANS] Size of mmap'd section opts: 0 bytes
[LTRANS] Size of mmap'd section cgraphopt: 0 bytes
[LTRANS] Size of mmap'd section inline: 248507 bytes
[LTRANS] Size of mmap'd section ipcp_trans: 0 bytes
[LTRANS] Size of mmap'd section icf: 51157 bytes
[LTRANS] Size of mmap'd section offload_table: 0 bytes
[LTRANS] Size of mmap'd section mode_table: 0 bytes
lto1: some warnings being treated as errors
lto-wrapper: fatal error: /usr/x86_64-pc-linux-gnu/gcc-bin/5.2.0/x86_64-pc-linux-gnu-gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/5.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Makefile:1057: recipe for target 'xtest' failed
make[3]: *** [xtest] Error 1
make[3]: Leaving directory '/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2_build/test'
Makefile:1123: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2_build/test'
Makefile:955: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/tmp/portage/x11-base/xorg-server-1.17.2/work/xorg-server-1.17.2_build/test'
Makefile:771: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1
Comment 1 Petros 2015-08-13 17:03:44 UTC
Created attachment 408942 [details]
emerge --info
Comment 2 hellohellodon 2015-08-26 07:03:30 UTC
I have a similar issue with gcc 5.1, on amd64 with -O3, but with "array above upper bound" warnings being treated like errors, also xorg-server-1.17.2. Switching to -O2 alleviates it.
Comment 3 Petros 2015-08-26 11:33:40 UTC
(In reply to hellohellodon from comment #2)
> I have a similar issue with gcc 5.1, on amd64 with -O3, but with "array
> above upper bound" warnings being treated like errors, also
> xorg-server-1.17.2. Switching to -O2 alleviates it.

I am using -O2 if that matters
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2015-11-01 06:06:04 UTC
The only bug here is that we're still building with -Werror 3 and a half years after bug #416069 was opened.
Comment 5 Matt Turner gentoo-dev 2017-02-01 06:55:19 UTC
Fixed by

commit 6aaaf15f8882dd112d22454600294e37969fa822
Author: Matt Turner <mattst88@gentoo.org>
Date:   Sun Jan 29 11:30:39 2017 -0800

    xorg-2.eclass: Use --disable-selective-werror.