[Mesa-dev] [PATCH] nir: Fix anonymous union initialization with older GCC.

Vinson Lee vlee at freedesktop.org
Fri Mar 22 03:04:28 UTC 2019


Fix this build error with GCC 4.4.7.

  CC     nir/nir_opt_copy_prop_vars.lo
nir/nir_opt_copy_prop_vars.c: In function ‘load_element_from_ssa_entry_value’:
nir/nir_opt_copy_prop_vars.c:454: error: unknown field ‘ssa’ specified in initializer
nir/nir_opt_copy_prop_vars.c:455: error: unknown field ‘def’ specified in initializer
nir/nir_opt_copy_prop_vars.c:456: error: unknown field ‘component’ specified in initializer
nir/nir_opt_copy_prop_vars.c:456: error: extra brace group at end of initializer
nir/nir_opt_copy_prop_vars.c:456: error: (near initialization for ‘(anonymous).<anonymous>’)
nir/nir_opt_copy_prop_vars.c:456: warning: excess elements in union initializer
nir/nir_opt_copy_prop_vars.c:456: warning: (near initialization for ‘(anonymous).<anonymous>’)

Fixes: 96c32d77763c ("nir/copy_prop_vars: handle load/store of vector elements")
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/compiler/nir/nir_opt_copy_prop_vars.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index 19003cc..94bc8af 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -451,10 +451,12 @@ load_element_from_ssa_entry_value(struct copy_prop_var_state *state,
 
    *value = (struct value) {
       .is_ssa = true,
-      .ssa = {
-         .def = { def },
-         .component = { 0 },
-      },
+      {
+	.ssa = {
+	  .def = { def },
+	  .component = { 0 },
+	},
+      }
    };
 
    return true;
-- 
1.7.1



More information about the mesa-dev mailing list