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

            Bug ID: 78082
           Summary: [7 Regression] Conditional jump or move depends on
                    uninitialised value @ c-format.c:3347
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---
              Host: powerpc64le-unknown-linux-gnu
            Target: powerpc64le-unknown-linux-gnu
             Build: powerpc64le-unknown-linux-gnu

Created attachment 39870
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39870&action=edit
unreduced testcase

On ppc64le:

trippels@gcc2-power8 linux % valgrind -q --track-origins=yes
--trace-children=yes gcc -c -Wformat cpuacct.i
==126902== Conditional jump or move depends on uninitialised value(s)
==126902==    at 0x409811C: strlen (in
/usr/lib64/valgrind/vgpreload_memcheck-ppc64le-linux.so)
==126902==    by 0xB80761F: ???
==126902==    by 0x102A34DB: get_corrected_substring (c-format.c:3347)
==126902==    by 0x102A34DB: format_type_warning(substring_loc const&,
source_range*, format_wanted_type*, tree_node*, tree_node*, format_kind_info
const*, int, char) (c-format.c:3458)
==126902==    by 0x102A87EF: check_format_types (c-format.c:3072)
==126902==    by 0x102A87EF:
argument_parser::check_argument_type(format_char_info const*, length_modifier
const&, tree_node*&, char const*&, bool, unsigned long&, tree_node*&, int, char
const*, char const*, unsigned int, char) [clone .part.31] (c-format.c:2672)
==126902==    by 0x102AA133: check_argument_type (c-format.c:2709)
==126902==    by 0x102AA133: check_format_info_main (c-format.c:2817)
==126902==    by 0x102AA133: check_format_arg(void*, tree_node*, unsigned long)
(c-format.c:1669)
==126902==    by 0x10291E9F: check_function_arguments_recurse(void (*)(void*,
tree_node*, unsigned long), void*, tree_node*, unsigned long) (c-common.c:5677)
==126902==    by 0x102A515F: check_format_info (c-format.c:1402)
==126902==    by 0x102A515F: check_function_format(tree_node*, int,
tree_node**) (c-format.c:1063)
==126902==    by 0x102927F7: check_function_arguments(unsigned int, tree_node
const*, int, tree_node**) (c-common.c:5589)
==126902==    by 0x101FD397: build_function_call_vec(unsigned int, vec<unsigned
int, va_heap, vl_ptr>, tree_node*, vec<tree_node*, va_gc, vl_embed>*,
vec<tree_node*, va_gc, vl_embed>*) (c-typeck.c:3113)
==126902==    by 0x1022710F:
c_parser_postfix_expression_after_primary(c_parser*, unsigned int, c_expr)
(c-parser.c:8458)
==126902==    by 0x1021AD37: c_parser_postfix_expression(c_parser*)
(c-parser.c:8271)
==126902==    by 0x1021E41B: c_parser_unary_expression(c_parser*)
(c-parser.c:7089)
==126902==  Uninitialised value was created by a heap allocation
==126902==    at 0x4096784: realloc (in
/usr/lib64/valgrind/vgpreload_memcheck-ppc64le-linux.so)
==126902==    by 0x112719E3: xrealloc (xmalloc.c:180)
==126902==    by 0x11200407: maybe_grow (input.c:435)
==126902==    by 0x11200407: read_data (input.c:448)
==126902==    by 0x11200407: maybe_read_data(fcache*) (input.c:470)
==126902==    by 0x11201033: get_next_line(fcache*, char**, long*)
(input.c:487)
==126902==    by 0x1120188B: goto_next_line (input.c:611)
==126902==    by 0x1120188B: read_line_num (input.c:697)
==126902==    by 0x1120188B: location_get_source_line(char const*, int, int*)
(input.c:726)
==126902==    by 0x1120349B: get_substring_ranges_for_loc(cpp_reader*,
string_concat_db*, unsigned int, cpp_ttype, cpp_substring_ranges&)
(input.c:1365)
==126902==    by 0x1120401B: get_source_location_for_substring(cpp_reader*,
string_concat_db*, unsigned int, cpp_ttype, int, int, int, unsigned int*)
(input.c:1445)
==126902==    by 0x102606F3: c_get_substring_location(substring_loc const&,
unsigned int*) (c-common.c:862)
==126902==    by 0x108D2A27: substring_loc::get_location(unsigned int*) const
(substring-locations.c:194)
==126902==    by 0x102A32FB: get_corrected_substring (c-format.c:3305)
==126902==    by 0x102A32FB: format_type_warning(substring_loc const&,
source_range*, format_wanted_type*, tree_node*, tree_node*, format_kind_info
const*, int, char) (c-format.c:3458)
==126902==    by 0x102A87EF: check_format_types (c-format.c:3072)
==126902==    by 0x102A87EF:
argument_parser::check_argument_type(format_char_info const*, length_modifier
const&, tree_node*&, char const*&, bool, unsigned long&, tree_node*&, int, char
const*, char const*, unsigned int, char) [clone .part.31] (c-format.c:2672)
==126902==    by 0x102AA133: check_argument_type (c-format.c:2709)
==126902==    by 0x102AA133: check_format_info_main (c-format.c:2817)
==126902==    by 0x102AA133: check_format_arg(void*, tree_node*, unsigned long)
(c-format.c:1669)
==126902== 
kernel/sched/cpuacct.c: In function ‘cpuacct_stats_show’:
kernel/sched/cpuacct.c:298:25: warning: format ‘%lld’ expects argument of type
‘long long int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
   seq_printf(sf, "%s %lld\n",
                      ~~~^
                      %ld
kernel/sched/cpuacct.c:300:7:
       cputime64_to_clock_t(val[stat]));
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to