public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/41227] COMMON block, BIND(C) and LTO interoperability issues Date: Mon, 14 Jul 2014 11:09:00 -0000 [thread overview] Message-ID: <bug-41227-4-v6Mdn4AbCo@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-41227-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41227 --- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, the warning is implemented with checking gimple type compatibility in lto/lto-symtab.c: if (!types_compatible_p (TREE_TYPE (prevailing->decl), TREE_TYPE (decl))) diagnosed_p |= warning_at (DECL_SOURCE_LOCATION (decl), 0, "type of %qD does not match original " "declaration", decl); I'm not sure it is wise to drop the outermost single-element struct type from all types during compute of canonical types. We can adjust gimple_get_alias_set to at least assign the same alias sets to such struct and its element, but that doesn't cure the warning (obviously). At least that avoids generating wrong code... like with @@ -2307,6 +2308,27 @@ gimple_get_alias_set (tree t) || t == unsigned_char_type_node) return 0; + /* For C, Fortran interoperability assign the same alias-set to + a record with a single element as that element. */ + if (TREE_CODE (t) == RECORD_TYPE) + { + tree f = NULL_TREE; + for (tree fld = TYPE_FIELDS (t); fld != NULL_TREE; fld = TREE_CHAIN (fld)) + { + if (TREE_CODE (fld) != FIELD_DECL) + continue; + if (f == NULL_TREE) + f = fld; + else + { + f = NULL_TREE; + break; + } + } + if (f) + return get_alias_set (TREE_TYPE (f)); + } + /* Allow aliasing between signed and unsigned variants of the same but I'm sure we don't want to call get_alias_set on all globals during WPA phase (Where the warning is emitted). Humm. We can special-case that case in lto-symtab.c of course. Btw, what kind of single-elements can I expect? I suppose they can be arbitrary (so aggregate as well)?
next prev parent reply other threads:[~2014-07-14 11:09 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-41227-4@http.gcc.gnu.org/bugzilla/> 2012-01-05 13:38 ` rguenth at gcc dot gnu.org 2014-06-08 16:53 ` fxcoudert at gcc dot gnu.org 2014-06-10 13:06 ` rguenth at gcc dot gnu.org 2014-07-14 10:21 ` fxcoudert at gcc dot gnu.org 2014-07-14 10:36 ` rguenther at suse dot de 2014-07-14 10:45 ` fxcoudert at gcc dot gnu.org 2014-07-14 11:09 ` rguenth at gcc dot gnu.org [this message] 2014-07-14 11:20 ` fxcoudert at gcc dot gnu.org 2014-07-14 11:36 ` burnus at gcc dot gnu.org 2014-07-14 11:46 ` rguenther at suse dot de 2014-07-14 12:05 ` tobi at gcc dot gnu.org 2014-07-14 13:33 ` burnus at gcc dot gnu.org 2015-05-27 23:55 ` hubicka at gcc dot gnu.org 2009-09-02 14:26 [Bug fortran/41227] New: " burnus at gcc dot gnu dot org 2009-09-14 21:05 ` [Bug fortran/41227] " burnus at gcc dot gnu dot org 2009-09-28 19:59 ` tobi at gcc dot gnu dot org 2010-01-29 17:46 ` burnus at gcc dot gnu dot org 2010-02-02 10:29 ` burnus at gcc dot gnu dot org 2010-02-11 16:29 ` burnus at gcc dot gnu dot org 2010-02-23 9:08 ` burnus at gcc dot gnu dot org 2010-02-23 9:33 ` rguenther at suse dot de 2010-06-03 13:49 ` rguenth at gcc dot gnu dot org
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=bug-41227-4-v6Mdn4AbCo@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).