This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[RFC] Dealing with ODR violations in GCC
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 12 Sep 2014 07:40:42 +0200
- Subject: [RFC] Dealing with ODR violations in GCC
- Authentication-results: sourceware.org; auth=none
Hi,
I went through excercise of running LTO bootstrap with ODR verification on. There are some typename clashes
I guess we want to fix. I wonder what approach is preferred, do we want to introduce anonymous
namespaces for those?
Honza
../../gcc/tlink.c:62:16: warning: type âstruct file_hash_entryâ violates one definition rule [-Wodr]
typedef struct file_hash_entry
^
../../libcpp/files.c:143:8: note: a different type is defined in another translation unit
struct file_hash_entry
^
../../gcc/tlink.c:64:15: note: the first difference of corresponding definitions is field âkeyâ
const char *key;
^
../../libcpp/files.c:145:27: note: a field with different name is defined in another translation unit
struct file_hash_entry *next;
^
../../gcc/ipa-devirt.c:2674:0: warning: type âstruct type_change_infoâ violates one definition rule [-Wodr]
struct type_change_info
^
../../gcc/ipa-prop.c:595:0: note: a different type is defined in another translation unit
struct type_change_info
^
../../gcc/ipa-devirt.c:2681:0: note: the first difference of corresponding definitions is field âinstanceâ
tree instance;
^
../../gcc/ipa-prop.c:602:0: note: a field with different name is defined in another translation unit
tree object;
^
../../gcc/gcse.c:294:0: warning: type âstruct occrâ violates one definition rule [-Wodr]
struct occr
^
../../gcc/postreload-gcse.c:160:0: note: a different type is defined in another translation unit
struct occr
^
../../gcc/gcse.c:297:0: note: the first difference of corresponding definitions is field ânextâ
struct occr *next;
^
../../gcc/postreload-gcse.c:163:0: note: a field of same name but different type is defined in another translation unit
struct occr *next;
^
../../gcc/gcse.c:259:0: warning: type âstruct exprâ violates one definition rule [-Wodr]
struct expr
^
../../gcc/postreload-gcse.c:92:0: note: a different type is defined in another translation unit
struct expr
^
../../gcc/gcse.c:264:0: note: the first difference of corresponding definitions is field âbitmap_indexâ
int bitmap_index;
^
../../gcc/postreload-gcse.c:98:0: note: a field with different name is defined in another translation unit
hashval_t hash;
^
../../gcc/predict.c:2499:0: warning: type âstruct block_info_defâ violates one definition rule [-Wodr]
typedef struct block_info_def
^
../../gcc/reg-stack.c:208:0: note: a different type is defined in another translation unit
typedef struct block_info_def
^
../../gcc/predict.c:2502:0: note: the first difference of corresponding definitions is field âfrequencyâ
sreal frequency;
^
../../gcc/reg-stack.c:210:0: note: a field with different name is defined in another translation unit
struct stack_def stack_in; /* Input stack configuration. */
^
../../gcc/lra-eliminations.c:80:0: warning: type âstruct elim_tableâ violates one definition rule [-Wodr]
struct elim_table
^
../../gcc/reload1.c:264:0: note: a different type is defined in another translation unit
struct elim_table
^
../../gcc/lra-eliminations.c:88:0: note: the first difference of corresponding definitions is field âprevious_offsetâ
HOST_WIDE_INT previous_offset;
^
../../gcc/reload1.c:268:0: note: a field with different name is defined in another translation unit
HOST_WIDE_INT initial_offset; /* Initial difference between values. */
^
../../gcc/tree-ssa-ccp.c:169:0: warning: type âstruct prop_value_dâ violates one definition rule [-Wodr]
struct prop_value_d {
^
../../gcc/tree-ssa-copy.c:79:0: note: a different type is defined in another translation unit
struct prop_value_d {
^
../../gcc/tree-ssa-ccp.c:171:0: note: the first difference of corresponding definitions is field âlattice_valâ
ccp_lattice_t lattice_val;
^
../../gcc/tree-ssa-copy.c:81:0: note: a field with different name is defined in another translation unit
tree value;
^
../../gcc/profile.h:26:0: warning: type âstruct edge_infoâ violates one definition rule [-Wodr]
struct edge_info
^
../../gcc/tree-ssa-dom.c:113:0: note: a different type is defined in another translation unit
struct edge_info
^
../../gcc/profile.h:28:0: note: the first difference of corresponding definitions is field âcount_validâ
unsigned int count_valid:1;
^
../../gcc/tree-ssa-dom.c:117:0: note: a field with different name is defined in another translation unit
tree lhs;
^
../../gcc/tree-ssa-loop-im.c:119:0: warning: type âstruct mem_refâ violates one definition rule [-Wodr]
typedef struct mem_ref
^
../../gcc/tree-ssa-loop-prefetch.c:271:0: note: a different type is defined in another translation unit
struct mem_ref
^
../../gcc/tree-ssa-loop-im.c:121:0: note: the first difference of corresponding definitions is field âidâ
unsigned id; /* ID assigned to the memory reference
^
../../gcc/tree-ssa-loop-prefetch.c:273:0: note: a field with different name is defined in another translation unit
gimple stmt; /* Statement in that the reference appears. */
^
../../gcc/bitmap.c:2146:8: warning: type âstruct output_infoâ violates one definition rule [-Wodr]
struct output_info
^
../../gcc/alloc-pool.c:342:0: note: a different type is defined in another translation unit
struct output_info
^
../../gcc/bitmap.c:2148:12: note: the first difference of corresponding definitions is field âsizeâ
uint64_t size;
^
../../gcc/alloc-pool.c:344:0: note: a field with different name is defined in another translation unit
unsigned long total_created;
^
../../gcc/gcse.c:320:0: warning: type âstruct hash_table_dâ violates one definition rule [-Wodr]
struct hash_table_d
^
../../gcc/cprop.c:96:0: note: a different type is defined in another translation unit
struct hash_table_d
^
../../gcc/gcse.c:324:0: note: the first difference of corresponding definitions is field âtableâ
struct expr **table;
^
../../gcc/cprop.c:100:0: note: a field of same name but different type is defined in another translation unit
struct expr **table;
^
../../gcc/profile.c:77:0: warning: type âstruct bb_infoâ violates one definition rule [-Wodr]
struct bb_info {
^
../../gcc/dse.c:424:0: note: a different type is defined in another translation unit
struct bb_info
^
../../gcc/profile.c:78:0: note: the first difference of corresponding definitions is field âcount_validâ
unsigned int count_valid : 1;
^
../../gcc/dse.c:430:0: note: a field with different name is defined in another translation unit
insn_info_t last_insn;
^
../../gcc/tree-ssa-structalias.c:1526:0: warning: type âstruct topo_infoâ violates one definition rule [-Wodr]
struct topo_info
^
../../gcc/ipa-cp.c:577:0: note: a different type is defined in another translation unit
{
^
../../gcc/tree-ssa-structalias.c:1529:0: note: the first difference of corresponding definitions is field âvisitedâ
sbitmap visited;
^
../../gcc/ipa-cp.c:577:0: note: a field with different name is defined in another translation unit
{
^
../../gcc/ggc-common.c:945:0: warning: type âstruct ptr_hash_entryâ violates one definition rule [-Wodr]
struct ptr_hash_entry
^
../../gcc/vec.c:83:0: note: a different type is defined in another translation unit
void *ptr;
^
../../gcc/ggc-common.c:948:0: note: the first difference of corresponding definitions is field âlocâ
struct loc_descriptor *loc;
^
../../gcc/vec.c:83:0: note: a field of same name but different type is defined in another translation unit
void *ptr;
^
../../gcc/cp/mangle.c:93:0: warning: type âstruct globalsâ violates one definition rule [-Wodr]
typedef struct GTY(()) globals {
^
../../gcc/ggc-page.c:381:0: note: a different type is defined in another translation unit
static struct globals
^
../../gcc/cp/mangle.c:96:0: note: the first difference of corresponding definitions is field âsubstitutionsâ
vec<tree, va_gc> *substitutions;
^
../../gcc/ggc-page.c:387:0: note: a field with different name is defined in another translation unit
page_entry *pages[NUM_ORDERS];
^
../../gcc/alloc-pool.c:342:0: warning: type âstruct output_infoâ violates one definition rule [-Wodr]
struct output_info
^
../../gcc/bitmap.c:2146:0: note: a different type is defined in another translation unit
struct output_info
^
../../gcc/alloc-pool.c:344:0: note: the first difference of corresponding definitions is field âtotal_createdâ
unsigned long total_created;
^
../../gcc/bitmap.c:2148:0: note: a field with different name is defined in another translation unit
uint64_t size;
^
../../gcc/ipa-devirt.c:2674:0: warning: type âstruct type_change_infoâ violates one definition rule [-Wodr]
struct type_change_info
^
../../gcc/ipa-prop.c:595:0: note: a different type is defined in another translation unit
struct type_change_info
^
../../gcc/ipa-devirt.c:2681:0: note: the first difference of corresponding definitions is field âinstanceâ
tree instance;
^
../../gcc/ipa-prop.c:602:0: note: a field with different name is defined in another translation unit
tree object;
^
../../gcc/gcse.c:294:0: warning: type âstruct occrâ violates one definition rule [-Wodr]
struct occr
^
../../gcc/postreload-gcse.c:160:0: note: a different type is defined in another translation unit
struct occr
^
../../gcc/gcse.c:297:0: note: the first difference of corresponding definitions is field ânextâ
struct occr *next;
^
../../gcc/postreload-gcse.c:163:0: note: a field of same name but different type is defined in another translation unit
struct occr *next;
^
../../gcc/gcse.c:259:0: warning: type âstruct exprâ violates one definition rule [-Wodr]
struct expr
^
../../gcc/postreload-gcse.c:92:0: note: a different type is defined in another translation unit
struct expr
^
../../gcc/gcse.c:264:0: note: the first difference of corresponding definitions is field âbitmap_indexâ
int bitmap_index;
^
../../gcc/postreload-gcse.c:98:0: note: a field with different name is defined in another translation unit
hashval_t hash;
^
../../gcc/predict.c:2499:0: warning: type âstruct block_info_defâ violates one definition rule [-Wodr]
typedef struct block_info_def
^
../../gcc/reg-stack.c:208:0: note: a different type is defined in another translation unit
typedef struct block_info_def
^
../../gcc/predict.c:2502:0: note: the first difference of corresponding definitions is field âfrequencyâ
sreal frequency;
^
../../gcc/reg-stack.c:210:0: note: a field with different name is defined in another translation unit
struct stack_def stack_in; /* Input stack configuration. */
^
../../gcc/lra-eliminations.c:80:0: warning: type âstruct elim_tableâ violates one definition rule [-Wodr]
struct elim_table
^
../../gcc/reload1.c:264:0: note: a different type is defined in another translation unit
struct elim_table
^
../../gcc/lra-eliminations.c:88:0: note: the first difference of corresponding definitions is field âprevious_offsetâ
HOST_WIDE_INT previous_offset;
^
../../gcc/reload1.c:268:0: note: a field with different name is defined in another translation unit
HOST_WIDE_INT initial_offset; /* Initial difference between values. */
^
../../gcc/cp/semantics.c:4075:0: warning: type âstruct nrv_dataâ violates one definition rule [-Wodr]
struct nrv_data
^
../../gcc/tree-nrv.c:58:0: note: a different type is defined in another translation unit
struct nrv_data
^
../../gcc/cp/semantics.c:4081:0: note: the first difference of corresponding definitions is field âvisitedâ
hash_table<pointer_hash <tree_node> > visited;
^
../../gcc/tree-nrv.c:67:0: note: a field with different name is defined in another translation unit
int modified;
^
../../gcc/tree-ssa-ccp.c:169:0: warning: type âstruct prop_value_dâ violates one definition rule [-Wodr]
struct prop_value_d {
^
../../gcc/tree-ssa-copy.c:79:0: note: a different type is defined in another translation unit
struct prop_value_d {
^
../../gcc/tree-ssa-ccp.c:171:0: note: the first difference of corresponding definitions is field âlattice_valâ
ccp_lattice_t lattice_val;
^
../../gcc/tree-ssa-copy.c:81:0: note: a field with different name is defined in another translation unit
tree value;
^
../../gcc/profile.h:26:0: warning: type âstruct edge_infoâ violates one definition rule [-Wodr]
struct edge_info
^
../../gcc/tree-ssa-dom.c:113:0: note: a different type is defined in another translation unit
struct edge_info
^
../../gcc/profile.h:28:0: note: the first difference of corresponding definitions is field âcount_validâ
unsigned int count_valid:1;
^
../../gcc/tree-ssa-dom.c:117:0: note: a field with different name is defined in another translation unit
tree lhs;
^
../../gcc/tree-ssa-loop-im.c:119:0: warning: type âstruct mem_refâ violates one definition rule [-Wodr]
typedef struct mem_ref
^
../../gcc/tree-ssa-loop-prefetch.c:271:0: note: a different type is defined in another translation unit
struct mem_ref
^
../../gcc/tree-ssa-loop-im.c:121:0: note: the first difference of corresponding definitions is field âidâ
unsigned id; /* ID assigned to the memory reference
^
../../gcc/tree-ssa-loop-prefetch.c:273:0: note: a field with different name is defined in another translation unit
gimple stmt; /* Statement in that the reference appears. */
^
../../gcc/gcse.c:320:0: warning: type âstruct hash_table_dâ violates one definition rule [-Wodr]
struct hash_table_d
^
../../gcc/cprop.c:58:0: note: a different type is defined in another translation unit
struct occr
^
../../gcc/gcse.c:324:0: note: the first difference of corresponding definitions is field âtableâ
struct expr **table;
^
../../gcc/cprop.c:58:0: note: a field of same name but different type is defined in another translation unit
struct occr
^
../../gcc/profile.c:77:0: warning: type âstruct bb_infoâ violates one definition rule [-Wodr]
struct bb_info {
^
../../gcc/dse.c:1079:0: note: a different type is defined in another translation unit
free_read_records (bb_info_t bb_info)
^
../../gcc/profile.c:78:0: note: the first difference of corresponding definitions is field âcount_validâ
unsigned int count_valid : 1;
^
../../gcc/dse.c:1079:0: note: a field with different name is defined in another translation unit
free_read_records (bb_info_t bb_info)
^
../../gcc/tree-ssa-structalias.c:1526:0: warning: type âstruct topo_infoâ violates one definition rule [-Wodr]
struct topo_info
^
../../gcc/ipa-cp.c:577:0: note: a different type is defined in another translation unit
{
^
../../gcc/tree-ssa-structalias.c:1529:0: note: the first difference of corresponding definitions is field âvisitedâ
sbitmap visited;
^
../../gcc/ipa-cp.c:577:0: note: a field with different name is defined in another translation unit
{
^
../../gcc/ggc-common.c:945:0: warning: type âstruct ptr_hash_entryâ violates one definition rule [-Wodr]
struct ptr_hash_entry
^
../../gcc/vec.c:83:0: note: a different type is defined in another translation unit
void *ptr;
^
../../gcc/ggc-common.c:948:0: note: the first difference of corresponding definitions is field âlocâ
struct loc_descriptor *loc;
^
../../gcc/vec.c:83:0: note: a field of same name but different type is defined in another translation unit
void *ptr;
^
../../gcc/cp/call.c:83:8: warning: type âstruct conversionâ violates one definition rule [-Wodr]
struct conversion {
^
../../libcpp/charset.c:613:0: note: a different type is defined in another translation unit
const char *pair;
^
../../gcc/cp/call.c:85:19: note: the first difference of corresponding definitions is field âkindâ
conversion_kind kind;
^
../../libcpp/charset.c:613:0: note: a field with different name is defined in another translation unit
const char *pair;
^
../../gcc/alloc-pool.c:342:0: warning: type âstruct output_infoâ violates one definition rule [-Wodr]
struct output_info
^
../../gcc/bitmap.c:2146:0: note: a different type is defined in another translation unit
struct output_info
^
../../gcc/alloc-pool.c:344:0: note: the first difference of corresponding definitions is field âtotal_createdâ
unsigned long total_created;
^
../../gcc/bitmap.c:2148:0: note: a field with different name is defined in another translation unit
uint64_t size;
^
../../gcc/ipa-devirt.c:2674:0: warning: type âstruct type_change_infoâ violates one definition rule [-Wodr]
struct type_change_info
^
../../gcc/ipa-prop.c:595:0: note: a different type is defined in another translation unit
struct type_change_info
^
../../gcc/ipa-devirt.c:2681:0: note: the first difference of corresponding definitions is field âinstanceâ
tree instance;
^
../../gcc/ipa-prop.c:602:0: note: a field with different name is defined in another translation unit
tree object;
^
../../gcc/gcse.c:294:0: warning: type âstruct occrâ violates one definition rule [-Wodr]
struct occr
^
../../gcc/postreload-gcse.c:160:0: note: a different type is defined in another translation unit
struct occr
^
../../gcc/gcse.c:297:0: note: the first difference of corresponding definitions is field ânextâ
struct occr *next;
^
../../gcc/postreload-gcse.c:163:0: note: a field of same name but different type is defined in another translation unit
struct occr *next;
^
../../gcc/gcse.c:259:0: warning: type âstruct exprâ violates one definition rule [-Wodr]
struct expr
^
../../gcc/postreload-gcse.c:92:0: note: a different type is defined in another translation unit
struct expr
^
../../gcc/gcse.c:264:0: note: the first difference of corresponding definitions is field âbitmap_indexâ
int bitmap_index;
^
../../gcc/postreload-gcse.c:98:0: note: a field with different name is defined in another translation unit
hashval_t hash;
^
../../gcc/predict.c:2499:0: warning: type âstruct block_info_defâ violates one definition rule [-Wodr]
typedef struct block_info_def
^
../../gcc/reg-stack.c:208:0: note: a different type is defined in another translation unit
typedef struct block_info_def
^
../../gcc/predict.c:2502:0: note: the first difference of corresponding definitions is field âfrequencyâ
sreal frequency;
^
../../gcc/reg-stack.c:210:0: note: a field with different name is defined in another translation unit
struct stack_def stack_in; /* Input stack configuration. */
^
../../gcc/lra-eliminations.c:80:0: warning: type âstruct elim_tableâ violates one definition rule [-Wodr]
struct elim_table
^
../../gcc/reload1.c:264:0: note: a different type is defined in another translation unit
struct elim_table
^
../../gcc/lra-eliminations.c:88:0: note: the first difference of corresponding definitions is field âprevious_offsetâ
HOST_WIDE_INT previous_offset;
^
../../gcc/reload1.c:268:0: note: a field with different name is defined in another translation unit
HOST_WIDE_INT initial_offset; /* Initial difference between values. */
^
../../gcc/tree-ssa-ccp.c:169:0: warning: type âstruct prop_value_dâ violates one definition rule [-Wodr]
struct prop_value_d {
^
../../gcc/tree-ssa-copy.c:79:0: note: a different type is defined in another translation unit
struct prop_value_d {
^
../../gcc/tree-ssa-ccp.c:171:0: note: the first difference of corresponding definitions is field âlattice_valâ
ccp_lattice_t lattice_val;
^
../../gcc/tree-ssa-copy.c:81:0: note: a field with different name is defined in another translation unit
tree value;
^
../../gcc/profile.h:26:0: warning: type âstruct edge_infoâ violates one definition rule [-Wodr]
struct edge_info
^
../../gcc/tree-ssa-dom.c:113:0: note: a different type is defined in another translation unit
struct edge_info
^
../../gcc/profile.h:28:0: note: the first difference of corresponding definitions is field âcount_validâ
unsigned int count_valid:1;
^
../../gcc/tree-ssa-dom.c:117:0: note: a field with different name is defined in another translation unit
tree lhs;
^
../../gcc/tree-ssa-loop-im.c:119:0: warning: type âstruct mem_refâ violates one definition rule [-Wodr]
typedef struct mem_ref
^
../../gcc/tree-ssa-loop-prefetch.c:271:0: note: a different type is defined in another translation unit
struct mem_ref
^
../../gcc/tree-ssa-loop-im.c:121:0: note: the first difference of corresponding definitions is field âidâ
unsigned id; /* ID assigned to the memory reference
^
../../gcc/tree-ssa-loop-prefetch.c:273:0: note: a field with different name is defined in another translation unit
gimple stmt; /* Statement in that the reference appears. */
^
../../gcc/gcse.c:320:0: warning: type âstruct hash_table_dâ violates one definition rule [-Wodr]
struct hash_table_d
^
../../gcc/cprop.c:58:0: note: a different type is defined in another translation unit
struct occr
^
../../gcc/gcse.c:324:0: note: the first difference of corresponding definitions is field âtableâ
struct expr **table;
^
../../gcc/cprop.c:58:0: note: a field of same name but different type is defined in another translation unit
struct occr
^
../../gcc/profile.c:77:0: warning: type âstruct bb_infoâ violates one definition rule [-Wodr]
struct bb_info {
^
../../gcc/dse.c:1079:0: note: a different type is defined in another translation unit
free_read_records (bb_info_t bb_info)
^
../../gcc/profile.c:78:0: note: the first difference of corresponding definitions is field âcount_validâ
unsigned int count_valid : 1;
^
../../gcc/dse.c:1079:0: note: a field with different name is defined in another translation unit
free_read_records (bb_info_t bb_info)
^
../../gcc/tree-ssa-structalias.c:1526:0: warning: type âstruct topo_infoâ violates one definition rule [-Wodr]
struct topo_info
^
../../gcc/ipa-cp.c:577:0: note: a different type is defined in another translation unit
{
^
../../gcc/tree-ssa-structalias.c:1529:0: note: the first difference of corresponding definitions is field âvisitedâ
sbitmap visited;
^
../../gcc/ipa-cp.c:577:0: note: a field with different name is defined in another translation unit
{
^
../../gcc/ggc-common.c:945:0: warning: type âstruct ptr_hash_entryâ violates one definition rule [-Wodr]
struct ptr_hash_entry
^
../../gcc/vec.c:83:0: note: a different type is defined in another translation unit
void *ptr;
^
../../gcc/ggc-common.c:948:0: note: the first difference of corresponding definitions is field âlocâ
struct loc_descriptor *loc;
^
../../gcc/vec.c:83:0: note: a field of same name but different type is defined in another translation unit
void *ptr;
^
/usr/bin/ld.gold.real: warning: using 'GLIBCXX_3.4' as version for '_ZNKSt15basic_stringbufIwSt11char_traitsIwESaIwEE3strEv' which is also named in version 'GLIBCXX_3.4.6' in script
/usr/bin/ld.gold.real: warning: using 'GLIBCXX_3.4' as version for '_ZNKSs11_M_disjunctEPKc' which is also named in version 'GLIBCXX_3.4.5' in script
/usr/bin/ld.gold.real: warning: using 'GLIBCXX_3.4' as version for '_ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw' which is also named in version 'GLIBCXX_3.4.5' in script
make[2]: *** [compare] Error 1
make[1]: *** [stage3-bubble] Error 2
make: *** [all] Error 2