Commit 20d36f0e by Richard Guenther Committed by Richard Biener

re PR lto/41761 (lto1: error: type mismatch in component reference (const with non-const))

2009-10-20  Richard Guenther  <rguenther@suse.de>

        PR lto/41761
	* gimple.c (gimple_register_type): Make sure we register
	the types main variant first.

	* gcc.dg/lto/20091020-1_0.c: New testcase.
	* gcc.dg/lto/20091020-1_1.c: Likewise.
	* gcc.dg/lto/20091020-2_0.c: Likewise.
	* gcc.dg/lto/20091020-2_1.c: Likewise.

From-SVN: r153012
parent dd8c071d
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
2009-10-20 Richard Guenther <rguenther@suse.de> 2009-10-20 Richard Guenther <rguenther@suse.de>
PR lto/41761
* gimple.c (gimple_register_type): Make sure we register
the types main variant first.
2009-10-20 Richard Guenther <rguenther@suse.de>
* gimple.c (gimple_types_compatible_p): Simplify. Move * gimple.c (gimple_types_compatible_p): Simplify. Move
cheap checks before hashtable queries. Add checks for cheap checks before hashtable queries. Add checks for
TYPE_NONALIASED_COMPONENT and DECL_NONADDRESSABLE_P. TYPE_NONALIASED_COMPONENT and DECL_NONADDRESSABLE_P.
...@@ -3809,6 +3809,12 @@ gimple_register_type (tree t) ...@@ -3809,6 +3809,12 @@ gimple_register_type (tree t)
gcc_assert (TYPE_P (t)); gcc_assert (TYPE_P (t));
/* Always register the main variant first. This is important so we
pick up the non-typedef variants as canonical, otherwise we'll end
up taking typedef ids for structure tags during comparison. */
if (TYPE_MAIN_VARIANT (t) != t)
gimple_register_type (TYPE_MAIN_VARIANT (t));
if (gimple_types == NULL) if (gimple_types == NULL)
gimple_types = htab_create (16381, gimple_type_hash, gimple_type_eq, 0); gimple_types = htab_create (16381, gimple_type_hash, gimple_type_eq, 0);
......
2009-10-20 Richard Guenther <rguenther@suse.de>
PR lto/41761
* gcc.dg/lto/20091020-1_0.c: New testcase.
* gcc.dg/lto/20091020-1_1.c: Likewise.
* gcc.dg/lto/20091020-2_0.c: Likewise.
* gcc.dg/lto/20091020-2_1.c: Likewise.
2009-10-20 Jakub Jelinek <jakub@redhat.com> 2009-10-20 Jakub Jelinek <jakub@redhat.com>
PR debug/41340 PR debug/41340
......
/* { dg-lto-do link } */
/* { dg-lto-options {{-fPIC -shared -flto}} } */
typedef struct {
int NumPackStreams;
} CSzAr;
void cli_7unz (CSzAr db) { }
typedef struct {
int NumPackStreams;
} CSzAr;
typedef struct {
CSzAr db;
} CSzArEx;
int SzArEx_Init(CSzArEx *p)
{
return p->db.NumPackStreams;
}
int SzArEx_GetFolderFullPackSize(const CSzArEx *p)
{
return p->db.NumPackStreams;
}
/* { dg-lto-do link } */
/* { dg-lto-options {{-fPIC -shared -flto}} } */
typedef struct {
int NumPackStreams;
} CSzAr;
typedef struct {
CSzAr db;
} CSzArEx;
int SzArEx_Init(CSzArEx *p)
{
return p->db.NumPackStreams;
}
int SzArEx_GetFolderFullPackSize(const CSzArEx *p)
{
return p->db.NumPackStreams;
}
typedef struct {
int NumPackStreams;
} CSzAr;
void cli_7unz (CSzAr db) { }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment