This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/61158] New: negative shift at fold-const.c:12095


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]