[Bug,110884] can't start GDM when building mesa master branch with LTO

Submitted by bugzilla-daemon@freedesktop.org on June 11, 2019, 2:49 a.m.

Details

Message ID bug-110884-598-A4NCltNUsU@http.bugs.freedesktop.org/
State New
Headers show
Series "can't start GDM when building mesa master branch with LTO" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

bugzilla-daemon@freedesktop.org June 11, 2019, 2:49 a.m.
https://bugs.freedesktop.org/show_bug.cgi?id=110884

--- Comment #3 from Thiago Macieira <thiago@kde.org> ---
This patch appears to fix the problem:

From 49607f0524539cb836065b626bb3d3946061c486 Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Mon, 10 Jun 2019 19:13:12 -0700
Subject: [PATCH] Attempt at fixing strict aliasing violation in dequeueing
 packets

lp_scene_dequeue() calls util_ringbuffer_dequeue() with a payload that
isn't an array of struct util_packets. When util_ringbuffer_dequeue()
made the direct copy, the compiler discarded because it wasn't writing
the right type.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
---
 src/gallium/auxiliary/util/u_ringbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

    }

Patch hide | download patch | download mbox

diff --git a/src/gallium/auxiliary/util/u_ringbuffer.c
b/src/gallium/auxiliary/util/u_ringbuffer.c
index f6bb910671e..cebb908410c 100644
--- a/src/gallium/auxiliary/util/u_ringbuffer.c
+++ b/src/gallium/auxiliary/util/u_ringbuffer.c
@@ -146,7 +146,7 @@  enum pipe_error util_ringbuffer_dequeue( struct
util_ringbuffer *ring,
    /* Copy data from ring:
     */
    for (i = 0; i < ring_packet->dwords; i++) {
-      packet[i] = ring->buf[ring->tail];
+      memcpy(packet + i, ring->buf + ring->tail, sizeof(*packet));
       ring->tail++;
       ring->tail &= ring->mask;