Bug 109810 - nir_opt_copy_prop_vars.c:454: error: unknown field ‘ssa’ specified in initializer
Summary: nir_opt_copy_prop_vars.c:454: error: unknown field ‘ssa’ specified in initial...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
URL:
Whiteboard:
Keywords: bisected, regression
Depends on:
Blocks:
 
Reported: 2019-03-02 06:53 UTC by Vinson Lee
Modified: 2019-03-23 01:45 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Vinson Lee 2019-03-02 06:53:15 UTC
GCC 4.4 build error

  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>’)


commit 96c32d77763c4b561f751ca360e6539a3c5e7f4d
Author: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Date:   Mon Jan 14 15:28:33 2019 -0800

    nir/copy_prop_vars: handle load/store of vector elements
    
    When direct array deref is used on a vector type (for loads and
    stores), copy_prop_vars is now smart to propagate values it knows
    about.
    
    Given a 'vec4 v', storing to v[3] will update the copy entry for v and
    it is equivalent to a write to v.w.  Loading from v[1] will try first
    to see if there's a known value for v.y -- and drop the load in that
    case.
    
    The copy entries still always refer to the entire vectors, so the
    operations happen on the parent deref (the 'vector') and the values
    are fixed accordingly.
    
    It might be the case now that certain entries have not only different
    SSA defs in each element but also those come from different components
    than they are set to, because stores to individual elements always
    come from a SSA definition with a single component.
    
    Tests related to these cases are now enabled.
    
    v2: Instead of asserting on invalid indices, "load" an undef and
        remove the store.  (Jason)
    
    v3: Merge code path for the cases of is_array_deref_of_vector into the
        regular code path.  Add a base_index parameter to
        value_set_from_value.  (code changes by Jason)
    
    v4: Removed the get_entry_for_deref helper, now being used only once.
    
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Comment 1 Caio Marcelo de Oliveira Filho 2019-03-02 07:36:40 UTC
I suspect this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676. In our struct we have a nested union that's unnamed. The tested GCC misses that somehow.

struct value {
   bool is_ssa;
   union {
      struct {
         nir_ssa_def *def[NIR_MAX_VEC_COMPONENTS];
         uint8_t component[NIR_MAX_VEC_COMPONENTS];
      } ssa;
      nir_deref_instr *deref;
   };
};

The bug comments there suggests (1) adding extra set of braces around the .ssa in the initializer. Other possible ways to fix are: (2) naming the union, or (3) creating the temporary and then assigning to '*value' in the code. If we have to do this, I think the more natural solution would be (3).

I don't have GCC 4.4 handy to test those three options though.
Comment 2 Vinson Lee 2019-03-23 01:45:39 UTC
commit 77aa11ca325112c8d1727f7bb7c2035500c72c1a
Author: Vinson Lee <vlee@freedesktop.org>
Date:   Thu Mar 21 14:47:06 2019 -0700

    nir: Fix anonymous union initialization with older GCC.
    
    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@freedesktop.org>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109810
    Reviewed-by: Andres Gomez <agomez@igalia.com>
    Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>


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.