c++/6771: no code emitted for locally unused class with dllexport attribute
RaoulGough@yahoo.co.uk
RaoulGough@yahoo.co.uk
Wed May 22 10:16:00 GMT 2002
>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
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