|
From: | Paul Eggert |
Subject: | Re: [PATCH 0/3] yacc: compute the best type for the state number |
Date: | Sun, 6 Oct 2019 12:06:27 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 10/6/19 4:57 AM, Akim Demaille wrote:
With the appended commits, the CI is green again, and I was able to push my other changes.
Thanks. I reproduced the GCC 4.8 problem and installed a patch that works around it without casts (see first attached patch).
"\"".c:1102:41: error: implicit conversion loses integer precision: 'long' to 'int' [-Werror,-Wshorten-64-to-32] YYPTRDIFF_T yysize = yyssp - yyss + 1; ~~~~~~ ~~~~~~~~~~~~~^~~
This is a more serious problem, as it says that YYPTRDIFF_T is 'int' on a platform where ptrdiff_t is really 'long', which means Bison-generated parsers could mishandle vary large inputs. That is, the clang diagnostic is pointing out an (unlikely) bug, and is not a false alarm.
Although I installed the second attached patch which I hope works around the immediate problem, a better fix is needed here. With a C++ compiler, the definition of YYPTRDIFF_T should not be a guess at 'int' or 'long'; it should be the proper C++ type for pointer subtraction results. When you find the time I'd be interested to see the proper portable C++ magic to do that.
0001-Work-around-GCC-4.8-false-alarms-without-casts.patch
Description: Text Data
0002-Port-better-to-C-platforms.patch
Description: Text Data
[Prev in Thread] | Current Thread | [Next in Thread] |