[Bug c++/41921] Cross language don't work with typedef unnamed structs
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Nov 3 11:46:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list