This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Memory problems in GCC ? (found with Valgrind)


Hi ! 

Running valgrind  on cc1plus gives me  some errors, which  may lead to
bugs. (I'm using gcc 3.2.2)

$ valgrind cc1plus -quiet basic.cc
==29106== valgrind-1.0.3, a memory error detector for x86 GNU/Linux. 
==29106== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
==29106== Estimated CPU clock rate is 1673 MHz
==29106== For more details, rerun with: -v
==29106== 
sc/src/basic.cc: warning: "__BASE_FILE__" redefined
sc/src/basic.cc: warning: "__VERSION__" redefined
<built-in>:1:1: warning: this is the location of the previous definition
sc/src/basic.cc: warning: "__WCHAR_TYPE__" redefined
<built-in>:7:1: warning: this is the location of the previous definition
sc/src/basic.cc: warning: "__DATE__" redefined
sc/src/basic.cc: warning: "__TIME__" redefined
sc/src/basic.cc: warning: "__STDC__" redefined
<built-in>:9:1: warning: this is the location of the previous definition
==29106== Conditional jump or move depends on uninitialised value(s)
==29106==    at 0x8266815: sbitmap_a_and_b_or_c (/home/moy/gcc/src/gcc/sbitmap.c:349)
==29106==    by 0x82FA789: compute_earliest (/home/moy/gcc/src/gcc/lcm.c:223)
==29106==    by 0x82FAB57: pre_edge_lcm (/home/moy/gcc/src/gcc/lcm.c:452)
==29106==    by 0x82FBAE7: optimize_mode_switching (/home/moy/gcc/src/gcc/lcm.c:1202)
==29106== 
==29106== Conditional jump or move depends on uninitialised value(s)
==29106==    at 0x82665B1: sbitmap_union_of_diff (/home/moy/gcc/src/gcc/sbitmap.c:177)
==29106==    by 0x82FA93F: compute_laterin (/home/moy/gcc/src/gcc/lcm.c:334)
==29106==    by 0x82FABBF: pre_edge_lcm (/home/moy/gcc/src/gcc/lcm.c:470)
==29106==    by 0x82FBAE7: optimize_mode_switching (/home/moy/gcc/src/gcc/lcm.c:1202)
==29106== 
==29106== Conditional jump or move depends on uninitialised value(s)
==29106==    at 0x8266674: sbitmap_a_and_b (/home/moy/gcc/src/gcc/sbitmap.c:230)
==29106==    by 0x82FA8F9: compute_laterin (/home/moy/gcc/src/gcc/lcm.c:329)
==29106==    by 0x82FABBF: pre_edge_lcm (/home/moy/gcc/src/gcc/lcm.c:470)
==29106==    by 0x82FBAE7: optimize_mode_switching (/home/moy/gcc/src/gcc/lcm.c:1202)
==29106== 
==29106== Conditional jump or move depends on uninitialised value(s)
==29106==    at 0x8266674: sbitmap_a_and_b (/home/moy/gcc/src/gcc/sbitmap.c:230)
==29106==    by 0x82FA9CE: compute_laterin (/home/moy/gcc/src/gcc/lcm.c:354)
==29106==    by 0x82FABBF: pre_edge_lcm (/home/moy/gcc/src/gcc/lcm.c:470)
==29106==    by 0x82FBAE7: optimize_mode_switching (/home/moy/gcc/src/gcc/lcm.c:1202)
==29106== 
==29106== Conditional jump or move depends on uninitialised value(s)
==29106==    at 0x82FBB79: optimize_mode_switching (/home/moy/gcc/src/gcc/lcm.c:1227)
==29106==    by 0x8280951: rest_of_compilation (/home/moy/gcc/src/gcc/toplev.c:3138)
==29106==    by 0x80F762D: genrtl_finish_function (/home/moy/gcc/src/gcc/cp/semantics.c:2613)
==29106==    by 0x80F70A1: expand_body (/home/moy/gcc/src/gcc/cp/semantics.c:2435)
==29106== 
==29106== Conditional jump or move depends on uninitialised value(s)
==29106==    at 0x82FBCFA: optimize_mode_switching (/home/moy/gcc/src/gcc/lcm.c:1281)
==29106==    by 0x8280951: rest_of_compilation (/home/moy/gcc/src/gcc/toplev.c:3138)
==29106==    by 0x80F762D: genrtl_finish_function (/home/moy/gcc/src/gcc/cp/semantics.c:2613)
==29106==    by 0x80F70A1: expand_body (/home/moy/gcc/src/gcc/cp/semantics.c:2435)
==29106== 
==29106== Invalid read of size 1
==29106==    at 0x832ADC4: handle_newline (/home/moy/gcc/src/gcc/cpplex.c:122)
==29106==    by 0x832BB20: _cpp_lex_direct (/home/moy/gcc/src/gcc/cpplex.c:933)
==29106==    by 0x832B9D9: _cpp_lex_token (/home/moy/gcc/src/gcc/cpplex.c:824)
==29106==    by 0x832E1C2: cpp_get_token (/home/moy/gcc/src/gcc/cppmacro.c:1037)
==29106==    Address 0x4144B0C0 is not stack'd, malloc'd or free'd
==29106== 
==29106== Invalid read of size 1
==29106==    at 0x832BA62: _cpp_lex_direct (/home/moy/gcc/src/gcc/cpplex.c:893)
==29106==    by 0x832B9D9: _cpp_lex_token ( /home/moy/gcc/src/gcc/cpplex.c:824)
==29106==    by 0x832E1C2: cpp_get_token ( /home/moy/gcc/src/gcc/cppmacro.c:1037)
==29106==    by 0x811C582: c_lex (/home/moy/gcc/src/gcc/c-lex.c:776)
==29106==    Address 0x4144B0C0 is not stack'd, malloc'd or free'd
==29106== 
==29106== ERROR SUMMARY: 2575 errors from 8 contexts (suppressed: 0 from 0)
==29106== malloc/free: in use at exit: 905789 bytes in 6455 blocks.
==29106== malloc/free: 140325 allocs, 133870 frees, 25339782 bytes allocated.
==29106== For a detailed leak analysis,  rerun with: --leak-check=yes
==29106== For counts of detected errors, rerun with: -v

Where basic.cc is the (preprocessed) file

http://www-verimag.imag.fr/~moy/basic.cc

You may be interested in investingating on this ... 

-- 
Matthieu


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]