* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
@ 2004-04-01 12:09 ` pinskia at gcc dot gnu dot org
2004-04-05 21:59 ` dannysmith at users dot sourceforge dot net
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-01 12:09 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Summary|Undefined results with |[3.4/3.5 Regression] [win32]
|virtual base classes |Undefined results with
| |virtual base classes
Target Milestone|--- |3.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
2004-04-01 12:09 ` [Bug c++/14808] [3.4/3.5 Regression] [win32] " pinskia at gcc dot gnu dot org
@ 2004-04-05 21:59 ` dannysmith at users dot sourceforge dot net
2004-04-07 21:02 ` dannysmith at users dot sourceforge dot net
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-04-05 21:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dannysmith at users dot sourceforge dot net 2004-04-05 21:59 -------
Hello
I suspect that this bug is due to the way that the PE-COFF emulation of
GNU ld handles linkonce sections. Specifically, ld does not reliably
handle linkonce sections contining more than one global symbol. For
example, this assembler code also produces a faulting app:
.file "bar2.c"
.def ___main; .scl 2; .type 32; .endef
.text
.align 2
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $16, %eax
call __alloca
call ___main
call __Z3onev
call __Z8call_onev
leave
.p2align 4,,4
ret
.section .text$_Z8call_onev,"x"
.linkonce discard
.align 2
.globl __Z8call_onev
.def __Z8call_onev; .scl 2; .type 32; .endef
__Z8call_onev:
subl $12, %esp
call __Z3onev
addl $12, %esp
ret
# .section .text$_Z3onev,"x"
# .linkonce discard
.align 2
.globl __Z3onev
.def __Z3onev; .scl 2; .type 32; .endef
__Z3onev:
movl $1, %eax
ret
but is okay if I put the the the two functions in separate .linkonce sections,
Referring to the testcase in my first comments for this PR, if the
virtual function in the derived class is not inlined, and so does not
use linkonce semantics, then the app built from the modified testcase
executes correctly. Likewise, if I comment out this code in cp/method,c
(use_thunk)
*** method.c.orig Mon Apr 05 21:49:30 2004
--- method.c Mon Apr 05 00:41:59 2004
*************** use_thunk (tree thunk_fndecl, bool emit_
*** 409,416 ****
--- 409,418 ----
if (DECL_SECTION_NAME (function) != NULL && DECL_ONE_ONLY (function))
{
resolve_unique_section (thunk_fndecl, 0, flag_function_sections);
+ #if !(defined (__MINGW32__ ) || defined (__CYGWIN__))
/* Output the thunk into the same section as function. */
DECL_SECTION_NAME (thunk_fndecl) = DECL_SECTION_NAME (function);
+ #endif
}
}
#endif
the app is okay.
But, as indicated by Jakub when the local aliases for virtual thunks code was
introduced
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg02603.html
"If a method is emitted in a linkonce section, it will emit the thunk into
the same linkonce section as well, since local symbols in linkonce sections
cannot be safely accessed from other sections."
this is not really a safe thing to do.
Should _all_ the make_alias_for_thunk code in method.c be guarded by a
target macro (e.g. TARGET_USE_LOCAL_ALIAS_FOR_VTHUNK), which defaults to
1 #ifdef ASM_OUTPUT_DEF, but can be overriden by targets which define
ASM_OUTPUT_DEF, but may currently have problems with multiple globals in
linkonce sections?
Danny
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
2004-04-01 12:09 ` [Bug c++/14808] [3.4/3.5 Regression] [win32] " pinskia at gcc dot gnu dot org
2004-04-05 21:59 ` dannysmith at users dot sourceforge dot net
@ 2004-04-07 21:02 ` dannysmith at users dot sourceforge dot net
2004-04-07 21:34 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-04-07 21:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dannysmith at users dot sourceforge dot net 2004-04-07 21:02 -------
Patch submitted:
http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00432.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (2 preceding siblings ...)
2004-04-07 21:02 ` dannysmith at users dot sourceforge dot net
@ 2004-04-07 21:34 ` pinskia at gcc dot gnu dot org
2004-04-07 22:11 ` mmitchel at gcc dot gnu dot org
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-07 21:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-07 21:34 -------
Confirmed I know this is too close but still I think this should be fixed for 3.4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |mmitchel at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |patch
Last reconfirmed|0000-00-00 00:00:00 |2004-04-07 21:34:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (3 preceding siblings ...)
2004-04-07 21:34 ` pinskia at gcc dot gnu dot org
@ 2004-04-07 22:11 ` mmitchel at gcc dot gnu dot org
2004-04-08 21:23 ` mmitchel at gcc dot gnu dot org
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-04-07 22:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-04-07 22:11 -------
The patch is OK for the mainline.
On the 3.4.0 branch, it is *not* OK.
Instead, please submit an uglier, but safer, patch that tests for __CYGWIN__ and
__MINGW32__ in the same place where the mainline patch checks the new target macro.
In other words:
#if defined (ASM_OUTPUT_DEF) && !defined(__CYGWIN__) && !...
alias version
#else
non-alias version
#endif
Please attach that patch to the PR after testing.
I will then approve it for 3.4.0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (4 preceding siblings ...)
2004-04-07 22:11 ` mmitchel at gcc dot gnu dot org
@ 2004-04-08 21:23 ` mmitchel at gcc dot gnu dot org
2004-04-08 22:16 ` cvs-commit at gcc dot gnu dot org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-04-08 21:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-04-08 21:23 -------
This patch is OK for 3.4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.1 |3.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (5 preceding siblings ...)
2004-04-08 21:23 ` mmitchel at gcc dot gnu dot org
@ 2004-04-08 22:16 ` cvs-commit at gcc dot gnu dot org
2004-04-08 22:31 ` cvs-commit at gcc dot gnu dot org
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-08 22:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-04-08 22:16 -------
Subject: Bug 14808
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: dannysmith@gcc.gnu.org 2004-04-08 22:16:01
Modified files:
gcc/cp : ChangeLog method.c
Log message:
PR c++/14808
* method.c (make_alias_for_thunk): Just return function decl
for one_only functions if __CYGWIN__ or __MINGW32__
(use_thunk): Don't put function and thunk in same one_only
section if __CYGWIN__ or __MINGW32__.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.95&r2=1.3892.2.96
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.275.4.2&r2=1.275.4.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (6 preceding siblings ...)
2004-04-08 22:16 ` cvs-commit at gcc dot gnu dot org
@ 2004-04-08 22:31 ` cvs-commit at gcc dot gnu dot org
2004-04-08 22:35 ` dannysmith at users dot sourceforge dot net
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-04-08 22:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-04-08 22:31 -------
Subject: Bug 14808
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: dannysmith@gcc.gnu.org 2004-04-08 22:31:23
Modified files:
gcc : ChangeLog defaults.h
gcc/config/i386: cygming.h
gcc/cp : ChangeLog method.c
gcc/doc : tm.texi
Log message:
PR c++/14808
* defaults.h (TARGET_USE_LOCAL_THUNK_ALIAS_P): New macro. Default
to 1 if ASM_OUTPUT_DEF is defined.
* doc/tm.texi (TARGET_USE_LOCAL_THUNK_ALIAS_P): Document.
* config/i386/cygming.h (TARGET_USE_LOCAL_THUNK_ALIAS_P): Define.
Set to non-zero iff not a one_only decl.
* cp/method.c (use_thunk): Test TARGET_USE_LOCAL_THUNK_ALIAS_P rather
than ASM_OUTPUT_DEF.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3367&r2=2.3368
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/defaults.h.diff?cvsroot=gcc&r1=1.132&r2=1.133
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/cygming.h.diff?cvsroot=gcc&r1=1.13&r2=1.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4030&r2=1.4031
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&r1=1.279&r2=1.280
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/tm.texi.diff?cvsroot=gcc&r1=1.317&r2=1.318
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (7 preceding siblings ...)
2004-04-08 22:31 ` cvs-commit at gcc dot gnu dot org
@ 2004-04-08 22:35 ` dannysmith at users dot sourceforge dot net
2004-06-07 12:16 ` dank at kegel dot com
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2004-04-08 22:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dannysmith at users dot sourceforge dot net 2004-04-08 22:35 -------
Fixed on 3.4.0 and trunk
Danny
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (8 preceding siblings ...)
2004-04-08 22:35 ` dannysmith at users dot sourceforge dot net
@ 2004-06-07 12:16 ` dank at kegel dot com
2004-06-07 14:29 ` mark at codesourcery dot com
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: dank at kegel dot com @ 2004-06-07 12:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dank at kegel dot com 2004-06-07 12:15 -------
Turns out this patch may have caused cygwin->linux crossbuilds to
fail, since in that case __CYGWIN__ is defined even though the
target isn't cygwin. The symptom is
strstream.s:8390: Error: junk `(%ecx)' after expression
when building libstdc++.
See http://gcc.gnu.org/ml/gcc/2004-06/msg00429.html for a patch
that lets my builds finish.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (9 preceding siblings ...)
2004-06-07 12:16 ` dank at kegel dot com
@ 2004-06-07 14:29 ` mark at codesourcery dot com
2004-06-08 6:31 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: mark at codesourcery dot com @ 2004-06-07 14:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mark at codesourcery dot com 2004-06-07 14:29 -------
Subject: Re: [3.4/3.5 Regression] [win32] Undefined results
with virtual base classes
dank at kegel dot com wrote:
> ------- Additional Comments From dank at kegel dot com 2004-06-07 12:15 -------
> Turns out this patch may have caused cygwin->linux crossbuilds to
> fail, since in that case __CYGWIN__ is defined even though the
> target isn't cygwin. The symptom is
> strstream.s:8390: Error: junk `(%ecx)' after expression
> when building libstdc++.
> See http://gcc.gnu.org/ml/gcc/2004-06/msg00429.html for a patch
> that lets my builds finish.
This patch is fine for 3.4.1; please check it in.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (10 preceding siblings ...)
2004-06-07 14:29 ` mark at codesourcery dot com
@ 2004-06-08 6:31 ` cvs-commit at gcc dot gnu dot org
2004-06-08 6:33 ` wilson at specifixinc dot com
2004-06-16 22:59 ` cvs-commit at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-08 6:31 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-06-08 06:31 -------
Subject: Bug 14808
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: wilson@gcc.gnu.org 2004-06-08 06:30:33
Modified files:
gcc : ChangeLog
gcc/config/i386: cygwin.h cygming.h
gcc/cp : ChangeLog method.c
Log message:
Patch from Dan Kegel.
PR c++/14808
* config/i386/cygwin.h (TARGET_IS_PE_COFF): New.
* config/i386/cygming.h (TARGET_IS_PE_COFF): New.
* method.c (make_alias_for_thunk, use_thunk): Use TARGET_IS_PE_COFF
instead of __CYWGIN__ and __MINGW32__.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.477&r2=2.2326.2.478
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/cygwin.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.85&r2=1.85.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/cygming.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.11.4.1&r2=1.11.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.117&r2=1.3892.2.118
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/method.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.275.4.3&r2=1.275.4.4
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (11 preceding siblings ...)
2004-06-08 6:31 ` cvs-commit at gcc dot gnu dot org
@ 2004-06-08 6:33 ` wilson at specifixinc dot com
2004-06-16 22:59 ` cvs-commit at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: wilson at specifixinc dot com @ 2004-06-08 6:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From wilson at specifixinc dot com 2004-06-08 06:33 -------
Subject: Re: [3.4/3.5 Regression] [win32] Undefined results
with virtual base classes
mark at codesourcery dot com wrote:
> This patch is fine for 3.4.1; please check it in.
Dan Kegel isn't in the MAINTAINERS file. I checked in the patch. I had
to apply it by hand. (Dan: please use MIME attachments for patches.)
Because the patch is small, and is essentially what I suggested, I don't
believe any copyright assignment is needed.
In addition to fixing cygwin-x-linux cross compilers, this will also fix
linux-x-cygwin cross compilers. We have had a number of bugs reported
against the latter, but I don't think anyone ever tried to track down
the problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/14808] [3.4/3.5 Regression] [win32] Undefined results with virtual base classes
2004-04-01 9:05 [Bug c++/14808] New: Undefined results with virtual base classes dannysmith at users dot sourceforge dot net
` (12 preceding siblings ...)
2004-06-08 6:33 ` wilson at specifixinc dot com
@ 2004-06-16 22:59 ` cvs-commit at gcc dot gnu dot org
13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-16 22:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-06-16 22:59 -------
Subject: Bug 14808
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: wilson@gcc.gnu.org 2004-06-16 22:59:42
Modified files:
gcc : ChangeLog
gcc/config/i386: cygwin.h
Log message:
PR c++/14808
* config/i386/cygwin.h (TARGET_IS_PE_COFF): Delete duplicate macro.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.510&r2=2.2326.2.511
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/cygwin.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.85.10.1&r2=1.85.10.2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14808
^ permalink raw reply [flat|nested] 15+ messages in thread