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

            Bug ID: 59022
           Summary: Bogus "warning: conversion to 'short int' from 'int'
                    may alter its value [-Wconversion]"
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

The following code gives with C (cc1) and C++ (cc1plus) and -Wconversion the
bogus warning:

test3.c:2:31: warning: conversion to 'short int' from 'int' may alter its value
[-Wconversion]
   coordtmp[0] = coordexist[0] + coordexist[1];
                               ^



void SetBins(short *coordexist, short *coordtmp) {
  coordtmp[0] = coordexist[0] + coordexist[1];
}


The -fdump-tree-original dump looks as follows:

  *coordtmp = (short int) ((unsigned short) *coordexist + (unsigned short)
*(coordexist + 2));

Reply via email to