Bug 3053 – cross imports produce repeated calls to a call destructor

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-06-05T16:35:00Z
Last change time
2014-11-13T10:38:43Z
Keywords
wrong-code
Assigned to
nobody
Creator
brauningbar

Attachments

IDFilenameSummaryContent-TypeSize
394ttttt.tar.gzpackage recreating the bugapplication/x-gzip463

Comments

Comment #0 by brauningbar — 2009-06-05T16:35:43Z
Created attachment 394 package recreating the bug Having a crossed imports between thre files of a personal project causes the destructor of a class to get called REPEATED times. Tried various compiler switches but no fix. When i compile with -unittest dtor gets called even more times (like 6 times or even 9!) The attached contains the files stripped with the bug, and a simple makefile The compiler version i've tried was 2.030, i've tried with 2.019 and the dtor calls were less than the former
Comment #1 by clugdbug — 2010-12-16T16:28:09Z
Cannot reproduce on Windows. Tried several compiler versions, including 2.030 and 2.050. Compiled with noflags, and with -O, -unittest. Tried compiling obj files seperately. Tried all 6 combinations of ordering on the command line. In every case, there was only one destructor call. Can someone reproduce this on Linux?
Comment #2 by brauningbar — 2010-12-21T18:19:38Z
(In reply to comment #1) > Cannot reproduce on Windows. Tried several compiler versions, including 2.030 > and 2.050. > Compiled with noflags, and with -O, -unittest. Tried compiling obj files > seperately. Tried all 6 combinations of ordering on the command line. > In every case, there was only one destructor call. > > Can someone reproduce this on Linux? THIS IS A SESSION SHOWING THE BUG in linux. The 2.050 doesn't emit bug but 2.039. I hope this is util ---------------------------------------------------------- solved> cd ttttt ttttt> ls expresion.d makefile newdawk.d programa.d ttttt> dmd | head -1 Digital Mars D Compiler v2.050 ttttt> make dmd -ofnewdawk *.d ttttt> newdawk dtor ttttt> cd ../ttttt_on_dmd2.039/ ttttt_on_dmd2.039> make ~/comp/D/dmd2.039/linux/bin/dmd -ofnewdawk *.d deferring sigaction_t ttttt_on_dmd2.039> newdawk dtor dtor dtor dtor dtor dtor ttttt_on_dmd2.039> ls expresion.d makefile newdawk newdawk.d newdawk.o programa.d ttttt_on_dmd2.039> cat newdawk.d import programa; void main() { auto prog = new Programa(); } ttttt_on_dmd2.039> cat programa.d import std.stdio; import expresion; class Programa { Function fun; ~this() { writefln("dtor"); } } ttttt_on_dmd2.039> cat expresion.d import programa; struct Function { } ttttt_on_dmd2.039> ttttt_on_dmd2.039> make clean rm newdawk *.o ; true ttttt_on_dmd2.039> grep ARGS= makefile DARGS= ttttt_on_dmd2.039> vi makefile skipping 15 old session files reading makefile wrote makefile, 11 lines, 139 chars ttttt_on_dmd2.039> grep ARGS= makefile DARGS=-unittest ttttt_on_dmd2.039> make ~/comp/D/dmd2.039/linux/bin/dmd -unittest -ofnewdawk *.d deferring sigaction_t ttttt_on_dmd2.039> newdawk dtor dtor dtor dtor dtor dtor dtor dtor dtor dtor dtor dtor dtor dtor ttttt_on_dmd2.039> ttttt_on_dmd2.039> cat /etc/slackware-version Slackware 13.1.0 ttttt_on_dmd2.039> gcc --version gcc (GCC) 4.4.4 Copyright (C) 2010 Free Software Foundation, Inc. Esto es software libre; vea el código para las condiciones de copia. NO hay garantía; ni siquiera para MERCANTIBILIDAD o IDONEIDAD PARA UN PROPÓSITO EN PARTICULAR ttttt_on_dmd2.039> ld --version GNU ld (Linux/GNU Binutils) 2.20.51.0.8.20100412 Copyright 2010 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) a later version. This program has absolutely no warranty. ttttt_on_dmd2.039> uname -a Linux slackweiller 2.6.33.4-MEMOPRESARIO #14 SMP Mon Nov 15 01:13:57 AKST 2010 i686 AMD Sempron(tm) SI-42 AuthenticAMD GNU/Linux
Comment #3 by bugzilla — 2014-11-13T10:38:43Z
Since this works on 2.050 and fails on 2.039, I presume it is fixed.