This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/61158] New: negative shift at fold-const.c:12095
- From: "zeccav at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 May 2014 18:03:26 +0000
- Subject: [Bug c/61158] New: negative shift at fold-const.c:12095
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61158
Bug ID: 61158
Summary: negative shift at fold-const.c:12095
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
Compilation of the following forces a negative shift, result undefined in my
opinion
/* gcc -S negative shift at fold-const.c:12095
* x86_64
* "zerobits <<= prec - shiftc;"
* because prec - shiftc = -8
* result is undefined
* compiling Linux Fedora 20 source code kernel/trace/blktrace.c
* checked with "gcc_assert(prec >= shiftc && prec-shiftc <
HOST_BITS_PER_WIDE_INT);" immediately before
*/
typedef unsigned long long __u64;
void blk_add_trace_unplug(unsigned int depth)
{
((__u64)(depth) & (__u64)0x00ff000000000000ULL) >> 40;
}