[Bug c++/61288] New: valgrind finds problem in build_conditional_expr_1

dcb314 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Thu May 22 20:05:00 GMT 2014


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

            Bug ID: 61288
           Summary: valgrind finds problem in build_conditional_expr_1
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

Created attachment 32845
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32845&action=edit
gzipped C++ source code

I just compiled the attached code with gcc trunk 20140521 and it said

==13004== Invalid read of size 1
==13004==    at 0x543B14: build_conditional_expr_1(unsigned int, tree_node*,
tree_node*, tree_node*, int) (call.c:4843)
==13004==    by 0x54467C: build_conditional_expr(unsigned int, tree_node*,
tree_node*, tree_node*, int) (call.c:5090)
==13004==    by 0x5FF373: build_x_conditional_expr(unsigned int, tree_node*,
tree_node*, tree_node*, int) (typeck.c:6063)
==13004==    by 0x5DC76E: cp_parser_assignment_expression(cp_parser*, bool,
bool, cp_id_kind*) (parser.c:8109)
==13004==    by 0x5DCA42: cp_parser_expression(cp_parser*, bool, bool,
cp_id_kind*) [clone .constprop.162] (parser.c:8303)
==13004==    by 0x5E37DD: cp_parser_jump_statement(cp_parser*) (parser.c:8342)
==13004==    by 0x5CF547: cp_parser_statement_seq_opt(cp_parser*, tree_node*)
(parser.c:9414)
==13004==    by 0x5CF8A6: cp_parser_compound_statement(cp_parser*, tree_node*,
bool, bool) [clone .constprop.174] (parser.c:9738)
==13004==    by 0x5E3A23:
cp_parser_ctor_initializer_opt_and_function_body(cp_parser*, bool)
(parser.c:18759)
==13004==    by 0x5CFEF2:
cp_parser_function_definition_after_declarator(cp_parser*, bool)
(parser.c:22929)
==13004==    by 0x5D03CC: cp_parser_late_parsing_for_member(cp_parser*,
tree_node*) (parser.c:23605)
==13004==    by 0x5D0DFA: cp_parser_class_specifier_1(cp_parser*)
(parser.c:19539)
==13004==  Address 0x11a4d048 is 24 bytes inside a block of size 4,064 free'd
==13004==    at 0x4A07577: free (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==13004==    by 0x32C5E84857: obstack_free (obstack.c:365)
==13004==    by 0x543C7D: build_conditional_expr_1(unsigned int, tree_node*,
tree_node*, tree_node*, int) (call.c:4823)
==13004==    by 0x54467C: build_conditional_expr(unsigned int, tree_node*,
tree_node*, tree_node*, int) (call.c:5090)
==13004==    by 0x5FF373: build_x_conditional_expr(unsigned int, tree_node*,
tree_node*, tree_node*, int) (typeck.c:6063)
==13004==    by 0x5DC76E: cp_parser_assignment_expression(cp_parser*, bool,
bool, cp_id_kind*) (parser.c:8109)
==13004==    by 0x5DCA42: cp_parser_expression(cp_parser*, bool, bool,
cp_id_kind*) [clone .constprop.162] (parser.c:8303)
==13004==    by 0x5E37DD: cp_parser_jump_statement(cp_parser*) (parser.c:8342)
==13004==    by 0x5CF547: cp_parser_statement_seq_opt(cp_parser*, tree_node*)
(parser.c:9414)
==13004==    by 0x5CF8A6: cp_parser_compound_statement(cp_parser*, tree_node*,
bool, bool) [clone .constprop.174] (parser.c:9738)
==13004==    by 0x5E3A23:
cp_parser_ctor_initializer_opt_and_function_body(cp_parser*, bool)
(parser.c:18759)
==13004==    by 0x5CFEF2:
cp_parser_function_definition_after_declarator(cp_parser*, bool)
(parser.c:22929)
==13004==

callc:4843 is

      if (((conv2 && !conv2->bad_p)
       || (conv3 && !conv3->bad_p))
      && CLASS_TYPE_P (arg2_type)
      && cp_type_quals (arg2_type) != cp_type_quals (arg3_type))



More information about the Gcc-bugs mailing list