public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/94774] New: Uninitialized variable retval in function try_substitute_return_value
@ 2020-04-26 15:05 stefansf at linux dot ibm.com
  2020-04-27 15:34 ` [Bug tree-optimization/94774] " msebor at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: stefansf at linux dot ibm.com @ 2020-04-26 15:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94774
           Summary: Uninitialized variable retval in function
                    try_substitute_return_value
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefansf at linux dot ibm.com
  Target Milestone: ---

Created attachment 48377
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48377&action=edit
If SAFE then retval was initialised

While bootstrapping GCC on S/390 the following warning/error gets thrown:

gcc/gimple-ssa-sprintf.c: In function 'bool
handle_printf_call(gimple_stmt_iterator*, const vr_values*)':                   
gcc/gimple-ssa-sprintf.c:4184:8: error: '*((void*)& retval +8)' may be used
uninitialized in this function [-Werror=maybe-uninitialized]
 4183 |    && (retval[0] < target_int_max ()
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4184 |        && retval[1] < target_int_max ()))
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc/gimple-ssa-sprintf.c:4123:26: note: '*((void*)& retval +8)' was declared
here
 4123 |   unsigned HOST_WIDE_INT retval[2];
      |                          ^~~~~~
gcc/gimple-ssa-sprintf.c:4214:14: error: 'retval' may be used uninitialized in
this function [-Werror=maybe-uninitialized]
 4214 |      fprintf (dump_file, "  %s %s-bounds return value "
      |      ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4215 |        HOST_WIDE_INT_PRINT_UNSIGNED ".\n",
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4216 |        what, inbounds, retval[0]);
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc/gimple-ssa-sprintf.c:4123:26: note: 'retval' was declared here
 4123 |   unsigned HOST_WIDE_INT retval[2];
      |                          ^~~~~~

The attached patch fixes this for me. Otherwise, one could also just initialize
array retval which may be more appropriate?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-03 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-26 15:05 [Bug middle-end/94774] New: Uninitialized variable retval in function try_substitute_return_value stefansf at linux dot ibm.com
2020-04-27 15:34 ` [Bug tree-optimization/94774] " msebor at gcc dot gnu.org
2020-04-27 16:51 ` stefansf at linux dot ibm.com
2020-04-29 13:54 ` cvs-commit at gcc dot gnu.org
2020-09-03 18:48 ` manu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).