* [Bug lto/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
@ 2009-11-03 6:31 ` pinskia at gcc dot gnu dot org
2009-11-03 6:31 ` pinskia at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-03 6:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2009-11-03 06:31 -------
This works if the struct is named too.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug lto/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
2009-11-03 6:31 ` [Bug lto/41921] Cross language don't work with typedef " pinskia at gcc dot gnu dot org
@ 2009-11-03 6:31 ` pinskia at gcc dot gnu dot org
2009-11-03 6:35 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-03 6:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-11-03 06:30 -------
This works if both are compiled with the C++ front-end (and an extern "C" is
added to the definition of Cv_ImageNew).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug lto/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
2009-11-03 6:31 ` [Bug lto/41921] Cross language don't work with typedef " pinskia at gcc dot gnu dot org
2009-11-03 6:31 ` pinskia at gcc dot gnu dot org
@ 2009-11-03 6:35 ` pinskia at gcc dot gnu dot org
2009-11-03 10:11 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-03 6:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-11-03 06:35 -------
It also works if I "convert" the C++ source into a C (removing the extern "C"
stuff).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug lto/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (2 preceding siblings ...)
2009-11-03 6:35 ` pinskia at gcc dot gnu dot org
@ 2009-11-03 10:11 ` rguenth at gcc dot gnu dot org
2009-11-03 11:46 ` [Bug c++/41921] " rguenth at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-11-03 10:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from rguenth at gcc dot gnu dot org 2009-11-03 10:11 -------
I will have a look.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-11-03 10:11:17
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (3 preceding siblings ...)
2009-11-03 10:11 ` rguenth at gcc dot gnu dot org
@ 2009-11-03 11:46 ` rguenth at gcc dot gnu dot org
2009-11-03 12:15 ` rguenth at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-11-03 11:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenth at gcc dot gnu dot org 2009-11-03 11:46 -------
The C++ FE for
extern "C" { typedef struct {} CvImage; }
creates
<record_type 0x7ffff6f3f790 CvImage type_5 QI
size <integer_cst 0x7ffff7ed5180 type <integer_type 0x7ffff7eea0b0
bit_size_type> constant 8>
unit size <integer_cst 0x7ffff7ed51b0 type <integer_type 0x7ffff7eea000
long unsigned int> constant 1>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6f3f790
fields <type_decl 0x7ffff6f3a6c0 ._0 type <record_type 0x7ffff6f3f790
CvImage>
nonlocal decl_4 VOID file t1.C line 2 col 20
align 1 context <record_type 0x7ffff6f3f790 CvImage>
>
full-name "struct CvImage"
X() X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown
chain <type_decl 0x7ffff6f3a600 ._0>>
thus, a named type. The C frontend generates a named type with the
main-variant being an unnamed type. The C++ frontend also assigns
different sizes to it. C FE variant:
<record_type 0x7ffff6eeabb0 CvImage type_0 BLK
size <integer_cst 0x7ffff7ed5d80 type <integer_type 0x7ffff7ee70b0
bit_size_type> constant 0>
unit size <integer_cst 0x7ffff7ed50f0 type <integer_type 0x7ffff7ee7000
long unsigned int> constant 0>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6eeab00
chain <type_decl 0x7ffff6efb000 D.1607>>
and its main-variant (which is also its canonical type):
<record_type 0x7ffff6eeab00 type_0 BLK
size <integer_cst 0x7ffff7ed5d80 type <integer_type 0x7ffff7ee70b0
bit_size_type> constant 0>
unit size <integer_cst 0x7ffff7ed50f0 type <integer_type 0x7ffff7ee7000
long unsigned int> constant 0>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6eeab00
chain <type_decl 0x7ffff6efb000 D.1607>>
While we could try hard to workaround this in LTO I think this is a
C++ frontend bug. extern "C" should cause it to behave like the C
frontend.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|rguenth at gcc dot gnu dot |unassigned at gcc dot gnu
|org |dot org
Status|ASSIGNED |NEW
Component|lto |c++
Keywords| |lto
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (4 preceding siblings ...)
2009-11-03 11:46 ` [Bug c++/41921] " rguenth at gcc dot gnu dot org
@ 2009-11-03 12:15 ` rguenth at gcc dot gnu dot org
2009-11-03 16:17 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-11-03 12:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from rguenth at gcc dot gnu dot org 2009-11-03 12:15 -------
This also likely means that the pure C++ testcase
t1.C
-----
struct {} a;
t2.C
-----
typedef struct {} T;
extern T a;
void foo(void)
{
a = T();
}
breaks.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (5 preceding siblings ...)
2009-11-03 12:15 ` rguenth at gcc dot gnu dot org
@ 2009-11-03 16:17 ` pinskia at gcc dot gnu dot org
2009-11-13 23:12 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-03 16:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2009-11-03 16:16 -------
Note the original testcase did not have an empty struct (which is the cause of
the different sizes).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (6 preceding siblings ...)
2009-11-03 16:17 ` pinskia at gcc dot gnu dot org
@ 2009-11-13 23:12 ` pinskia at gcc dot gnu dot org
2010-06-03 15:03 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-13 23:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2009-11-13 23:12 -------
I think this is related to PR 7221.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |7221
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (7 preceding siblings ...)
2009-11-13 23:12 ` pinskia at gcc dot gnu dot org
@ 2010-06-03 15:03 ` rguenth at gcc dot gnu dot org
2010-06-03 16:08 ` rguenth at gcc dot gnu dot org
2010-06-03 16:09 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-03 15:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from rguenth at gcc dot gnu dot org 2010-06-03 15:03 -------
This is fixed. I have a testcase + testsuite patch.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (8 preceding siblings ...)
2010-06-03 15:03 ` rguenth at gcc dot gnu dot org
@ 2010-06-03 16:08 ` rguenth at gcc dot gnu dot org
2010-06-03 16:09 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-03 16:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2010-06-03 16:08 -------
Subject: Bug 41921
Author: rguenth
Date: Thu Jun 3 16:08:10 2010
New Revision: 160226
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160226
Log:
2010-06-03 Richard Guenther <rguenther@suse.de>
PR lto/41921
* lib/lto.exp: Always load gcc.exp.
(lto-obj): For C source files invoke gcc_target_compile.
* g++.dg/lto/20100603-1_0.C: New testcase.
* g++.dg/lto/20100603-1_1.c: Likewise.
Added:
trunk/gcc/testsuite/g++.dg/lto/20100603-1_0.C
trunk/gcc/testsuite/g++.dg/lto/20100603-1_1.c
Modified:
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/41921] Cross language don't work with typedef unnamed structs
2009-11-03 6:29 [Bug lto/41921] New: Cross language don't work with unnamed structs pinskia at gcc dot gnu dot org
` (9 preceding siblings ...)
2010-06-03 16:08 ` rguenth at gcc dot gnu dot org
@ 2010-06-03 16:09 ` rguenth at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-06-03 16:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from rguenth at gcc dot gnu dot org 2010-06-03 16:09 -------
Subject: Bug 41921
Author: rguenth
Date: Thu Jun 3 16:08:49 2010
New Revision: 160227
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160227
Log:
2010-06-03 Richard Guenther <rguenther@suse.de>
PR lto/41921
* lib/lto.exp: Always load gcc.exp.
(lto-obj): For C source files invoke gcc_target_compile.
* g++.dg/lto/20100603-1_0.C: New testcase.
* g++.dg/lto/20100603-1_1.c: Likewise.
Modified:
trunk/gcc/testsuite/lib/lto.exp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41921
^ permalink raw reply [flat|nested] 12+ messages in thread