Warning patrol: dwarf2out.c, except.c, expr.c, flow.c, function.c

Jan van Male jan.vanmale@fenk.wau.nl
Fri Jun 22 08:01:00 GMT 2001


Hi,

More warnings eliminated. 
It passes make bootstrap and testing without regressions on mainline 
i686-pc-linux-gnu.

Most of it seems trivial to me. Except for these two cases:

../../gcc/gcc/expr.c:4694: warning: `minelt' might be used uninitialized in this function
../../gcc/gcc/expr.c:4695: warning: `maxelt' might be used uninitialized in this function
expr.c: The warning is not 'obviously a false positive'. Maybe it is 
possible to say so by manual inspection but I was unable to do so.

It seems like this code snippet, relies on an implicit initialization to 
zero of `minelt':

	      if (minelt)
		     index = convert (ssizetype,

So I went ahead and initialized both `minelt' and `maxelt' to zero.


If this patch is ok, then please commit it, since I cannot write to cvs.

jan



2001-06-22  Jan van Male  <jan.vanmale@fenk.wau.nl>

        * dwarf2out.c (output_call_frame_info): Declare i as int.
        (build_abbrev_table): Declare n_alloc as int.
        (dwarf2out_finish): Initialize die.
        * except.c: Declare sjlj_funcdef_number as unsigned.
        (connect_post_landing_pads): Declare j as unsigned.
        (convert_to_eh_region_ranges): Initialize call_site.
        (output_function_exception_table): Initialize tt_format_size.
        * expr.c (move_by_pieces_1): Initialize to1.
        (store_constructor): Initialize minelt and maxelt.
        * flow.c (mark_regs_live_at_end): Declare i as unsigned.
        * function.c (instantiate_decls): Avoid signed/unsigned warning.
        

Index: gcc/gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.277
diff -c -3 -p -r1.277 dwarf2out.c
*** dwarf2out.c	2001/06/10 13:47:55	1.277
--- dwarf2out.c	2001/06/22 14:29:59
*************** static void
*** 1718,1724 ****
  output_call_frame_info (for_eh)
       int for_eh;
  {
!   register unsigned long i;
    register dw_fde_ref fde;
    register dw_cfi_ref cfi;
    char l1[20], l2[20];
--- 1718,1724 ----
  output_call_frame_info (for_eh)
       int for_eh;
  {
!   register unsigned int i;
    register dw_fde_ref fde;
    register dw_cfi_ref cfi;
    char l1[20], l2[20];
*************** build_abbrev_table (die)
*** 5546,5552 ****
       register dw_die_ref die;
  {
    register unsigned long abbrev_id;
!   register unsigned long n_alloc;
    register dw_die_ref c;
    register dw_attr_ref d_attr, a_attr;
  
--- 5546,5552 ----
       register dw_die_ref die;
  {
    register unsigned long abbrev_id;
!   register unsigned int n_alloc;
    register dw_die_ref c;
    register dw_attr_ref d_attr, a_attr;
  
*************** void
*** 11409,11415 ****
  dwarf2out_finish ()
  {
    limbo_die_node *node, *next_node;
!   dw_die_ref die;
  
    /* Traverse the limbo die list, and add parent/child links.  The only
       dies without parents that should be here are concrete instances of
--- 11409,11415 ----
  dwarf2out_finish ()
  {
    limbo_die_node *node, *next_node;
!   dw_die_ref die = 0;
  
    /* Traverse the limbo die list, and add parent/child links.  The only
       dies without parents that should be here are concrete instances of
Index: gcc/gcc/except.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/except.c,v
retrieving revision 1.169
diff -c -3 -p -r1.169 except.c
*** except.c	2001/06/18 06:43:51	1.169
--- except.c	2001/06/22 14:30:00
*************** tree (*lang_eh_runtime_type) PARAMS ((tr
*** 100,106 ****
  rtx exception_handler_labels;
  
  static int call_site_base;
! static int sjlj_funcdef_number;
  static htab_t type_to_runtime_map;
  
  /* Describe the SjLj_Function_Context structure.  */
--- 100,106 ----
  rtx exception_handler_labels;
  
  static int call_site_base;
! static unsigned int sjlj_funcdef_number;
  static htab_t type_to_runtime_map;
  
  /* Describe the SjLj_Function_Context structure.  */
*************** connect_post_landing_pads ()
*** 1855,1861 ****
  static void
  dw2_build_landing_pads ()
  {
!   int i, j;
  
    for (i = cfun->eh->last_region_number; i > 0; --i)
      {
--- 1855,1862 ----
  static void
  dw2_build_landing_pads ()
  {
!   int i;
!   unsigned int j;
  
    for (i = cfun->eh->last_region_number; i > 0; --i)
      {
*************** convert_to_eh_region_ranges ()
*** 3239,3245 ****
    rtx last_action_insn = NULL_RTX;
    rtx last_landing_pad = NULL_RTX;
    rtx first_no_action_insn = NULL_RTX;
!   int call_site;
  
    if (USING_SJLJ_EXCEPTIONS || cfun->eh->region_tree == NULL)
      return;
--- 3240,3246 ----
    rtx last_action_insn = NULL_RTX;
    rtx last_landing_pad = NULL_RTX;
    rtx first_no_action_insn = NULL_RTX;
!   int call_site = 0;
  
    if (USING_SJLJ_EXCEPTIONS || cfun->eh->region_tree == NULL)
      return;
*************** output_function_exception_table ()
*** 3510,3516 ****
  #endif
    int have_tt_data;
    int funcdef_number;
!   int tt_format_size;
  
    /* Not all functions need anything.  */
    if (! cfun->uses_eh_lsda)
--- 3511,3517 ----
  #endif
    int have_tt_data;
    int funcdef_number;
!   int tt_format_size = 0;
  
    /* Not all functions need anything.  */
    if (! cfun->uses_eh_lsda)
Index: gcc/gcc/expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.329
diff -c -3 -p -r1.329 expr.c
*** expr.c	2001/06/20 07:18:08	1.329
--- expr.c	2001/06/22 14:30:03
*************** move_by_pieces_1 (genfun, mode, data)
*** 1566,1572 ****
       struct move_by_pieces *data;
  {
    unsigned int size = GET_MODE_SIZE (mode);
!   rtx to1, from1;
  
    while (data->len >= size)
      {
--- 1566,1572 ----
       struct move_by_pieces *data;
  {
    unsigned int size = GET_MODE_SIZE (mode);
!   rtx to1 = NULL_RTX, from1;
  
    while (data->len >= size)
      {
*************** store_constructor (exp, target, align, c
*** 4694,4701 ****
        tree elttype = TREE_TYPE (type);
        int const_bounds_p = (host_integerp (TYPE_MIN_VALUE (domain), 0)
  			    && host_integerp (TYPE_MAX_VALUE (domain), 0));
!       HOST_WIDE_INT minelt;
!       HOST_WIDE_INT maxelt;
  
        /* If we have constant bounds for the range of the type, get them.  */
        if (const_bounds_p)
--- 4694,4701 ----
        tree elttype = TREE_TYPE (type);
        int const_bounds_p = (host_integerp (TYPE_MIN_VALUE (domain), 0)
  			    && host_integerp (TYPE_MAX_VALUE (domain), 0));
!       HOST_WIDE_INT minelt = 0;
!       HOST_WIDE_INT maxelt = 0;
  
        /* If we have constant bounds for the range of the type, get them.  */
        if (const_bounds_p)
Index: gcc/gcc/flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.401
diff -c -3 -p -r1.401 flow.c
*** flow.c	2001/06/21 21:33:33	1.401
--- flow.c	2001/06/22 14:30:05
*************** static void
*** 3235,3242 ****
  mark_regs_live_at_end (set)
       regset set;
  {
!   int i;
! 
    /* If exiting needs the right stack value, consider the stack pointer
       live at the end of the function.  */
    if ((HAVE_epilogue && reload_completed)
--- 3235,3242 ----
  mark_regs_live_at_end (set)
       regset set;
  {
!   unsigned int i;
!   
    /* If exiting needs the right stack value, consider the stack pointer
       live at the end of the function.  */
    if ((HAVE_epilogue && reload_completed)
Index: gcc/gcc/function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.277
diff -c -3 -p -r1.277 function.c
*** function.c	2001/06/21 16:50:54	1.277
--- function.c	2001/06/22 14:30:07
*************** instantiate_decls (fndecl, valid_only)
*** 3573,3585 ****
    for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl))
      {
        HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
! 
        instantiate_decl (DECL_RTL (decl), size, valid_only);
  
        /* If the parameter was promoted, then the incoming RTL mode may be
  	 larger than the declared type size.  We must use the larger of
  	 the two sizes.  */
!       size = MAX (GET_MODE_SIZE (GET_MODE (DECL_INCOMING_RTL (decl))), size);
        instantiate_decl (DECL_INCOMING_RTL (decl), size, valid_only);
      }
  
--- 3573,3587 ----
    for (decl = DECL_ARGUMENTS (fndecl); decl; decl = TREE_CHAIN (decl))
      {
        HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
!       HOST_WIDE_INT size_rtl;
!       
        instantiate_decl (DECL_RTL (decl), size, valid_only);
  
        /* If the parameter was promoted, then the incoming RTL mode may be
  	 larger than the declared type size.  We must use the larger of
  	 the two sizes.  */
!       size_rtl = GET_MODE_SIZE (GET_MODE (DECL_INCOMING_RTL (decl)));
!       size = MAX (size_rtl, size);
        instantiate_decl (DECL_INCOMING_RTL (decl), size, valid_only);
      }
  



More information about the Gcc-patches mailing list