From 694a18993c54415ba7936a236253fee9685ae711 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 18 Nov 2013 17:35:01 -0800 Subject: [PATCH] quotearg: don't attempt to store 1 << 31 into an "int" * lib/quotearg.c (quotearg_buffer_restyled): Building coreutils with gcc's new -fsanitize=undefined and running its tests triggered some new test failures, all with this diagnostic: lib/quotearg.c:629:62: runtime error: left shift of 1 by 31 places \ cannot be represented in type int Use "1U << ..." in place of "1 << ...". --- ChangeLog | 10 ++++++++++ lib/quotearg.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index aae8c64..7735293 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-11-18 Jim Meyering + + quotearg: don't attempt to store 1 << 31 into an "int" + * lib/quotearg.c (quotearg_buffer_restyled): Building coreutils + with gcc's new -fsanitize=undefined and running its tests triggered + some new test failures, all with this diagnostic: + lib/quotearg.c:629:62: runtime error: left shift of 1 by 31 places \ + cannot be represented in type int + Use "1U << ..." in place of "1 << ...". + 2013-11-13 Paul Eggert * lib/getgroups.c (posix_getgroups, getgroups) [__APPLE__]: diff --git a/lib/quotearg.c b/lib/quotearg.c index 40114d7..51ae311 100644 --- a/lib/quotearg.c +++ b/lib/quotearg.c @@ -626,7 +626,7 @@ quotearg_buffer_restyled (char *buffer, size_t buffersize, if (! ((backslash_escapes || elide_outer_quotes) && quote_these_too - && quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))) + && quote_these_too[c / INT_BITS] & (1U << (c % INT_BITS))) && !is_right_quote) goto store_c; -- 1.8.4.rc0.11.g35f5eaa