[M3devel] uninitialized vs. init_var?

Jay K jay.krell at cornell.edu
Fri May 18 09:38:15 CEST 2012


This seems dubious, doesn't it, to state something is not initiallized, and then initialize it?
It triggers an assertion failure in gcc 4.6 backend.

RTCollector.m3

(479) declare_global name:null size:0X4000000(67108864) align:0X40(64) type:struct type_id:0x747D8491 exported:false initialized:false var:0x3B m3name:L_2
(14190) init_var offset:0X2280(8832) var:0x3B:L_2 0 one_field: offset:0x2280 size:0x20


Yes I realize it is initialized to zero.
I don't know if it is obviously initialized to all zeros, as I don't see the size in declare_global..er..rather, yes, there is a size there...is it real, or just some large guess..? I haven't looked..


I'm going to try this little hack:


M3CG_HANDLER (INIT_VAR)
{
  tree f = { 0 };
  tree v = { 0 };

#if GCC46
  if (DECL_COMMON (var))
  {
    if (option_trace_all)
      fprintf (stderr, " clearing DECL_COMMON on %s", m3_get_var_trace_name (var));
    DECL_COMMON (var) = false;
  }
#endif

  TREE_USED (var) = true;
  one_field (offset, POINTER_SIZE, t_addr, &f, &v);
  TREE_VALUE (v) = m3_build2 (POINTER_PLUS_EXPR, t_addr,
                              m3_build1 (ADDR_EXPR, t_addr, var),
                              size_int (b));
}

The assertion is in gcc-4.6/gcc/config/darwin.c

darwin_asm_output_aligned_decl_local

  /* .. and it should be suitable for placement in local mem.  */
  gcc_assert(!TREE_PUBLIC (decl) && !DECL_COMMON (decl));
  /* .. and any initializer must be all-zero.  */
  gcc_assert ((DECL_INITIAL (decl) == NULL) 
           || (DECL_INITIAL (decl) == error_mark_node) 
           || initializer_zerop (DECL_INITIAL (decl)));


The first one I think. I think it is common.


 - Jay
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120518/892b5595/attachment-0001.html>


More information about the M3devel mailing list