[llvm-bugs] [Bug 25852] New: operation on bit-fields shall yield results reduced to bit-field size

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 16 04:52:40 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25852

            Bug ID: 25852
           Summary: operation on bit-fields shall yield results reduced to
                    bit-field size
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: konstantin.vladimirov at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15468
  --> https://llvm.org/bugs/attachment.cgi?id=15468&action=edit
bitfield reproduction

The test (attached) is taken from gcc dejagnu and minimized. Clang 3.7 yields:

  %bf.load = load i64, i64* bitcast ({ i8, i8, i8, i8, i8, [3 x i8], i8, i8,
i8, i8, i8, [3 x i8], i8, i8, i8, i8, i8, i8, [2 x i8] }* @a to i64*), align 8
  %bf.clear = and i64 %bf.load, 8589934591
  %mul = mul i64 %bf.clear, %bf.clear
  %cmp = icmp eq i64 %mul, 0                      
  br i1 %cmp, label %if.end, label %if.then

But after multiplication result should be casted to bitfield type, i.e. 33-bit.
Compare to GCC gimple:

  <unnamed-unsigned:33> D.2209D.2209;
  <unnamed-unsigned:33> D.2208D.2208;

<bb 2>:
  D.2208D.2208_1 = a.u33;
  D.2208D.2208_2 = a.u33;
  D.2209D.2209_3 = D.2208D.2208_2 * D.2208D.2208_2;
  if (D.2209D.2209_3 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

Which is correct.

Please fix this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151216/b3e0c87c/attachment.html>


More information about the llvm-bugs mailing list