bug report: abort in g++ 3.4.4 generated DLL & client

Stein Somers ssomers@opnet.com
Tue Aug 2 17:14:00 GMT 2005


Below is minimalistic textbook "how to generate a DLL" code, brought to 
flavour by a grain of C++ salt. However it abort if compiled and run 
with the latest gcc 3.4.4.1 and binutils 20050610-1 releases (as opposed 
to the alternative 3.3.3.3, and I suspect any other version this century).

When run from a bash script, the compiled executable aborts with:
    2400 Aborted                 (core dumped)
When run from within a bash shell, that's a mere:
    Aborted (core dumped)
When run from a DOS prompt, it aborts silently.

It coredumps consistently on 3 out of 4 PCs tested (two of which have 
identical hardware, and one which has entirely different components), 
running either Windows XP, Windows 2000 SP4  or an almost immaculate 
Windows 2000 SP3 (for which cygcheck output is listed). However, it did 
not abort on a machine when that had the same gcc-3.4.4.1 installed, but 
a slightly older binutils. The code compiled at that moment on that 
machine does abort on the others. If you wonder what version of binutils 
that might have been, so do I... It's no the 20050608-2 alternative 
offered by the package selector.

The abort seems to happen be the destructor of the temporary string 
returned by the test() function.
In some real programs, the effect is instead that the program halts, 
without consuming CPU time, with no signal intercepted by gdb (but my 
gdb knowledge is extremely average), and no input is consumed from the 
terminal window.
As to the code, it's got nothing to do with the "puts" statements.
It doesn't matter if you explicitly export and import functions (using 
__attribute) or leave it up to the compiler (as in the example).
It doesn't matter if you let an import library be the middle man in the 
build process.

That should be enough for a first shot at this list.  Cheers.

Source file 1: ==> testdll.cpp <==
    #include <string>
    std::string test() { return std::string(); }

Source file 2: ==> main.cpp <==
    #include <string>
    std::string test();

    int main() {
        puts("hello");
        test();
        puts("goodbye");
        return 0;
    }

Commands applied:

    g++ -Wall testdll.cpp -shared -o test.dll
    g++ -Wall main.cpp test.dll
    ./a.exe


Cygwin Configuration Diagnostics
Current System Time: Tue Aug 02 16:06:13 2005

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 3

Path:    F:\cygwin\usr\local\bin
    F:\cygwin\bin
    F:\cygwin\bin
    F:\cygwin\usr\X11R6\bin
    f:\WINNT\system32
    f:\WINNT
    f:\WINNT\System32\Wbem

Output from F:\cygwin\bin\id.exe (nontsec)
UID: 500(Administrator) GID: 513(None)
0(root)                 513(None)               544(Administrators)
545(Users)

Output from F:\cygwin\bin\id.exe (ntsec)
UID: 500(Administrator) GID: 513(None)
0(root)                 513(None)               544(Administrators)
545(Users)

SysDir: F:\WINNT\System32
WinDir: F:\WINNT

USER = `Administrator'
PWD = `/home/Administrator'
HOME = `/home/Administrator'
MAKE_MODE = `unix'

HOMEPATH = `\'
MANPATH = `/usr/local/man:/usr/share/man:/usr/man:'
APPDATA = `F:\Documents and Settings\Administrator\Application Data'
HOSTNAME = `zed'
TERM = `cygwin'
PROCESSOR_IDENTIFIER = `x86 Family 15 Model 2 Stepping 7, GenuineIntel'
WINDIR = `F:\WINNT'
OLDPWD = `/usr/bin'
USERDOMAIN = `ZED'
OS = `Windows_NT'
ALLUSERSPROFILE = `F:\Documents and Settings\All Users'
OS2LIBPATH = `F:\WINNT\system32\os2\dll;'
TEMP = `/cygdrive/f/DOCUME~1/ADMINI~1/LOCALS~1/Temp'
COMMONPROGRAMFILES = `F:\Program Files\Common Files'
!F: = `F:\cygwin\bin'
USERNAME = `Administrator'
PROCESSOR_LEVEL = `15'
SYSTEMDRIVE = `F:'
USERPROFILE = `F:\Documents and Settings\Administrator'
PS1 = `\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
LOGONSERVER = `\\ZED'
PROCESSOR_ARCHITECTURE = `x86'
SHLVL = `1'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
HOMEDRIVE = `F:'
PROMPT = `$P$G'
COMSPEC = `F:\WINNT\system32\cmd.exe'
TMP = `/cygdrive/f/DOCUME~1/ADMINI~1/LOCALS~1/Temp'
SYSTEMROOT = `F:\WINNT'
CVS_RSH = `/bin/ssh'
PROCESSOR_REVISION = `0207'
INFOPATH = `/usr/local/info:/usr/share/info:/usr/info:'
PROGRAMFILES = `F:\Program Files'
NUMBER_OF_PROCESSORS = `1'
COMPUTERNAME = `ZED'
_ = `/usr/bin/cygcheck'
POSIXLY_CORRECT = `1'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `F:\cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `F:\cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `F:\cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd  FAT          0Mb  95% CP    UN          
d:  hd  FAT32    16323Mb  67% CP    UN           BACKUP
e:  cd             N/A    N/A                   
f:  hd  NTFS      4094Mb  31% CP CS UN PA FC     clean
z:  hd  NTFS       784Mb  99% CP CS UN PA FC     System

F:\cygwin      /          system  binmode
F:\cygwin/bin  /usr/bin   system  binmode
F:\cygwin/lib  /usr/lib   system  binmode
.              /cygdrive  system  binmode,cygdrive

Found: F:\cygwin\bin\awk.exe
Found: F:\cygwin\bin\bash.exe
Found: F:\cygwin\bin\cat.exe
Found: F:\cygwin\bin\cp.exe
Found: F:\cygwin\bin\cpp.exe
Found: F:\cygwin\bin\find.exe
Found: F:\cygwin\bin\gcc.exe
Not Found: gdb
Found: F:\cygwin\bin\grep.exe
Found: F:\cygwin\bin\ld.exe
Found: F:\cygwin\bin\ls.exe
Not Found: make
Found: F:\cygwin\bin\mv.exe
Found: F:\cygwin\bin\rm.exe
Found: F:\cygwin\bin\sed.exe
Found: F:\cygwin\bin\sh.exe
Found: F:\cygwin\bin\tar.exe

   56k 2005/07/09 F:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz2-1.dll" v0.0 ts=2005/7/9 7:09
   18k 2004/07/06 F:\cygwin\bin\cygcharset-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygcharset-1.dll" v0.0 ts=2004/7/6 20:09
   40k 2005/07/10 F:\cygwin\bin\cygform-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygform-8.dll" v0.0 ts=2005/7/10 5:29
   45k 2001/04/25 F:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/25 7:28
   35k 2002/01/09 F:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/9 7:03
   48k 2003/08/09 F:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0
                  "cygform7.dll" v0.0 ts=2003/8/9 11:25
   28k 2003/07/20 F:\cygwin\bin\cyggdbm-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-3.dll" v0.0 ts=2003/7/20 9:58
   30k 2003/08/11 F:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-4.dll" v0.0 ts=2003/8/11 4:12
   19k 2003/03/22 F:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/20 4:05
   15k 2003/07/20 F:\cygwin\bin\cyggdbm_compat-3.dll - os=4.0 img=1.0 
sys=4.0
                  "cyggdbm_compat-3.dll" v0.0 ts=2003/7/20 10:00
   15k 2003/08/11 F:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0 
sys=4.0
                  "cyggdbm_compat-4.dll" v0.0 ts=2003/8/11 4:13
   17k 2001/06/28 F:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/7 5:34
   29k 2003/08/10 F:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2003/8/11 1:16
   24k 2005/07/29 F:\cygwin\bin\cyghistory6.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory6.dll" v0.0 ts=2005/7/29 5:57
  991k 2004/07/06 F:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygiconv-2.dll" v0.0 ts=2004/7/6 20:10
   22k 2001/12/13 F:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 10:28
   37k 2003/08/10 F:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-2.dll" v0.0 ts=2003/8/10 23:50
   54k 2004/07/06 F:\cygwin\bin\cygintl-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-3.dll" v0.0 ts=2004/7/6 19:51
   21k 2001/06/20 F:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 19:09
   21k 2005/07/10 F:\cygwin\bin\cygmenu-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu-8.dll" v0.0 ts=2005/7/10 5:28
   26k 2001/04/25 F:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/25 7:27
   20k 2002/01/09 F:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/9 7:03
   29k 2003/08/09 F:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu7.dll" v0.0 ts=2003/8/9 11:25
   67k 2005/07/10 F:\cygwin\bin\cygncurses++-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++-8.dll" v0.0 ts=2005/7/10 5:29
  156k 2001/04/25 F:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/25 7:29
  175k 2002/01/09 F:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/9 7:03
  225k 2005/07/10 F:\cygwin\bin\cygncurses-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses-8.dll" v0.0 ts=2005/7/10 5:15
  226k 2001/04/25 F:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/25 7:17
  202k 2002/01/09 F:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/9 7:03
  224k 2003/08/09 F:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses7.dll" v0.0 ts=2003/8/9 11:24
   11k 2005/07/10 F:\cygwin\bin\cygpanel-8.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel-8.dll" v0.0 ts=2005/7/10 5:28
   15k 2001/04/25 F:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/25 7:27
   12k 2002/01/09 F:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/9 7:03
   19k 2003/08/09 F:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel7.dll" v0.0 ts=2003/8/9 11:24
   62k 2003/12/11 F:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre-0.dll" v0.0 ts=2003/12/11 18:01
   63k 2003/04/11 F:\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre.dll" v0.0 ts=2003/4/11 10:31
    9k 2003/12/11 F:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix-0.dll" v0.0 ts=2003/12/11 18:01
   61k 2003/04/11 F:\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix.dll" v0.0 ts=2003/4/11 10:31
   22k 2002/06/09 F:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpopt-0.dll" v0.0 ts=2002/6/9 7:45
  108k 2001/06/28 F:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/7 5:34
  148k 2003/08/10 F:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2003/8/11 1:16
  144k 2005/07/29 F:\cygwin\bin\cygreadline6.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline6.dll" v0.0 ts=2005/7/29 5:57
   60k 2005/07/09 F:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2005/7/9 4:27
 1265k 2005/07/03 F:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2005/7/3 2:30
    Cygwin DLL version info:
        DLL version: 1.5.18
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 132
        Shared data: 4
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix:
        Build date: Sat Jul 2 20:30:04 EDT 2005
        Shared id: cygwin1S4


Can't find the cygrunsrv utility, skipping services check.


Cygwin Package Information
Last downloaded files to: F:\Documents and Settings\Administrator\cygwin
Last downloaded files from: ftp://ftp.easynet.be/cygwin

Package              Version
_update-info-dir     00286-1
alternatives         1.3.20a-1
ash                  20040127-3
base-files           3.5-1
base-passwd          2.2-1
bash                 3.0-11
binutils             20050610-1
bzip2                1.0.3-1
coreutils            5.3.0-9
cygutils             1.2.9-1
cygwin               1.5.18-1
cygwin-doc           1.4-2
diffutils            2.8.7-1
editrights           1.01-1
findutils            20041227-1
gawk                 3.1.5-1
gcc                  3.4.4-1
gcc-core             3.4.4-1
gcc-g++              3.4.4-1
gcc-mingw-core       20050522-1
gcc-mingw-g++        20050522-1
gdbm                 1.8.3-7
grep                 2.5.1a-2
groff                1.18.1-2
gzip                 1.3.5-1
less                 381-1
libbz2_1             1.0.3-1
libcharset1          1.9.2-1
libgdbm              1.8.0-5
libgdbm-devel        1.8.3-7
libgdbm3             1.8.3-3
libgdbm4             1.8.3-7
libiconv             1.9.2-1
libiconv2            1.9.2-1
libintl              0.10.38-3
libintl1             0.10.40-1
libintl2             0.12.1-3
libintl3             0.14.1-1
libncurses5          5.2-1
libncurses6          5.2-8
libncurses7          5.3-4
libncurses8          5.4-2
libpcre              4.1-1
libpcre0             4.5-1
libpopt0             1.6.4-4
libreadline4         4.1-2
libreadline5         4.3-5
libreadline6         5.0-4
login                1.9-7
man                  1.5p-1
mingw-runtime        3.7-1
mktemp               1.5-3
ncurses              5.4-2
sed                  4.1.4-1
tar                  1.13.25-7
termcap              20050421-1
terminfo             5.4_20041009-1
texinfo              4.8-1
w32api               3.2-1
which                1.7-1
zlib                 1.2.2-2
Use -h to see help about each section

-- 
Stein Somers
Principal Software Engineer, Optical Solutions
OPNET Technologies bvba http://www.opnet.com/
Franklin Rooseveltlaan 348 W, B-9000 Gent, Belgium



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list