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]

c++/2413: Under AIX 4.3.0: Global object constructors not executed



>Number:         2413
>Category:       c++
>Synopsis:       Under AIX 4.3.0:  Global object constructors not executed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 28 06:46:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy A. Ter Louw
>Release:        GCC 2.95.2 (with AIX 4.3.0 only)
>Organization:
>Environment:
powerpc-ibm-aix4.3.0/2.95.2/specs
gcc version 2.95.2 19991024 (release)
>Description:
Global object constructors are not called using gcc 2.95.2 on AIX 4.3.0 platform. The __CTOR_LIST__ is empty.
Setup:
  - Obtained GCC compiler source. 
  - configured (only parameter: --prefix /str/dev/gcc2952) 
  - made (make bootstrap)
  - installed (make install)
  - compiled the source (gcc -save-temps junk4.cc) in how-to-repeat, below. The compiler generated no errors or warnings.

The problem only affects AIX. I also built the compiler (from the same .tar) on my Linux host, and the constructors *are* executed.
I noticed with gdb that the __CTOR_LIST__ is 8 bytes long and contains 2 NULL pointers. The __DTOR_LIST__ is 16 bytes long. It's pointers are NULL, NULL, atexit, NULL. 
Using gdb: __do_global_ctors is called. 
If I add an 'atexit' procedure, it is executed.
>How-To-Repeat:
Compile and execute source below...
C:\>type junk4.ii
# 1 "junk4.cc"
extern "C" { extern int printf(const char *msg, ...); };

class newjclass {
public:
    newjclass(int i)
    {
        printf("This constructor is never executed %d\n", i);
    }

    ~newjclass() { printf("Neither is this destructor\n"); }
};

newjclass MyObj1(44);

int main(int iArgc, char **ppszArgv)
{
    printf("Done\n");
    return(0);
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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