diff options
author | Richard Guenther <rguenther@suse.de> | 2009-10-28 14:48:34 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-10-28 14:48:34 +0000 |
commit | cfee9aa4c9b3ea9265b595be3473d0a15319d862 (patch) | |
tree | 92b4e098e2f8daedf3f56de7f2fff165e4d72720 /gcc | |
parent | a1c6569544feb45d1fffff211a7970a8069d8c34 (diff) | |
download | gcc-cfee9aa4c9b3ea9265b595be3473d0a15319d862.zip gcc-cfee9aa4c9b3ea9265b595be3473d0a15319d862.tar.gz gcc-cfee9aa4c9b3ea9265b595be3473d0a15319d862.tar.bz2 |
re PR lto/41808 (error: non-trivial conversion at assignment)
2009-10-28 Richard Guenther <rguenther@suse.de>
PR lto/41808
PR lto/41839
* tree-ssa.c (useless_type_conversion_p): Do not treat
conversions to pointers to incomplete types as useless.
* gimple.c (gimple_types_compatible_p): Compare struct tags,
not typedef names.
* gcc.dg/lto/20091027-1_0.c: New testcase.
* gcc.dg/lto/20091027-1_1.c: Likewise.
* g++.dg/lto/20091026-1_0.C: Likewise.
* g++.dg/lto/20091026-1_1.C: Likewise.
* g++.dg/lto/20091026-1_a.h: Likewise.
From-SVN: r153671
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/gimple.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/20091026-1_0.C | 11 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/20091026-1_1.C | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/20091026-1_a.h | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/20091027-1_0.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/20091027-1_1.c | 9 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 5 |
9 files changed, 75 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e43a077..d2126f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2009-10-28 Richard Guenther <rguenther@suse.de> + + PR lto/41808 + PR lto/41839 + * tree-ssa.c (useless_type_conversion_p): Do not treat + conversions to pointers to incomplete types as useless. + * gimple.c (gimple_types_compatible_p): Compare struct tags, + not typedef names. + 2009-10-28 Jakub Jelinek <jakub@redhat.com> * var-tracking.c (emit_note_insn_var_location): Don't call the second diff --git a/gcc/gimple.c b/gcc/gimple.c index 1f80883..676e3fd 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -3368,7 +3368,8 @@ gimple_types_compatible_p (tree t1, tree t2) && RECORD_OR_UNION_TYPE_P (TREE_TYPE (t1)) && (!COMPLETE_TYPE_P (TREE_TYPE (t1)) || !COMPLETE_TYPE_P (TREE_TYPE (t2))) - && compare_type_names_p (TREE_TYPE (t1), TREE_TYPE (t2), true)) + && compare_type_names_p (TYPE_MAIN_VARIANT (TREE_TYPE (t1)), + TYPE_MAIN_VARIANT (TREE_TYPE (t2)), true)) { /* Replace the pointed-to incomplete type with the complete one. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f06387..751486d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2009-10-28 Richard Guenther <rguenther@suse.de> + + PR lto/41808 + PR lto/41839 + * gcc.dg/lto/20091027-1_0.c: New testcase. + * gcc.dg/lto/20091027-1_1.c: Likewise. + * g++.dg/lto/20091026-1_0.C: Likewise. + * g++.dg/lto/20091026-1_1.C: Likewise. + * g++.dg/lto/20091026-1_a.h: Likewise. + 2009-10-28 Jakub Jelinek <jakub@redhat.com> PR middle-end/41837 diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_0.C b/gcc/testsuite/g++.dg/lto/20091026-1_0.C new file mode 100644 index 0000000..5c74f29 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091026-1_0.C @@ -0,0 +1,11 @@ +// { dg-lto-do link } +// { dg-extra-ld-options "-r -nostdlib" } + +#include "20091026-1_a.h" +cObject *cHead::find(const char *objname) const +{ + return firstchildp; +} +class cNetworkType : public cObject { }; +cNetworkType *networktype; + diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_1.C b/gcc/testsuite/g++.dg/lto/20091026-1_1.C new file mode 100644 index 0000000..2881610 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091026-1_1.C @@ -0,0 +1,14 @@ +#include "20091026-1_a.h" +extern cHead networks; +class cNetworkType; +inline cNetworkType *findNetwork(const char *s) +{ + return (cNetworkType *)networks.find(s); +} +int run(const char *opt_network_name) +{ + cNetworkType *network = findNetwork(opt_network_name); + if (!network) + throw 1; +} + diff --git a/gcc/testsuite/g++.dg/lto/20091026-1_a.h b/gcc/testsuite/g++.dg/lto/20091026-1_a.h new file mode 100644 index 0000000..314dd96 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091026-1_a.h @@ -0,0 +1,9 @@ +class cObject { +public: + cObject *firstchildp; +}; +class cHead : public cObject { +public: + cObject *find(const char *objname) const; +}; + diff --git a/gcc/testsuite/gcc.dg/lto/20091027-1_0.c b/gcc/testsuite/gcc.dg/lto/20091027-1_0.c new file mode 100644 index 0000000..f2669fe --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091027-1_0.c @@ -0,0 +1,11 @@ +/* { dg-lto-do link } */ +/* { dg-extra-ld-options "-r -nostdlib" } */ + +typedef struct _xmlDict xmlDict; +struct _xmlDict { + int ref_counter; +}; +void xmlDictCreate(void) { + xmlDict * dict; +} + diff --git a/gcc/testsuite/gcc.dg/lto/20091027-1_1.c b/gcc/testsuite/gcc.dg/lto/20091027-1_1.c new file mode 100644 index 0000000..d92394c --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091027-1_1.c @@ -0,0 +1,9 @@ +typedef struct _xmlDict xmlDict; +struct _xmlDoc { + struct _xmlDict *dict; +}; +void xmlAddEntity(struct _xmlDoc *a) { + xmlDict * dict = a->dict; + xmlHashCreateDict(0, dict); +} + diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index b646ded..8e88c2f 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1201,11 +1201,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type) record type or a pointer to an unprototyped function, then the conversion is not necessary. */ if (VOID_TYPE_P (TREE_TYPE (outer_type)) - || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) - && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE - && (TREE_CODE (TREE_TYPE (outer_type)) - == TREE_CODE (TREE_TYPE (inner_type))) - && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))) || ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE) && (TREE_CODE (TREE_TYPE (outer_type)) |