public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: Jason Merrill <jason@redhat.com>
Cc: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org
Subject: Re: False ODR violation positives on anonymous namespace types
Date: Mon, 11 May 2015 18:05:00 -0000	[thread overview]
Message-ID: <20150511180509.GB22960@kam.mff.cuni.cz> (raw)
In-Reply-To: <5550ECB5.8000607@redhat.com>

> On 05/11/2015 12:46 PM, Jan Hubicka wrote:
> >Well, my main motivatoin to extend from RECORD_OR_UNION_TYPE_P was to handle
> >enums. But other case I would like to deal with are integer types - i.e. preserve
> >difference between char/signed char/unsigned char/short/int/long/wchar in cases
> >where they structurally coincide.
> 
> In what context?  Won't you get that from comparing e.g. the field
> types of two definitions of the same class?

If one class define "int foo;" and other "long foo;" we currently do not complain
about ODR on 32bit targets while I think we could.
Other case was the ODR violations dragged by the signed/unsigned:

char switch:
$ cat t.C
char a;
$ ./xgcc -B ./ -O2 t.C -o t1.o -fno-signed-char -c -flto
$ ./xgcc -B ./ -O2 t.C -o t2.o -fsigned-char -c -flto
$ ./xgcc -B ./ -O2 t1.o t2.o -flto -fno-signed-char  -flto
<built-in>: warning: type ïcharï violates one definition rule [-Wodr]
<built-in>: note: a type with different signedness is defined in another translation unit
t.C:1:6: warning: type of ïaï does not match original declaration
 char a;
      ^
t.C:1:6: note: previously declared here
 char a;
      ^

I also want to use ODR for more fine grained TBAA on LTO and there the differences between
integer types matter more.

Honza
> 
> Jason

  reply	other threads:[~2015-05-11 18:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 14:28 Jan Hubicka
2015-05-11 17:16 ` Jason Merrill
2015-05-11 17:46   ` Jan Hubicka
2015-05-11 17:54     ` Jason Merrill
2015-05-11 18:05       ` Jan Hubicka [this message]
2015-05-11 21:21         ` Jason Merrill
2015-05-11 21:52           ` Jan Hubicka
2015-05-12 13:51             ` Jason Merrill
2015-05-12 14:13               ` Jan Hubicka
2015-05-12 14:54                 ` Jan Hubicka
2015-05-12 16:07                   ` Jason Merrill
2015-05-12 16:27                     ` Jan Hubicka
2015-05-12 18:40                       ` Jan Hubicka

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=20150511180509.GB22960@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).