> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61913
> 
> --- Comment #6 from Manuel López-Ibá??ez <manu at gcc dot gnu.org> ---
> (In reply to Marek Polacek from comment #5)
> > (In reply to Manuel López-Ibá??ez from comment #4)
> > > It is pretty strange that you need a Var() if it is not used anywhere.
> > 
> > It is, we have a bug for it: PR61480.
> 
> But there is no Init(1) there. In fact, I doubt Wodr is enabled by default as
> the documentation says without Init(1).

The warning is triggered by:
jan@linux-ujxe:~/trunk/build/gcc> cat tt.C
struct A {int b; virtual void t();};
  struct A *a;
void
m()
{
  a->t();
}
jan@linux-ujxe:~/trunk/build/gcc> cat tt2.C
struct A {short d; virtual void t();};
void
A::t(){
}
jan@linux-ujxe:~/trunk/build/gcc> ./xgcc -B ./ -O2 -flto tt.C tt2.C
tt2.C:1:8: warning: type ‘struct A’ violates one definition rule [-Wodr]
 struct A {short d; virtual void t();};
        ^                                                                       
                                                                                
                            
tt.C:1:8: note: a different type is defined in another translation unit         
                                                                                
                            
 struct A {int b; virtual void t();};                                           
                                                                                
                            
        ^                                                                       
                                                                                
                            
tt2.C:1:17: note: the first difference of corresponding definitions is field 
‘d’                                                                         
                                   
 struct A {short d; virtual void t();};                                         
                                                                                
                            
                 ^                                                              
                                                                                
                            
tt.C:1:15: note: a field with different name is defined in another translation 
unit                                                                            
                             
 struct A {int b; virtual void t();};                                           
                                                                                
                            

So my tree shows it by default. I am at a conference and have to go for talks,
but I will try to dig deeper today.

Honza
> 
> > The issue is that lto.exp does not allow to scan for 'warning:'.
> 
> Isn't that a bug/missing feature? It seems crucial if one wants to add
> warnings/errors generated by LTO.

Reply via email to