------- Comment #2 from rguenth at gcc dot gnu dot org  2009-03-15 12:08 -------
This is because convert_for_assignment does not know about the pointer target
difference due to the may_alias attribute.  Note that I think a warning is
appropriate here, just the one emitted is confusing.

Something like

              /* If this is a difference in target attributes, do war.  */
              else if (!attribute_list_equal (TYPE_ATTRIBUTES (ttl), 
                                              TYPE_ATTRIBUTES (ttr)))
                WARN_FOR_ASSIGNMENT (input_location, 0,
                                     G_("pointer targets in passing argument "
                                        "%d of %qE have different attributes"),
                                     G_("pointer targets in assignment "
                                        "have different attributes"),
                                     G_("pointer targets in initialization "
                                        "have different attributes"),
                                     G_("pointer targets in return have "
                                        "different attributes"));
              /* If this is not a case of ignoring a mismatch in signedness,
                 no warning.  */

would be an improvement.

./cc1 -quiet -Wall t.i
t.i: In function 'foo':
t.i:5: warning: pointer targets in initialization have different attributes

Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-15 12:08:59
               date|                            |


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

Reply via email to