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 libfortran/66650] New: libgfortran: warning: left shift of negative value [-Wshift-negative-value]


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66650

            Bug ID: 66650
           Summary: libgfortran: warning: left shift of negative value
                    [-Wshift-negative-value]
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

As of the changes in context of PR65179,
<http://news.gmane.org/find-root.php?message_id=%3C20150422183633.GI28950%40redhat.com%3E>,
I'm seeing a bunch of -Wshift-negative-value warnings in the libgfortran build,
for example:

    In file included from [...]/libgfortran/intrinsics/cshift0.c:26:0:
    [...]/libgfortran/intrinsics/cshift0.c: In function 'cshift0':
    [...]/libgfortran/libgfortran.h:408:48: warning: left shift of negative
value [-Wshift-negative-value]
       ((~((index_type) 0) >> GFC_DTYPE_SIZE_SHIFT) << GFC_DTYPE_SIZE_SHIFT)
                                                    ^
    [...]/libgfortran/libgfortran.h:409:35: note: in expansion of macro
'GFC_DTYPE_SIZE_MASK'
     #define GFC_DTYPE_TYPE_SIZE_MASK (GFC_DTYPE_SIZE_MASK |
GFC_DTYPE_TYPE_MASK)
                                       ^
    [...]/libgfortran/libgfortran.h:411:52: note: in expansion of macro
'GFC_DTYPE_TYPE_SIZE_MASK'
     #define GFC_DTYPE_TYPE_SIZE(desc) ((desc)->dtype &
GFC_DTYPE_TYPE_SIZE_MASK)
                                                        ^
    [...]/libgfortran/intrinsics/cshift0.c:94:15: note: in expansion of macro
'GFC_DTYPE_TYPE_SIZE'
       type_size = GFC_DTYPE_TYPE_SIZE (array);
                   ^

Unless this will be resolved by demoting the warning (I have not reviewed the
recent discussion, such as PR66066,
<http://news.gmane.org/find-root.php?message_id=%3C20150511142112.GO3384%40redhat.com%3E>),
I supposed this should be fixed in libgfortran/libgfortran.h, perhaps by making
index_type an unsiged type if that's possible?


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