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++/70336] New: Incorrect Wconversion warning


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

            Bug ID: 70336
           Summary: Incorrect Wconversion warning
           Product: gcc
           Version: 5.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.smets@alcatel-lucent.com
  Target Milestone: ---

void bla(unsigned char * buffer, int offset, int position)
{
    buffer[position/8] |= (unsigned char)(0x80 >> offset);
}

/tmp/test.c: In function 'bla':
/tmp/test.c:3:27: warning: conversion to 'unsigned char' from 'int' may alter
its value [-Wconversion]
     buffer[position/8] |= (unsigned char)(0x80 >> offset);


Does not give a warning with GCC 4.8, but does with 5.3.1

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