[Bug middle-end/94774] New: Uninitialized variable retval in function try_substitute_return_value
stefansf at linux dot ibm.com
gcc-bugzilla@gcc.gnu.org
Sun Apr 26 15:05:58 GMT 2020
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?
More information about the Gcc-bugs
mailing list