This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/21402] wrong-code with inlining and type-punned pointer
- From: "pinskia at physics dot uc dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 May 2005 18:41:42 -0000
- Subject: [Bug rtl-optimization/21402] wrong-code with inlining and type-punned pointer
- References: <20050505153523.21402.gcc@arbruijn.dds.nl>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at physics dot uc dot edu 2005-05-05 18:41 -------
Subject: Re: wrong-code with inlining and type-punned pointer
On May 5, 2005, at 1:19 PM, schlie at comcast dot net wrote:
>
> ------- Additional Comments From schlie at comcast dot net 2005-05-05
> 17:19 -------
> (In reply to comment #2)
>> "unsigned char *" and "char *" are in two different aliasing sets
>> while char
>> and unsigned char are in the same one, well char is every aliasing
>> set.
>
> Then I can't help but wonder if it may make sense to reconsider placing
> char *, and (un)signed char * in different aliasing sets, as there
> seems
> little if any justifiable reason to generate incorrect code for
> references to
> types which are considered be compatible for assignment. (Just as
> arguably
> it likely makes little sense to generate warnings for the comparison
> between
> pointers to types which differ only in signness for the same reason).
> As
> neither seem particularly useful, and the former is clearly needlessly
> potentially dangerious.
Because this is what the standard says is allowed. The standard also
says the comparisons and assignment between pointers without a case is
invalid code and should be diagnostic. Again this is what the standard
says for these things and GCC follows the C standard.
-- Pinski
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21402