Re: openCOLLADA: Help with GCC6 narrowing conversion
On 02/19/2016 12:05 AM, David Woodhouse wrote: On Mon, 2016-02-15 at 17:09 +0100, Ralf Corsepius wrote: Exactly. Because of this, I -fsigned-char should only be applied as a last resort/work-around to mere program/application packages and not to library packages, IMHO. Or to programs which *use* libraries? :) Sure. What I was referring to is -fsigned-char should not be applied to library/header packages, because this would propagate this -fsigned-char into users/consumers of these library packages. Ralf -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
Dan Horák wrote: > you are welcome, there will be more packages suffering from the same > problem (I own at least one :-)), sometimes appending "-fsigned-char" > to CFLAGS will be easier. It is also possible to just get rid of the narrowing error with: -Wno-error=narrowing but that will only restore the previous GCC behavior. It will NOT make the program magically work if it later checks for -1 with something like "if (HEX2DEC[i] < 0)" (which never worked on ARM without -fsigned-char or explicitly writing "signed char"). There are other cases where -Wno-error=narrowing is the most effective fix, but char x[]={-1} is a case where the narrowing error is really only uncovering a deeper issue. Kevin Kofler -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, 2016-02-15 at 17:09 +0100, Ralf Corsepius wrote: > > Exactly. Because of this, I -fsigned-char should only be applied as a > last resort/work-around to mere program/application packages and not to > library packages, IMHO. Or to programs which *use* libraries? :) -- dwmw2 smime.p7s Description: S/MIME cryptographic signature -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On 16/02/16 10:51 +, Jonathan Wakely wrote: Given that there are dozens of those initializers it might be more readable to do: static const char none = -1; const char HEX2DEC[256] = { none, none, none, . } For the avoidance of doubt, this is not an error in C++11. Narrowing conversions are only erorrs when they appear inside a braced-init-list. So 'none' is initialized to (char)-1 without error, then the elements of the HEX2DEC array are initialized from char values that need no conversion, so also without error. The original code required -1 to be converted to char inside the braqced-init-list for HEX2DEC. -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On 15/02/16 23:46 +0900, Mamoru TASAKA wrote: Richard Shaw wrote on 02/15/2016 11:34 PM: Can someone point me in the right direction? My package openCOLLADA is FTBFS in rawhide with the following (repeating) error: /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing] }; I tried using the gcc6 porting guide but I'm not qutie enough of a programmer to understand how to apply it in this case. The offending code is: const char HEX2DEC[256] = ^M {^M /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */^M /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 1 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, On _ARM_ (actually build failure seems to be on ARM) char is _unsigned_ by default, so converting (int)-1 to char on ARM is narrowing conversion and C++11 forbids this on list-initialization. You can do this when you explicitly cast, like const char HEX2DEC[256] = { (char)-1, . } Given that there are dozens of those initializers it might be more readable to do: static const char none = -1; const char HEX2DEC[256] = { none, none, none, . } -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On 16/02/16 01:34 +0100, Michael Schwendt wrote: On Mon, 15 Feb 2016 16:46:32 +0100, Dan Horák wrote: you are welcome, there will be more packages suffering from the same problem (I own at least one :-)), sometimes appending "-fsigned-char" to CFLAGS will be easier. A couple of narrowing-conversion problems had turned up in Oct 2015 already, so this is nothing new to GCC 6. Right, the problem is C++11 or later, not GCC 6. It's likely the Oct 2015 problems were in packages that switched to -std=gnu++11 (or a similar flag) with GCC 5. -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, 15 Feb 2016 16:46:32 +0100, Dan Horák wrote: > you are welcome, there will be more packages suffering from the same > problem (I own at least one :-)), sometimes appending "-fsigned-char" > to CFLAGS will be easier. A couple of narrowing-conversion problems had turned up in Oct 2015 already, so this is nothing new to GCC 6. -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On 02/15/2016 04:54 PM, Jakub Jelinek wrote: On Mon, Feb 15, 2016 at 04:46:32PM +0100, Dan Horák wrote: On Mon, 15 Feb 2016 09:35:03 -0600 Richard Shawwrote: On Mon, Feb 15, 2016 at 8:50 AM, Dan Horák wrote: On Mon, 15 Feb 2016 08:34:31 -0600 Richard Shaw wrote: Can someone point me in the right direction? My package openCOLLADA is FTBFS in rawhide with the following (repeating) error: /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing] }; isn't it on ARM? Then you should use explicit "signed char" as char is unsigned by default on ARM (and other arches), see eg. http://blog.cdleary.com/2012/11/arm-chars-are-unsigned-by-default/ Thanks Dan, that got it, adding an explicit signed fixed the build. you are welcome, there will be more packages suffering from the same problem (I own at least one :-)), sometimes appending "-fsigned-char" to CFLAGS will be easier. Note that -fsigned-char changes the ABI, so it might have various undesirable effects too. Exactly. Because of this, I -fsigned-char should only be applied as a last resort/work-around to mere program/application packages and not to library packages, IMHO. Ralf -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, Feb 15, 2016 at 04:46:32PM +0100, Dan Horák wrote: > On Mon, 15 Feb 2016 09:35:03 -0600 > Richard Shawwrote: > > > On Mon, Feb 15, 2016 at 8:50 AM, Dan Horák wrote: > > > > > On Mon, 15 Feb 2016 08:34:31 -0600 > > > Richard Shaw wrote: > > > > > > > Can someone point me in the right direction? My package > > > > openCOLLADA is FTBFS in rawhide with the following (repeating) > > > > error: > > > > > > > > > > > /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: > > > > error: narrowing conversion of '-1' from 'int' to 'char' inside > > > > { } [-Wnarrowing] > > > > }; > > > > > > isn't it on ARM? Then you should use explicit "signed char" as char > > > is unsigned by default on ARM (and other arches), see eg. > > > http://blog.cdleary.com/2012/11/arm-chars-are-unsigned-by-default/ > > > > > > Thanks Dan, that got it, adding an explicit signed fixed the build. > > you are welcome, there will be more packages suffering from the same > problem (I own at least one :-)), sometimes appending "-fsigned-char" > to CFLAGS will be easier. Note that -fsigned-char changes the ABI, so it might have various undesirable effects too. Jakub -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, 15 Feb 2016 09:35:03 -0600 Richard Shawwrote: > On Mon, Feb 15, 2016 at 8:50 AM, Dan Horák wrote: > > > On Mon, 15 Feb 2016 08:34:31 -0600 > > Richard Shaw wrote: > > > > > Can someone point me in the right direction? My package > > > openCOLLADA is FTBFS in rawhide with the following (repeating) > > > error: > > > > > > > > /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: > > > error: narrowing conversion of '-1' from 'int' to 'char' inside > > > { } [-Wnarrowing] > > > }; > > > > isn't it on ARM? Then you should use explicit "signed char" as char > > is unsigned by default on ARM (and other arches), see eg. > > http://blog.cdleary.com/2012/11/arm-chars-are-unsigned-by-default/ > > > Thanks Dan, that got it, adding an explicit signed fixed the build. you are welcome, there will be more packages suffering from the same problem (I own at least one :-)), sometimes appending "-fsigned-char" to CFLAGS will be easier. Dan -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, Feb 15, 2016 at 8:50 AM, Dan Horákwrote: > On Mon, 15 Feb 2016 08:34:31 -0600 > Richard Shaw wrote: > > > Can someone point me in the right direction? My package openCOLLADA is > > FTBFS in rawhide with the following (repeating) error: > > > > > /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: > > error: narrowing conversion of '-1' from 'int' to 'char' inside { } > > [-Wnarrowing] > > }; > > isn't it on ARM? Then you should use explicit "signed char" as char is > unsigned by default on ARM (and other arches), see eg. > http://blog.cdleary.com/2012/11/arm-chars-are-unsigned-by-default/ Thanks Dan, that got it, adding an explicit signed fixed the build. Thanks, Richard -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, 15 Feb 2016 08:34:31 -0600 Richard Shawwrote: > Can someone point me in the right direction? My package openCOLLADA is > FTBFS in rawhide with the following (repeating) error: > > /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: > error: narrowing conversion of '-1' from 'int' to 'char' inside { } > [-Wnarrowing] > }; isn't it on ARM? Then you should use explicit "signed char" as char is unsigned by default on ARM (and other arches), see eg. http://blog.cdleary.com/2012/11/arm-chars-are-unsigned-by-default/ Dan > I tried using the gcc6 porting guide but I'm not qutie enough of a > programmer to understand how to apply it in this case. The offending > code is: > > const char HEX2DEC[256] = ^M > {^M > /* 0 1 2 3 4 5 6 7 8 9 A B C D > E F */^M > /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 1 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 2 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 3 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1, > -1,-1,-1,-1,^M > ^M > /* 4 */ -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 5 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 6 */ -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 7 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > ^M > /* 8 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* 9 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* A */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* B */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > ^M > /* C */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* D */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* E */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1,^M > /* F */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, > -1,-1,-1,-1^M };^M > > Thanks, > Richard -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
On Mon, Feb 15, 2016 at 8:46 AM, Mamoru TASAKAwrote: > Richard Shaw wrote on 02/15/2016 11:34 PM: > >> Can someone point me in the right direction? My package openCOLLADA is >> FTBFS in rawhide with the following (repeating) error: >> >> >> /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: >> error: narrowing conversion of '-1' from 'int' to 'char' inside { } >> [-Wnarrowing] >>}; >> >> I tried using the gcc6 porting guide but I'm not qutie enough of a >> programmer to understand how to apply it in this case. The offending code >> is: >> >> const char HEX2DEC[256] = ^M >> {^M >> /* 0 1 2 3 4 5 6 7 8 9 A B C D E >> F >> */^M >> /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, >> -1,-1,-1,-1,^M >> /* 1 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, >> > > > > On _ARM_ (actually build failure seems to be on ARM) char is _unsigned_ > by default, so converting (int)-1 to char on ARM is narrowing conversion > and C++11 forbids this on list-initialization. > Yes, I forgot to mention this was an ARM failure, i686 and x86_64 builds will complete. > You can do this when you explicitly cast, like > const char HEX2DEC[256] = { (char)-1, . } I almost tried that but thought there might be a better way, I guess not... Thanks, Richard -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Re: openCOLLADA: Help with GCC6 narrowing conversion
Richard Shaw wrote on 02/15/2016 11:34 PM: Can someone point me in the right direction? My package openCOLLADA is FTBFS in rawhide with the following (repeating) error: /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing] }; I tried using the gcc6 porting guide but I'm not qutie enough of a programmer to understand how to apply it in this case. The offending code is: const char HEX2DEC[256] = ^M {^M /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */^M /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 1 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, On _ARM_ (actually build failure seems to be on ARM) char is _unsigned_ by default, so converting (int)-1 to char on ARM is narrowing conversion and C++11 forbids this on list-initialization. You can do this when you explicitly cast, like const char HEX2DEC[256] = { (char)-1, . } Regards, Mamoru -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
openCOLLADA: Help with GCC6 narrowing conversion
Can someone point me in the right direction? My package openCOLLADA is FTBFS in rawhide with the following (repeating) error: /builddir/build/BUILD/OpenCOLLADA-3335ac164e68b2512a40914b14c74db260e6ff7d/COLLADABaseUtils/src/COLLADABUURI.cpp:57:2: error: narrowing conversion of '-1' from 'int' to 'char' inside { } [-Wnarrowing] }; I tried using the gcc6 porting guide but I'm not qutie enough of a programmer to understand how to apply it in this case. The offending code is: const char HEX2DEC[256] = ^M {^M /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */^M /* 0 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 1 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 2 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 3 */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1, -1,-1,-1,-1,^M ^M /* 4 */ -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 5 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 6 */ -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 7 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M ^M /* 8 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* 9 */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* A */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* B */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M ^M /* C */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* D */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* E */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,^M /* F */ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1^M };^M Thanks, Richard -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org