This warning makes no sense to me:

alpha1:test>g++ -Wsign-conversion -c test050.cc 
test050.cc: In function 'int main(int, const char* const*)':
test050.cc:10: warning: conversion to 'long unsigned int' from 'long int' may
change the sign of the result

See attached test case. The warning appears with a two-dimensional array of
std::string. It goes away with one dimension or if string is replaced with int.
The size or type of the array indices doesn't seem to matter.

alpha1:PD>uname -a
Linux alpha1 2.4.9-40 #1 Mon Sep 23 08:14:02 EDT 2002 alpha unknown


alpha1:PD>g++ -v
Using built-in specs.
Target: alphaev56-unknown-linux-gnu
Configured with: ../gcc/configure --verbose --enable-languages=c++
--disable-linux-futex --disable-nls --disable-tls
Thread model: posix
gcc version 4.3.0 20070829 (experimental) (GCC) 

alpha1:PD>alias CONFIGURECVS
alias CONFIGURECVS='../gcc/configure --verbose --enable-languages=c++
--disable-linux-futex --disable-nls --disable-tls >clog 2>&1 &'

alpha1:PD>alias BUILD
alias BUILD='nice gmake CFLAGS='\'''\'' BOOT_CFLAGS='\'''\''
LIBCFLAGS='\''-g'\'' LIBCXXFLAGS='\''-g'\'' bootstrap >log 2>&1 &'

Same thing occurs on cygwin.


-- 
           Summary: Bogus warning with -Wsign-conversion
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mckelvey at maskull dot com
 GCC build triplet: alphaev56-unknown-linux-gnu
  GCC host triplet: alphaev56-unknown-linux-gnu
GCC target triplet: alphaev56-unknown-linux-gnu


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

Reply via email to