<html><head></head><body>Hi,<br><br>The signedness of literal constants does not affect the occurrence of overflowing conversion. +200 cannot be represented by int8_t regardless if it's originally an unsigned int or signed int.<br><br><div class="gmail_quote">Le 28 janvier 2020 14:13:50 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">On 2020-01-11 3:47, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Is overflowing conversion to signed type well defined in C++? I'm pretty <br>sure it's implementation-defined in C.<br></blockquote><br>The literal constants are signed by default. The casting from int to <br>int8_t is also signed so the values are preserved correctly. (verified <br>with gcc and llvm)<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Le 10 janvier 2020 18:54:08 GMT+09:00, Steve Lhomme <robux4@ycbcr.xyz> a <br>écrit :<br><br> When using 0xXX notation the issue we also have to adjust the width.<br><br> Fixes compilation with gcc 9 for Raspberry:<br><br> compile: arm-linux-gnueabihf-g++ -DHAVE_CONFIG_H -Icontrib/arm-linux-gnueabihf/include -Icontrib/arm-linux-gnueabihf/include -g -O2 -DHAVE_UNIX -I../../include -I../../include/sidplay -c xsid.cpp -fPIC -DPIC -o xsid.o<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\200'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> 101 | };<br> | ^<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\224'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\251'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\274'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\316'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\341'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> xsid.cpp:101:1: error: narrowing conversion of ‘'\362'’ from ‘char’ to ‘int8_t’ {aka ‘signed char’} [-Wnarrowing]<br> make[4]: *** [Makefile:409: xsid.lo] Error 1<hr> contrib/src/sidplay2/rules.mak | 1 +<br> contrib/src/sidplay2/sidplay2-char-cast.patch | 13 +++++++++++++<br> 2 files changed, 14 insertions(+)<br> create mode 100644 contrib/src/sidplay2/sidplay2-char-cast.patch<br><br> diff --git a/contrib/src/sidplay2/rules.mak b/contrib/src/sidplay2/rules.mak<br> index 84c35ccfee7..de77935774a 100644<br> --- a/contrib/src/sidplay2/rules.mak<br> +++ b/contrib/src/sidplay2/rules.mak<br> @@ -25,6 +25,7 @@ sidplay-libs: sidplay-libs-$(SID_VERSION).tar.gz .sum-sidplay2<br> $(APPLY) $(SRC)/sidplay2/sidplay2-string.patch<br> $(APPLY) $(SRC)/sidplay2/sidplay-fix-ln-s.patch<br> $(APPLY) $(SRC)/sidplay2/sidplay2-resid-dependency.patch<br> + $(APPLY) $(SRC)/sidplay2/sidplay2-char-cast.patch<br> $(MOVE)<br> <br> .sidplay2: sidplay-libs<br> diff --git a/contrib/src/sidplay2/sidplay2-char-cast.patch b/contrib/src/sidplay2/sidplay2-char-cast.patch<br> new file mode 100644<br> index 00000000000..14eda139606<br> --- /dev/null<br> +++ b/contrib/src/sidplay2/sidplay2-char-cast.patch<br> @@ -0,0 +1,13 @@<br> +--- sidplay-libs/libsidplay/src/xsid/xsid.cpp.char 2004-06-14 22:08:02.000000000 +0200<br> ++++ sidplay-libs/libsidplay/src/xsid/xsid.cpp 2020-01-10 08:41:49.454974200 +0100<br> +@@ -96,8 +96,8 @@ const int8_t XSID::sampleConvertTable[16<br> + */<br> + const int8_t XSID::sampleConvertTable[16] =<br> + {<br> +- '\x80', '\x94', '\xa9', '\xbc', '\xce', '\xe1', '\xf2', '\x03',<br> +- '\x1b', '\x2a', '\x3b', '\x49', '\x58', '\x66', '\x73', '\x7f'<br> ++ (int8_t)0x80, (int8_t)0x94, (int8_t)0xa9, (int8_t)0xbc, (int8_t)0xce, (int8_t)0xe1, (int8_t)0xf2, (int8_t)0x03,<br> ++ (int8_t)0x1b, (int8_t)0x2a, (int8_t)0x3b, (int8_t)0x49, (int8_t)0x58, (int8_t)0x66, (int8_t)0x73, (int8_t)0x7f<br> + };<br> +<br> + const char *XSID::credit =<br><br><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser <br>ma brièveté.<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>