[Bug rtl-optimization/21402] wrong-code with inlining and type-punned pointer

schlie at comcast dot net gcc-bugzilla@gcc.gnu.org
Sat May 21 21:28:00 GMT 2005


------- Additional Comments From schlie at comcast dot net  2005-05-21 21:28 -------
(In reply to comment #4)
> Subject: Re:  wrong-code with inlining and type-punned pointer
> 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.

Here's an interesting portion of the standard, which seems to direcly imply
that signed and unsigned lvalue references are presumed to validly alias; so
so this should place both in the same alias set, and potentially eliminate the
default warning when comparing pointers which differ only in signness, as
it seems a little silly if they may factually alias each other:

6.3  Expressions

       [#7] An object shall have its stored value accessed only  by
       an lvalue expression that has one of the following types:59

          - a type  compatible  with  the  effective  type  of  the
            object,

          - a qualified version  of  a  type  compatible  with  the
            effective type of the object,

           - a  type  that  is  the   signed   or   unsigned   type
            corresponding to the effective type of the object,

           - a  type  that  is  the   signed   or   unsigned   type
            corresponding  to  a qualified version of the effective

       __________

       59. The   intent   of   this   list   is  to  specify  those
           circumstances in which an  object  may  or  may  not  be
           aliased.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21402



More information about the Gcc-bugs mailing list