This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/35980] New: The canonical type of types with may_alias attribute is incorrect


The canonical type of types with the may_alias attribute is the canonical type
of the type without the may_alias attribute set.  But

/* The "canonical" type for this type node, which can be used to
   compare the type for equality with another type. If two types are
   equal (based on the semantics of the language), then they will have
   equivalent TYPE_CANONICAL entries.

and may_alias vs. non-may_alias attributed types are _not_ equal from language
semantics.

Also build_pointer_type_for_mode should set TYPE_REF_CAN_ALIAS_ALL on pointer
types build for types with the may_alias attribute.

Also may_alias is specified in a way that suggests

  typedef int __attribute__((may_alias)) mytype;
  mytype a;
  short *p = (short *)&a;

would make *p special.  Instead may_alias should have been specified on
pointer types, but it's too late for that.  We might still be able to
warn if a may_alias type is ever used for a declaration though.


-- 
           Summary: The canonical type of types with may_alias attribute is
                    incorrect
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]