Bug 110256 - -Werror=array-bounds with -flto
Summary: -Werror=array-bounds with -flto
Status: RESOLVED MOVED
Alias: None
Product: xorg
Classification: Unclassified
Component: App/XtoQ (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Jeremy Huddleston Sequoia
QA Contact: Jeremy Huddleston Sequoia
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-27 09:56 UTC by Martin Liska
Modified: 2019-05-07 11:53 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Martin Liska 2019-03-27 09:56:03 UTC
Using LTO one can see:

[  370s] events.c: In function 'XineramaConfineCursorToWindow':
[  370s] events.c:609:13: warning: iteration 2147483647 invokes undefined behavior [-Waggressive-loop-optimizations]
[  370s] events.c:609:11: note: within this loop
[  370s] events.c:605:49: error: array subscript -1 is below array bounds of 'struct _Window *[16]' [-Werror=array-bounds]
[  370s] events.c:606:31: error: array subscript -1 is below array bounds of 'struct _Screen *[16]' [-Werror=array-bounds]
[  370s] events.c:610:39: error: array subscript -2 is below array bounds of 'struct _Screen *[16]' [-Werror=array-bounds]
[  370s] events.c:617:38: error: array subscript -2 is below array bounds of 'struct _Window *[16]' [-Werror=array-bounds]
[  370s] events.c:619:35: error: array subscript -2 is below array bounds of 'struct _Screen *[16]' [-Werror=array-bounds]

It's maybe a false positive and one can fix that with:

--- /tmp/events.c.old	2019-03-27 10:55:21.101388832 +0100
+++ /tmp/events.c	2019-03-27 10:55:15.073264135 +0100
@@ -601,6 +601,7 @@
         return;
 
     i = PanoramiXNumScreens - 1;
+    assert (i >= 0);
 
     RegionCopy(&pSprite->Reg1, &pSprite->windows[i]->borderSize);
     off_x = screenInfo.screens[i]->x;
Comment 1 Stefan Dirsch 2019-05-07 11:53:18 UTC
Transferred to gitlab issue tracker ...

https://gitlab.freedesktop.org/xorg/xserver/issues/687


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.