public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: gcc 3.4.4 bug
@ 2005-07-25 21:37 Danny Smith
2005-07-27 16:01 ` John M. Gravley
0 siblings, 1 reply; 3+ messages in thread
From: Danny Smith @ 2005-07-25 21:37 UTC (permalink / raw)
To: john.gravley; +Cc: gcc-bugs, Gerrit Haase
> I have found an apparent bug in gcc 3.4.4 under Cygwin. The attached test case (and the code
> it's derived from) works as expected with Cygwin gcc 3.3.3 with the exact same Cygwin install
> except the compiler packages. It also works fine with various versions of gcc on other
> platforms, including 3.4.2 (FC3) and 4.0 (FC4).
Here is the reason:
When linking against the dll, you are notified:
Info: resolving typeinfo for base_t by linking to __imp___ZTI6base_t (auto-import)
typeinfo tables are readonly and so place in .rdata section.
Auto-import doesn't work for .rdata because it depends on the linker writing a thunk to
dereference the *__imp__foo. It gets away with this trickery for non-constant data by "casting"
the .text section writeable. But the loader really does expect the contents of .rdata section to
be non-writeable. If you lie to it, bad things happen.
If we put readonly data in text section (as we did in gcc-3.3.x) then your testcase should work.
It will also work if you don't use auto-import and explicitly mark the dllimport'd base_t class
with __attribute__ ((dllimport)).
Danny
Send instant messages to your online friends http://au.messenger.yahoo.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: gcc 3.4.4 bug
2005-07-25 21:37 gcc 3.4.4 bug Danny Smith
@ 2005-07-27 16:01 ` John M. Gravley
0 siblings, 0 replies; 3+ messages in thread
From: John M. Gravley @ 2005-07-27 16:01 UTC (permalink / raw)
To: dannysmith; +Cc: gcc-bugs, Gerrit Haase
Danny,
I don't get the auto_import message when I build the test case.
I'm also confused as to why reordering the calls makes the test case
work if the problem is as you describe it.
John
Danny Smith wrote:
>>I have found an apparent bug in gcc 3.4.4 under Cygwin. The attached test case (and the code
>>it's derived from) works as expected with Cygwin gcc 3.3.3 with the exact same Cygwin install
>>except the compiler packages. It also works fine with various versions of gcc on other
>>platforms, including 3.4.2 (FC3) and 4.0 (FC4).
>
>
>
> Here is the reason:
>
> When linking against the dll, you are notified:
> Info: resolving typeinfo for base_t by linking to __imp___ZTI6base_t (auto-import)
>
> typeinfo tables are readonly and so place in .rdata section.
>
> Auto-import doesn't work for .rdata because it depends on the linker writing a thunk to
> dereference the *__imp__foo. It gets away with this trickery for non-constant data by "casting"
> the .text section writeable. But the loader really does expect the contents of .rdata section to
> be non-writeable. If you lie to it, bad things happen.
>
> If we put readonly data in text section (as we did in gcc-3.3.x) then your testcase should work.
>
> It will also work if you don't use auto-import and explicitly mark the dllimport'd base_t class
> with __attribute__ ((dllimport)).
>
> Danny
>
> Send instant messages to your online friends http://au.messenger.yahoo.com
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* gcc 3.4.4 bug
@ 2005-07-25 18:18 John M. Gravley
0 siblings, 0 replies; 3+ messages in thread
From: John M. Gravley @ 2005-07-25 18:18 UTC (permalink / raw)
To: gcc-bugs; +Cc: gerrit
[-- Attachment #1: Type: text/plain, Size: 2172 bytes --]
I have found an apparent bug in gcc 3.4.4 under Cygwin. The attached
test case (and the code it's derived from) works as expected with Cygwin
gcc 3.3.3 with the exact same Cygwin install except the compiler
packages. It also works fine with various versions of gcc on other
platforms, including 3.4.2 (FC3) and 4.0 (FC4).
The test case is all of the files in the attached
gcc-3.4.4-bug-test-case.tar.gz. I sent the sample instead of the
preprocessed files because the bug only presents itself when the base
class code is in a library. If you include it in the main file or just
link it in as a .o, the code works fine.
This is probably isn't an absolute minimal test case, but it's not far off.
I have included cygcheck.out.gz as per Cygwin bug reporting instructions
in case it's needed/wanted. I gzipped it to avoid the verbosity in the
message for those who don't care.
I submitted this to the cygwin mailing list and was asked to report it
as a gcc bug. I looked at entering it into the bugzilla database, but I
didn't see a way to easily give you this type of test case using that
mechanism.
Please let me know if I have misssed some needed information.
John
gcc version (results of gcc -v)
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose
--prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--enable-languages=c,ada,c++,d,f77,java,objc --enable-nls
--without-included-gettext --enable-version-specific-runtime-libs
--without-x --enable-libgcj --disable-java-awt --with-system-zlib
--enable-interpreter --disable-libgcj-debug --enable-threads=posix
--enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions
--enable-hash-synchronization --enable-libstdcxx-debug : (reconfigured)
Thread model: posix
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
system (results of uname -a)
CYGWIN_NT-5.0 trivia 1.5.17(0.129/4/2) 2005-05-25 19:38 i686 unknown
unknown Cygwin
command line (see Makefile and baselib.mak)
There are no compiler warnings or errors.
[-- Attachment #2: cygcheck.out.gz --]
[-- Type: application/gzip, Size: 7904 bytes --]
[-- Attachment #3: gcc-3.4.4-bug-test-case.tar.gz --]
[-- Type: application/gzip, Size: 2140 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-07-27 15:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25 21:37 gcc 3.4.4 bug Danny Smith
2005-07-27 16:01 ` John M. Gravley
-- strict thread matches above, loose matches on Subject: below --
2005-07-25 18:18 John M. Gravley
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).