This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17010] New: Empty program, main(), causes UMRs (Unitialized Memory Errors)
- From: "debrak at sgi dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Aug 2004 19:30:50 -0000
- Subject: [Bug c++/17010] New: Empty program, main(), causes UMRs (Unitialized Memory Errors)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
---------------------------------------------------------
I use purify to look for errors in my code.
But I think it may have found errors in your code.
My very small program is:
----------------------------
#include <iostream>
using namespace std;
int main()
{ cout << "HELLO" << endl;}
----------------------------
When I run purify on it, I see
many Unitialized Memory Errors.
I do not see the UMRs if I comment out
#include <iostream>
---------------------------------------------------------
* the exact version of GCC; 3.4.1
* the system type; i686-pc-linux-gnu
* the options given when GCC was configured/built; --prefix=/usr/local/gcc-3.4.1
The above information was obtained by doing:
% gcc -v
Reading specs from /usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: /home/duff1/debrak/gcc-3.4.1/gcc-3.4.1/configure
--prefix=/usr/local/gcc-3.4.1
Thread model: posix
gcc version 3.4.1
---------------------------------------------------------
* the complete command line that triggers the bug;
% bug0.pure
HELLO
Look in purify.log for UMR (Unititialized Memory Read) errors.
---------------------------------------------------------
* the compiler output (error messages, warnings, etc.); and
There are no errors or Warnings when I compile:
% gcc -v -save-temps -g -Wall -o bug0.o -c bug0.cpp
% gcc -g -Wall -o bug0.o -c bug0.cpp
% g++ -g -Wall -o bug0 bug0.o
% purify -log-file=purify.log g++ -g -Wall -o bug0.pure bug0.o
Purify 2003a.06.00 Linux (32-bit) Copyright (C) 1992-2003 Rational Software
Corp. All rights reserved.
Instrumenting: bug0.o Linking
###################################################################
purify.log is as follows:
**** Purify instrumented bug0.pure (pid 3211 at Thu Aug 12 14:59:04 2004)
* Purify 2003a.06.00 Linux (32-bit) Copyright (C) 1992-2003 Rational Software
Corp. All rights reserved.
* For contact information type: "purify -help"
* Options settings: -chain-length=20 -threads=yes \
-follow-child-processes=yes -g++=yes -purify -log-file=purify.log \
-purify-home=/usr/local/Rational/releases/purify.i386_linux2.2003a.06.00 \
-cache-dir=/usr/local/Rational/releases/purify.i386_linux2.2003a.06.00/cache
* License successfully checked out.
* Command-line: bug0.pure
**** Purify instrumented bug0.pure (pid 3211) ****
UMR: Uninitialized memory read:
* This is occurring while in:
__gconv_transform_internal_ascii [libc.so.6]
wctob [libc.so.6]
std::ctype< wchar_t>::_M_initialize_ctype( void) [ctype_members.cc:265]
std::ctype< wchar_t>::ctype( unsigned) [ctype.cc:91]
std::locale::_Impl::_Impl( unsigned) [new:92]
std::locale::_S_initialize_once( void) [new:92]
std::locale::_S_initialize( void) [locale_init.cc:155]
std::locale::locale( void) [locale_init.cc:103]
std::ios_base::Init::Init( void) [streambuf:437]
__static_initialization_and_destruction_0( int, int) [iostream:77]
_GLOBAL__I_main [bug0.cpp:6]
__do_global_ctors_aux [crtend.o]
_init [crti.o]
__libc_start_main [libc.so.6]
_start [crt1.o]
* Reading 4 bytes from 0xbfffe858 on the stack.
* Address 0xbfffe858 is 96 bytes below frame pointer in function wctob.
**** Purify instrumented bug0.pure (pid 3211) ****
UMR: Uninitialized memory read:
* This is occurring while in:
__gconv_transform_ascii_internal [libc.so.6]
btowc [libc.so.6]
std::ctype< wchar_t>::_M_initialize_ctype( void) [ctype_members.cc:277]
std::ctype< wchar_t>::ctype( unsigned) [ctype.cc:91]
std::locale::_Impl::_Impl( unsigned) [new:92]
std::locale::_S_initialize_once( void) [new:92]
std::locale::_S_initialize( void) [locale_init.cc:155]
std::locale::locale( void) [locale_init.cc:103]
std::ios_base::Init::Init( void) [streambuf:437]
__static_initialization_and_destruction_0( int, int) [iostream:77]
_GLOBAL__I_main [bug0.cpp:6]
__do_global_ctors_aux [crtend.o]
_init [crti.o]
__libc_start_main [libc.so.6]
_start [crt1.o]
* Reading 4 bytes from 0xbfffe864 on the stack.
* Address 0xbfffe864 is 84 bytes below frame pointer in function btowc.
**** Purify instrumented bug0.pure (pid 3211) ****
UMR: Uninitialized memory read:
* This is occurring while in:
__gconv_transform_ascii_internal [libc.so.6]
btowc [libc.so.6]
std::numpunct< wchar_t>::_M_initialize_numpunct(__locale_struct *)
[numeric_members.cc:119]
std::locale::_Impl::_Impl( unsigned) [locale_facets.h:1700]
std::locale::_S_initialize_once( void) [new:92]
std::locale::_S_initialize( void) [locale_init.cc:155]
std::locale::locale( void) [locale_init.cc:103]
std::ios_base::Init::Init( void) [streambuf:437]
__static_initialization_and_destruction_0( int, int) [iostream:77]
_GLOBAL__I_main [bug0.cpp:6]
__do_global_ctors_aux [crtend.o]
_init [crti.o]
__libc_start_main [libc.so.6]
_start [crt1.o]
* Reading 4 bytes from 0xbfffe884 on the stack.
* Address 0xbfffe884 is 84 bytes below frame pointer in function btowc.
**** Purify instrumented bug0.pure (pid 3211) ****
UMR: Uninitialized memory read:
* This is occurring while in:
__gconv_transform_ascii_internal [libc.so.6]
btowc [libc.so.6]
std::numpunct< wchar_t>::_M_initialize_numpunct(__locale_struct *)
[numeric_members.cc:125]
std::locale::_Impl::_Impl( unsigned) [locale_facets.h:1700]
std::locale::_S_initialize_once( void) [new:92]
std::locale::_S_initialize( void) [locale_init.cc:155]
std::locale::locale( void) [locale_init.cc:103]
std::ios_base::Init::Init( void) [streambuf:437]
__static_initialization_and_destruction_0( int, int) [iostream:77]
_GLOBAL__I_main [bug0.cpp:6]
__do_global_ctors_aux [crtend.o]
_init [crti.o]
__libc_start_main [libc.so.6]
_start [crt1.o]
* Reading 4 bytes from 0xbfffe884 on the stack.
* Address 0xbfffe884 is 84 bytes below frame pointer in function btowc.
**** Purify instrumented bug0.pure (pid 3211) ****
UMR: Uninitialized memory read:
* This is occurring while in:
__gconv_transform_ascii_internal [libc.so.6]
btowc [libc.so.6]
std::moneypunct< wchar_t,false>::_M_initialize_moneypunct(__locale_struct *,
char const *) [monetary_members.cc:524]
std::locale::_Impl::_Impl( unsigned) [locale_facets.h:3581]
std::locale::_S_initialize_once( void) [new:92]
std::locale::_S_initialize( void) [locale_init.cc:155]
std::locale::locale( void) [locale_init.cc:103]
std::ios_base::Init::Init( void) [streambuf:437]
__static_initialization_and_destruction_0( int, int) [iostream:77]
_GLOBAL__I_main [bug0.cpp:6]
__do_global_ctors_aux [crtend.o]
_init [crti.o]
__libc_start_main [libc.so.6]
_start [crt1.o]
* Reading 4 bytes from 0xbfffe844 on the stack.
* Address 0xbfffe844 is 84 bytes below frame pointer in function btowc.
**** Purify instrumented bug0.pure (pid 3211) ****
UMR: Uninitialized memory read:
* This is occurring while in:
__gconv_transform_ascii_internal [libc.so.6]
btowc [libc.so.6]
std::moneypunct< wchar_t,true>::_M_initialize_moneypunct(__locale_struct *,
char const *) [monetary_members.cc:379]
std::locale::_Impl::_Impl( unsigned) [locale_facets.h:3581]
std::locale::_S_initialize_once( void) [new:92]
std::locale::_S_initialize( void) [locale_init.cc:155]
std::locale::locale( void) [locale_init.cc:103]
std::ios_base::Init::Init( void) [streambuf:437]
__static_initialization_and_destruction_0( int, int) [iostream:77]
_GLOBAL__I_main [bug0.cpp:6]
__do_global_ctors_aux [crtend.o]
_init [crti.o]
__libc_start_main [libc.so.6]
_start [crt1.o]
* Reading 4 bytes from 0xbfffe844 on the stack.
* Address 0xbfffe844 is 84 bytes below frame pointer in function btowc.
**** Purify instrumented bug0.pure (pid 3211) ****
Current file descriptors in use: 5
FIU: file descriptor 0: <stdin>
FIU: file descriptor 1: <stdout>
FIU: file descriptor 2: <stderr>
FIU: file descriptor 26: <reserved for Purify internal use>
FIU: file descriptor 27: <reserved for Purify internal use>
**** Purify instrumented bug0.pure (pid 3211) ****
Purify: Searching for all memory leaks...
Memory leaked: 0 bytes (0%); potentially leaked: 0 bytes (0%)
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 1 16
Potentially Leaked 0 0
In-Use 1 64
----------------------------------------
Total Allocated 2 80
**** Purify instrumented bug0.pure (pid 3211) ****
* Program exited with status code 0.
* 6 access errors, 468 total occurrences.
* 0 bytes leaked.
* 0 bytes potentially leaked.
* Basic memory usage (including Purify overhead):
227644 code
143924 data/bss
1164 heap (peak use)
5592 stack
* Shared library memory usage (including Purify overhead):
1782596 libstdc++.so.6_pure_p3_c0_108272013_2418-187xsmp_32 (shared code)
125556 libstdc++.so.6_pure_p3_c0_108272013_2418-187xsmp_32 (private data)
300483 libm.so.6_pure_p3_c0_108272013_2418-187xsmp_32 (shared code)
724 libm.so.6_pure_p3_c0_108272013_2418-187xsmp_32 (private data)
73956 libgcc_s.so.1_pure_p3_c0_108272013_2418-187xsmp_32 (shared code)
2280 libgcc_s.so.1_pure_p3_c0_108272013_2418-187xsmp_32 (private data)
18023 libdl.so.2_pure_p3_c0_108272013_2418-187xsmp_32 (shared code)
648 libdl.so.2_pure_p3_c0_108272013_2418-187xsmp_32 (private data)
8097 libinternal_stubs.so.1.0 (shared code)
372 libinternal_stubs.so.1.0 (private data)
2951235 libc.so.6_pure_p3_c0_108272013_2418-187xsmp_32 (shared code)
36448 libc.so.6_pure_p3_c0_108272013_2418-187xsmp_32 (private data)
77321 ld-linux.so.2 (shared code)
1744 ld-linux.so.2 (private data)
--
Summary: Empty program, main(), causes UMRs (Unitialized Memory
Errors)
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: debrak at sgi dot com
CC: debrak at sgi dot com,gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17010