https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83061

            Bug ID: 83061
           Summary: -Wmaybe-uninitialized warnings in gcc/lto/lto-object.c
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

LTO/PGO bootstrap shows:

../../gcc/gcc/lto/lto-object.c: In function ‘lto_obj_append_data’:
../../gcc/gcc/lto/lto-object.c:361:7: warning: ‘err’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
       if (err == 0)
       ^
../../gcc/gcc/lto/lto-object.c:352:7: note: ‘err’ was declared here
   int err;
       ^
../../gcc/gcc/lto/lto-object.c: In function ‘lto_obj_begin_section’:
../../gcc/gcc/lto/lto-object.c:337:7: warning: ‘err’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
       if (err == 0)
       ^
../../gcc/gcc/lto/lto-object.c:324:7: note: ‘err’ was declared here
   int err;
       ^
../../gcc/gcc/lto/lto-object.c:338:14: warning: ‘errmsg’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  fatal_error (input_location, "%s", errmsg);
              ^
../../gcc/gcc/lto/lto-object.c:323:15: note: ‘errmsg’ was declared here
   const char *errmsg;
               ^

All of the warnings are correct.

include/simple-object.h:
159 /* Add a section to SIMPLE_OBJECT.  NAME is the name of the new             
160    section.  ALIGN is the required alignment expressed as the number        
161    of required low-order 0 bits (e.g., 2 for alignment to a 32-bit          
162    boundary).  The section is created as containing data, readable,         
163    not writable, not executable, not loaded at runtime.  On error this      
164    returns NULL, sets *ERRMSG to an error message, and sets *ERR to an      
165    errno value or 0 if there isn't one.  */                                 
166                                                                             
167 extern simple_object_write_section *                                        
168 simple_object_write_create_section (simple_object_write *simple_object,     
169                                     const char *name, unsigned int align,   
170                                     const char **errmsg, int *err);

But libiberty/simple-object.c has:
411 simple_object_write_section *                                               
412 simple_object_write_create_section (simple_object_write *sobj, const char
*name,                                                                          
413                                     unsigned int align,                     
414                                     const char **errmsg ATTRIBUTE_UNUSED,   
415                                     int *err ATTRIBUTE_UNUSED)

Reply via email to