public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Richard Biener <rguenther@suse.de>
Cc: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org
Subject: Re: Improve LTO type checking during symtab merging
Date: Tue, 28 Apr 2015 14:42:00 -0000	[thread overview]
Message-ID: <20150428142214.GA52082@kam.mff.cuni.cz> (raw)
In-Reply-To: <alpine.LSU.2.11.1504271049170.20496@zhemvz.fhfr.qr>

> 
> Only emitting the warnings with -Wodr looks good to me.  I can't see
> how we can decide what cases lead to wrong code surprises and what not

OK, I will go with -Wodr for all the warnings then, that seems fine to me.

> (other than using types_compatible_p ...).  Wrong-code can only(?) happen
> if we happen to inline in a way that makes the incosistency visible in
> a single function.
>  
> > Incrementally I am heading towards proper definition of decl 
> > compatibility that I can plug into symtab merging and avoid merging 
> > incompatible decls (so FORTIFY_SOURCE works).
> >
> > lto-symtab and ipa-icf both have some knowledge of the problem, I want to get
> > both right and factor out common logic.
> 
> Sounds good.
>  
> > Other improvement is to preserve the ODR type info when non-ODR variant
> > previals so one can diagnose clash in between C++ units even in mixed
> > language linktimes.
> 
> Hmm, but then merging ODR with non-ODR variant is already pointing to
> a ODR violation?  So why do you need to retain that info?

non-ODR type is compatible with all ODR types that are structurally equivalent,
but these ODR types may not be compatible with each other.  For example:

a.c
struct a {int a;} var;

b.C
extern struct a {int a;} var;

c.C
extern struct b {int a;} var;

has ODR violatio nbetween b.C and c.C, but because the variable is defined
in C source file, we will only check compatibility with non-ODR struct a.
My plan is to simply record if the declaration also has ODR type associated
with it.  But that is for incremental improvement.
> 
> Btw, there is that old PR41227 which has both wrong-code and diagnostic
> impact...

Thanks, I will take deeper look. I did not know that fortran has way
to mark types that are supposed to interpoerate outside fortran units.
This may be potentially interesting.


Honza

  reply	other threads:[~2015-04-28 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27  8:34 Jan Hubicka
2015-04-27  8:54 ` Richard Biener
2015-04-28 14:42   ` Jan Hubicka [this message]
2015-04-28  2:53 ` Jan Hubicka
2015-04-28  4:07 ` Jan Hubicka
2015-04-28  7:15   ` Tobias Burnus
2015-04-28  8:14   ` Richard Biener
2015-05-11  4:45     ` Jan Hubicka
2015-05-12 10:04       ` Richard Biener
2015-05-17 10:42       ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150428142214.GA52082@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).