Bug 5287 - [3.3/3.4 regression] [mingw/cygwin] ICE with dllimport (two other testcases)
[3.3/3.4 regression] [mingw/cygwin] ICE with dllimport (two other testcases)
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
3.0.3
: P3 normal
: 3.3.1
Assigned To: Danny Smith
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-01-06 02:26 UTC by vladakk
Modified: 2004-01-17 04:22 UTC (History)
2 users (show)

See Also:
Host: i686-pc-cygwin
Target: i386-pc-mingw32
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed: 2003-05-31 07:42:10


Attachments
gcc-bug-mingw.zip (133.71 KB, application/x-zip )
2003-05-21 15:17 UTC, vladakk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vladakk 2002-01-06 02:26:00 UTC
Got an internal compiler error.

Release:
3.0.3

Environment:
Win98, Cygwin, Mingw
System: CYGWIN_98-4.10 VLADA 1.3.3s(0.40/3/2) 2001-07-04 23:55 i586 unknown
Architecture: i686
host: i686-pc-cygwin
build: i686-pc-cygwin
target: i386-pc-mingw32
configured with: ../gcc-3.0.3/configure --verbose --enable-threads=win32 --with-system-zlib --disable-nls --disable-shared --enable-static --with-gnu-as --with-gnu-ld --program-prefix=new- --enable-languages=c,c++ --disable-libgcj --disable-checking --enable-sjlj-exceptions --host=i686-pc-cygwin --enable-haifa --target=mingw32 --srcdir=/usr/local/gcc-3.0.3 --prefix=/usr/local/gcc-3.0.3-cygwin-mingw32/install-mingw
Comment 1 Dara Hazeghi 2003-05-09 01:52:22 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org, vladakk@eunet.yu
Cc:  
Subject: Re: target/5287: [MINGW] g++: Internal error: Segmentation fault
Date: Fri, 9 May 2003 01:52:22 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=5287
 
 Hello,
 
 can the submitter of this report please confirm whether this problem  
 still occurs with more current versions of gcc (ie 3.2.3). Thanks,
 
 Dara
 
Comment 2 Wolfgang Bangerth 2003-05-09 15:22:57 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: See Dara's question
Comment 3 Dara Hazeghi 2003-05-31 01:14:20 UTC
Hello,

with gcc 3.2.3 and 3.3 branch (20030530), I can confirm that this problem is still present. Would it 
be possible for you to provide instructions as to where this file comes from, and how you built it, 
so that we can check gcc mainline (the new c++ parser not only fixes a lot of bugs, it also doesn't 
like the preprocessed source you sent.)? Thanks,

Dara
Comment 4 Giovanni Bajo 2003-05-31 07:42:10 UTC
This is the reduction of the preprocessed source:

---------------------------------------------
struct A
{
    virtual void vfunc(void);
};

struct __attribute__((dllimport)) B : public A
{
    void vfunc(void);
};

struct C : public B 
{
    C();
};

C::C()
{}
---------------------------------------------
pr5287.cpp:17: internal compiler error: Segmentation fault
Please submit a full bug report,

Confirmed up to mainline (20030503). This is the usual regression in winnt.c 
with dllimport (Danny Smith is submitting patches for this, so I'll check that 
this very testcase will be covered as well).

With a small change, there is a different kind of ICE:

---------------------------------------------
struct A
{
    virtual void vfunc(void);
};

struct __attribute__((dllimport)) B : public A
{
    void vfunc(void);

	B();
};

B::B()
{}
---------------------------------------------
pr5287.cpp: In constructor `B::B()':
pr5287.cpp:14: internal compiler error: in rest_of_compilation, at toplev.c:3706
Please submit a full bug report,

But I believe the bug to be the same. Given this reduction, we don't need 
feedback from the original poster anymore, thanks.
Comment 5 Giovanni Bajo 2003-06-04 02:39:37 UTC
Danny, you may want to look into this. It still ICEs as of today mainline and 
3.3 branch (20030604).
Comment 6 CVS Commits 2003-07-04 07:42:19 UTC
Subject: Bug 5287

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dannysmith@gcc.gnu.org	2003-07-04 07:42:11

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : extend.texi 
	gcc/config/i386: winnt.c 

Log message:
	PR c++/5287, PR c++/7910,  PR c++/11021
	* config/i386/winnt.c (ix86_handle_dll_attribute): Don't add
	dllimport attribute if function is defined at declaration, but
	report error instead. Likewise for dllimport'd variable
	definitions.  Set implicit TREE_PUBLIC for dllimport'd variables
	declared within functions, Report error if dllimport or dllexport
	symbol is not global.
	(i386_pe_dllimport_p): Ignore dllimport attribute of functions
	if defined after declaration or if inlined. Don't allow definition
	of static data members of C++ classes. Don't dllimport virtual
	methods.
	(i386_pe_mark_dllexport): Warn about inconsistent dll attributes.
	(i386_pe_mark_dllimport): Remove unnecessary checks.
	(i386_pe_encode_section_info): Warn if the dllimport attribute
	and symbol prefix have been instantiated and then overridden.
	
	* doc/extend.texi: Document dllimport and dllexport attributes.
	
	* config/i386/winnt.c (i386_pe_output_labelref): Fix indents.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.325&r2=2.326
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.146&r2=1.147
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/winnt.c.diff?cvsroot=gcc&r1=1.48&r2=1.49

Comment 7 CVS Commits 2003-07-04 07:52:42 UTC
Subject: Bug 5287

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dannysmith@gcc.gnu.org	2003-07-04 07:52:38

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/ext: dllimport1.C dllimport2.C dllimport3.C 
Added files:
	gcc/testsuite/g++.dg/ext: dllexport1.C dllimport10.C 
	                          dllimport4.C dllimport5.C dllimport6.C 
	                          dllimport7.C dllimport8.C dllimport9.C 

Log message:
	PR c++/5287, PR c++/7910,  PR c++/11021
	* testsuite/g++.dg/ext/dllimport1.C: Add mingw32 as target. Add
	tests for warnings.
	* testsuite/g++.dg/ext/dllimport2.C: Add tests for warnings.
	* testsuite/g++.dg/ext/dllimport3.C: Likewise.
	* testsuite/g++.dg/ext/dllimport4.C: New file.
	* testsuite/g++.dg/ext/dllimport5.C: New file.
	* testsuite/g++.dg/ext/dllimport6.C: New file.
	* testsuite/g++.dg/ext/dllimport7.C: New file.
	* testsuite/g++.dg/ext/dllimport8.C: New file.
	* testsuite/g++.dg/ext/dllimport9.C: New file.
	* testsuite/g++.dg/ext/dllimport10.C: New file.
	* testsuite/g++.dg/ext/dllexport1.C: New file.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2839&r2=1.2840
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllexport1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport10.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport5.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport8.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport9.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport2.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport3.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 8 CVS Commits 2003-07-11 11:54:36 UTC
Subject: Bug 5287

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	dannysmith@gcc.gnu.org	2003-07-11 11:54:29

Modified files:
	gcc            : ChangeLog c-decl.c 
	gcc/doc        : extend.texi 
	gcc/config/i386: winnt.c 

Log message:
	Backport from mainline.
	
	2003-05-13  Richard Henderson  <rth@redhat.com>
	
	* c-decl.c (duplicate_decls): Re-invoke make_decl_rtl if
	the old decl had instantiated DECL_RTL.
	
	2003-05-21  Danny Smith  <dannysmith@users.sourceforge.net>
	
	PR c++/9738
	* config/i386/winnt.c (i386_pe_encode_section_info): Enable
	even if not first.
	
	2003-07-04  Danny Smith  <dannysmith@users.sourceforge.net>
	
	PR c++/5287, PR c++/7910, PR c++/11021
	* config/i386/winnt.c (ix86_handle_dll_attribute): Don't add
	dllimport attribute if function is defined at declaration, but
	report error instead. Likewise for dllimport'd variable
	definitions.  Set implicit TREE_PUBLIC for dllimport'd variables
	declared within functions, Report error if dllimport or dllexport
	symbol is not global.
	(i386_pe_dllimport_p): Ignore dllimport attribute of functions
	if defined after declaration or if inlined. Don't allow definition
	of static data members of C++ classes. Don't dllimport virtual
	methods.
	(i386_pe_mark_dllexport): Warn about inconsistent dll attributes.
	(i386_pe_mark_dllimport): Remove unnecessary checks.
	(i386_pe_encode_section_info): Warn if the dllimport attribute
	and symbol prefix have been instantiated and then overridden.
	
	* doc/extend.texi: Document dllimport and dllexport attributes.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.649&r2=1.16114.2.650
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.356.2.10&r2=1.356.2.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.109.2.18&r2=1.109.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/winnt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.37.2.3&r2=1.37.2.4

Comment 9 CVS Commits 2003-07-11 12:14:48 UTC
Subject: Bug 5287

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	dannysmith@gcc.gnu.org	2003-07-11 12:14:43

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/testsuite/g++.dg/ext: dllimport1.C 
Added files:
	gcc/testsuite/g++.dg/ext: dllexport1.C dllimport10.C 
	                          dllimport2.C dllimport3.C dllimport4.C 
	                          dllimport5.C dllimport6.C dllimport7.C 
	                          dllimport8.C dllimport9.C 

Log message:
	Backport from mainline.
	
	2003-05-21  Danny Smith  <dannysmith@users.sourceforge.net>
	
	PR c++/9738
	* g++.dg/ext/dllimport2.C: New file.
	* g++.dg/ext/dllimport3.C: New file.
	
	2003-07-04  Danny Smith  <dannysmith@users.sourceforge.net>
	
	PR c++/5287, PR c++/7910,  PR c++/11021
	* testsuite/g++.dg/ext/dllimport1.C: Add mingw32 as target. Add
	tests for warnings.
	* g++.dg/ext/dllimport2.C: Add tests for warnings.
	* g++.dg/ext/dllimport3.C: Likewise.
	* g++.dg/ext/dllimport4.C: New file.
	* g++.dg/ext/dllimport5.C: New file.
	* g++.dg/ext/dllimport6.C: New file.
	* g++.dg/ext/dllimport7.C: New file.
	* g++.dg/ext/dllimport8.C: New file.
	* g++.dg/ext/dllimport9.C: New file.
	* g++.dg/ext/dllimport10.C: New file.
	* g++.dg/ext/dllexport1.C: New file.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.227&r2=1.2261.2.228
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllexport1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport10.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.2.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport4.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport5.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport6.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport7.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport8.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport9.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/dllimport1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1.2.1&r2=1.1.2.2

Comment 10 Dara Hazeghi 2003-07-11 14:33:40 UTC
Fixed with Danny's patch (confirmed).