(1.1b/x86-win32) C++ bug in taking address of dllimported variable
Mumit Khan
khan@xraylith.wisc.edu
Tue Oct 6 02:11:00 GMT 1998
EGCS 1.1 C++ x86-*win32 front-end chokes on the following code (defining
AVOID_BUG works around it, but that's awkward for lot of existing code):
struct
#ifdef AVOID_BUG
__attribute__((dllimport))
#endif
B { };
__attribute__((dllimport)) B p;
void
foo ()
{
B* localp = &p; // <<<<<< DIES HERE.
}
The call-tree leading up to the crash is the following:
yyparse
build_x_unary_op
build_new_op
lookup_function_nonclass
lookup_arg_dependent
arg_assoc_args
arg_assoc <<< BEGINNING OF TROUBLE (TREE_TYPE)
arg_assoc_type
arg_assoc_class
decl_namespace <<<< CRASH
The trouble is that TREE_TYPE in ``arg_assoc' is not returning what's
expected, and eventually we get a crash.
NOTE: This does not happen with development snapshots, and I'd like
to of course figure what changed to fix this and hopefully get that
in the release branch.
I've attached the following:
c++dllimp.ii -- preprocessed
gdb.run -- gdb trace using egcs-1.1 with lots of detail
gdb.run-new -- gdb trace using recent development snapshot
that shows the different return value of
TREE_TYPE (n).
Regards,
Mumit
More information about the Gcc-bugs
mailing list