This is the mail archive of the gcc-bugs@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]

[Bug c++/18713] New: Large program size due to uninitialised global data (SCO)


Configured with: ../sco/gcc-3.2.3/configure --prefix=/usr/local/gcc-3.2.3 --
enable-languages=c++ --with-gnu-as
Thread model: single
gcc version 3.2.3

System: SCO Unix 5.0.5

Compilation of source programs with declared but unitialised global data on the 
SCO system seems to cause the program to grow in proportion with the size of 
the data. Uninitialised data should be stored under BSS or the common section 
of a program. This seems to be the case for Linux but not on SCO.

-----
Test program: foo.cpp

struct My_t {
        char            myData[2048];
};
My_t myArr[10240];

int main ()
{
        return 0;
}

-----
Compilation: gcc -O -fconserve-space foo.cpp -lstdc++
Size listing (ls -l a.out) on SCO: 20977120
Size listing (ls -l a.out) on RedHat: 11341

However, converting the same program to a C standard and compiling with gcc on 
SCO produces the expected object code size as follows:

-----
Test program: foo.c

struct My_t {
        char            myData[2048];
};
struct My_t myArr[10240];

int
main ()
{
        return 0;
}

-----
Compilation: gcc foo.c
Size listing (ls -l a.out) on SCO: 5604

-- 
           Summary: Large program size due to uninitialised global data
                    (SCO)
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bygoh at genting dot com dot my
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18713


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