[Bug c++/38908] [4.4 regression] Unexplained "'<anonymous>' is used uninitialized in this function" warning in cc1plus -m64

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jan 28 20:49:00 GMT 2009



------- Comment #11 from rguenth at gcc dot gnu dot org  2009-01-28 20:49 -------
# VUSE <D.86121_223(D)> { D.86121 }
# vis_224 = VDEF <vis_91> { vis }
vis = D.86121;

cp_expr_size returns 1 for the objects.

 <var_decl 0xb5eb5c08 D.86121
    type <record_type 0xb62bfbc8 dfs_visitor needs-constructing type_1 type_5
type_6 QI
        size <integer_cst 0xb7cef6c8 constant 8>
        unit size <integer_cst 0xb7cef6e4 constant 1>
        align 8 symtab 0 alias set 80 canonical type 0xb62bfbc8
        fields <field_decl 0xb6bc4c38 m_vis type <record_type 0xb62bf9c0 empty>
            used nonlocal decl_3 QI file t.ii line 51866 col 11 size
<integer_cst 0xb7cef6c8 8> unit size <integer_cst 0xb7cef6e4 1>
            align 8 offset_align 128
            offset <integer_cst 0xb7cef658 constant 0>
            bit offset <integer_cst 0xb7cefdc8 constant 0> context <record_type
0xb62bfbc8 dfs_visitor> chain <type_decl 0xb62bfc98 dfs_visitor>> context
<namespace_decl 0xb7c2cea0 boost>
       needs-constructor X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
        pointer_to_this <pointer_type 0xb62bfe38> reference_to_this
<reference_type 0xb629a7b8> chain <type_decl 0xb62bfc30 dfs_visitor>>
    used ignored QI file t.ii line 51892 col 9 size <integer_cst 0xb7cef6c8 8>
unit size <integer_cst 0xb7cef6e4 1>
    align 8 context <function_decl 0xb62c2300 foo> abstract_origin <var_decl
0xb6268528 D.75386>>

calling it on the m_vis member yields zero.

We change dfs_visitors empty flag to false in check_field_decls.

Short testcase:

struct empty {};

struct dfs_visitor {
    dfs_visitor() { }
    empty m_vis;
};

void bar(const dfs_visitor&);
void foo(void)
{
  dfs_visitor vis;
  dfs_visitor vis2 = vis;
  bar (vis2);
}

Note that we also end up generating code for the copy.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic, missed-
                   |                            |optimization


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38908



More information about the Gcc-bugs mailing list