public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6771: no code emitted for locally unused class with dllexport attribute
@ 2002-11-25 14:36 Raoul Gough
0 siblings, 0 replies; 4+ messages in thread
From: Raoul Gough @ 2002-11-25 14:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/6771; it has been noted by GNATS.
From: "Raoul Gough" <raoulgough@clara.co.uk>
To: <gcc-gnats@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>,
<RaoulGough@yahoo.co.uk>
Cc:
Subject: Re: c++/6771: no code emitted for locally unused class with dllexport attribute
Date: Tue, 19 Nov 2002 13:05:19 -0000
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database
=gcc&pr=6771
This bug was already fixed in the mingw/cygwin branch. Building with,
for example, cygwin-mingw-gcc-3_2-branch (or 3_1 AFAIK) makes the
problem disappear. I guess the bug should be moved to the "closed"
state or equivalent.
Regards,
Raoul Gough.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/6771: no code emitted for locally unused class with dllexport attribute
@ 2003-05-01 16:56 Giovanni Bajo
0 siblings, 0 replies; 4+ messages in thread
From: Giovanni Bajo @ 2003-05-01 16:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/6771; it has been noted by GNATS.
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-gnats@gcc.gnu.org>,
<gcc-bugs@gcc.gnu.org>,
<nobody@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>,
<RaoulGough@yahoo.co.uk>
Cc:
Subject: Re: c++/6771: no code emitted for locally unused class with dllexport attribute
Date: Thu, 1 May 2003 18:53:23 +0200
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6771
I think it's again the usual regression in winnt.c (see pr/7910). The
problem appears to be fixed with 3.2 and a recent 3.3 CVS, but it causes an
ICE with 3.4 CVS 20030430. So I keep this as 3.4 ice-on-legal, in case it's
a slightly different issue.
Giovanni Bajo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: c++/6771: no code emitted for locally unused class with dllexport attribute
@ 2002-05-24 5:46 Raoul Gough
0 siblings, 0 replies; 4+ messages in thread
From: Raoul Gough @ 2002-05-24 5:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c++/6771; it has been noted by GNATS.
From: "Raoul Gough" <RaoulGough@yahoo.co.uk>
To: <gcc-gnats@gcc.gnu.org>,
<gcc-prs@gcc.gnu.org>,
<gcc-bugs@gcc.gnu.org>,
<nobody@gcc.gnu.org>
Cc:
Subject: Re: c++/6771: no code emitted for locally unused class with dllexport attribute
Date: Fri, 24 May 2002 13:45:30 +0100
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&p
r=6771
I have some more information regarding this dllexport problem (and
a quick and dirty fix for my system). I hope this is the right way to
submit additional information...
I've determined that the problematic member function (foofunction) is
having comdat_flag set (I believe erroneously) in decl2.c via the
import_export_decl function (called from finish_file in the first
deferred_fns loop). According the the comments in tree.h, comdat_flag
should be set for entities "guaranteed to be generated by any
translation unit that needs them, and therefore need not be put out
anywhere where they are not needed", which is clearly not the case
here (member function of a class with attribute dllexport). So I just
hacked the comdat_linkage function as follows, and the problem went
away :-)
/cygdrive/d/gcc/CVS/gcc/gcc/cp $ diff decl2.c~ decl2.c
2183c2183
< if (DECL_LANG_SPECIFIC (decl))
---
> if (DECL_LANG_SPECIFIC (decl) && !i386_pe_dllexport_p (decl))
(diff with decl2.c CVS:1.520.2.5)
This generates an "implicit declaration" warning, and is only suitable
for systems that use config/i386/winnt.c. I'm sure this is not the
right way to fix it, because comdat_linkage should probably never get
called on a dllexport'd member function - maybe a better fix would be
to clear DECL_DECLARED_INLINE_P at some stage?
I'm willing to spend some more time on this (and possibly any other
open bugs within my abilities), but would need a bit of advice on
producing a legitimate fix.
Regards,
Raoul Gough.
PS: I've upgraded via CVS to gcc_latest_snapshot (gcc_ss_20020521) and
the problem is unchanged. Also, setting the -fno-default-inline flag
fixes the problem for the export case, but crashes the compiler for
the import case:
/cygdrive/f/Users/Raoul/cxx $ /usr/local/bin/g++ -c
dllexport.cc -fno-default-inline -save-temps
dllexport.cc: In member function `void bar::barfunction()':
dllexport.cc:26: Internal compiler error in rest_of_compilation, at
toplev.c:
3478
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
This would otherwise be a temporary work-around for the original problem.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* c++/6771: no code emitted for locally unused class with dllexport attribute
@ 2002-05-22 10:16 RaoulGough
0 siblings, 0 replies; 4+ messages in thread
From: RaoulGough @ 2002-05-22 10:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 6771
>Category: c++
>Synopsis: no code emitted for locally unused class with dllexport attribute
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 22 10:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Raoul Gough
>Release: 3.0.4
>Organization:
>Environment:
Cygwin
>Description:
*locally* unused class with __attribute__(dllexport) does not emit any code. This is a problem because the corresponding __attribute__(dllimport) in the client module would leave unresolved externals during linking.
e.g.
namespace
{
int blah = 0;
};
struct __attribute__((dllexport)) foo
{
void foofunction () { ++blah; }
};
generates *no code* for foo::foofunction, but a client module with the corresponding __attribute__(dllimport) would require the code. e.g.:
struct __attribute__((dllimport)) bar
{
void barfunction () { };
};
void __attribute__((dllexport)) blahblah ()
{
bar b;
b.barfunction ();
}
Leaves an unresolved external bar::barfunction. My guess is that barfunction was not inlined because it is dllimport, whereas foofunction was not generated because it is erroneously expected to be inlined. gcc 2.95.3-5 (cygwin special) used to emit the required code.
>How-To-Repeat:
Don't try to link the attached code - it's cut down too far. Compile the example code with -save-temps and inspect the .s file for the absence of foofunction, and requirement for external barfunction.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-gzip-compressed; name="dllexport.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="dllexport.tar.gz"
H4sIAJfP6zwCA+1YbW/bNhD2VxnwfyDcDrCb6sWyYmfJPCB1vCRA6gRJmmX7QlAUbXOjJU2kHBtF
//uOsuzIRl7aYk2HQg9giHc8PjyeeEfKUyYlGTNpqbmqfCM4LcfpeF7FcZxWd9fJno7X0k+Ndsft
Vpyu13Xht+u5YO96rW4FOZUXQCoVSRCqXJIoFU/YfZAskZUfDq+RncrEFhElwvZ5aI93dpA5QyZF
gRBsHkeJsihFpiQzZio2jWWteslIwMMxkjGjEo2SaFpkEdy3x5Sa+sk7ex0zpiZdjO+AvG05lmdn
w2rVfhSO+DhNWIDuuJrsIxusgoTPmB1ogoxkOYKuTJFpspD4gpmChONU79wefUt3dmrV60kCbqFp
FDCxjyT4J1itChxoBm+ORyHKuGrVL/KVxrFjsTlMrCc0qY7OEcbHww/HGPfaS+H2Fh8NLi4H/cPr
wVGmGtz2BxfXp+fDq7XF4btTfDO4vAJlDxIiC/KSqX/PpIX3p8PzS1A596qLw+v+ydngZnAGek/r
b/c6uNcqtg7lQsL76YHvocqGDs/x6fDsdDjAOJOvro/6+OT8CpzEyyE0Tnu8vdeB5pTQCQ9ZLh7l
D4w3GjmRSkOGdbiKcsxCxdNpnES5VqoAQix6GBOlEu6nimHcaKw7MG42M0MaMPqAWaZeGX0u2edw
YS3oTdiYN7dN57lJYbXrCPT/OP79dNh2c/1SzIQ05PNMpxt591LHl2+luOd4SEUawI7iAU/ISLFk
o3dzFz5m/DUk9l3bJTF/jGvVvZH39wLntSofh1GiMz+MQjbnsDLYakDGqIqSBao/60L9P+DI/QQq
yA3Uv7jYTHDUgJyFfG6ixp4Dr+4tend1hOQiVGTefH764flwUPD21SrQdcuy6kgyktAJ0meGkmjC
ErZfsPkFbH592OaBDfCgUtdfc9Z+qm8rLE+a+oT+fUeS4Aur3paHD4v5e6hVB2GAotFq3QJian1p
laWtWKRyWWhHccKgilC4mcDRUNyAyPwn5QyKWwB1xieSbZ1Rq31gRoUO+XX7JBsD1X5rzKb7YGfQ
aBpzAZ76C5QN2hyiQ0EknFsqgUNTgZ4IcxQlU6I2/dzw+cXO/2IAv9P9z+l0vNX9rwOCvv+1u63y
/vcSsG1kvjGzW9N+drl5Y9aqtq1/6H0UpGIzx9Z9/SheJHw8UZBGTeQ6jouyCKL3FjqO0vFkbXkC
9QAqa9buLZG19Rgb7dquayTTsfEb5BCicIXTKbIcXKuGZMpkTCiUno+QR4hDrfYFmaAecg5q1U8H
2kiqJKUKbR3ka6/hQB9FUU4wi3igxVEaUj0RajTRR7Szo0kP0KdnKfk0p/RJUqQEcZPy09q9rP8J
5/TU2ZoazZwRyJB/kLWsTWJNWqt+m/zn/Hvlv7fbXn//eW57mf/l99+L4BVquaheTPF6mXbfPu3+
N3iJO8dz+d/tONv573rl+f8iMKwRHLxGvXgOQAWwxiLyBeTPn0P3Z3x8dv7u8AzjIS6anZ38dXtD
PJ1EA7gHWwFRRD+JgG8s5NWqnz16Xw8TUTg2HN1SbK7uiVqdojt7q7ydZVOykbGhPDAsSYXhwlMt
Yma0dYuFYJe5c2+op4xTORHGT8yPQZhGM92W8VuUa2TqC+P1npblvdxy1wrBiDDMVkPbN7WWzAus
maD/mjDeYAwFDOtwtKGwtFqF6jLQ6yBBoJk7a+bcGT9ea+IoXruasCw8ki3rkxXoj9cZ01UPgiYp
fCjVkbmM9H5x0fUftIiVKFGiRIkSJUqUKFGiRIkSJUqUeBT/AhFcMZ8AKAAA
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-05-01 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-25 14:36 c++/6771: no code emitted for locally unused class with dllexport attribute Raoul Gough
-- strict thread matches above, loose matches on Subject: below --
2003-05-01 16:56 Giovanni Bajo
2002-05-24 5:46 Raoul Gough
2002-05-22 10:16 RaoulGough
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).