[LLVMbugs] [Bug 20094] New: miscompilation of shared mem linked list code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 21 01:40:27 PDT 2014


            Bug ID: 20094
           Summary: miscompilation of shared mem linked list code
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: markokr at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12690
  --> http://llvm.org/bugs/attachment.cgi?id=12690&action=edit
code that fails

clang miscompiles shlist_remove() function in attached code.

when removing only element from list, both structs should end up with zeroes,
but clang code fails.

uncommenting the magic printf() or disabling optimizations will fix it.

$ clang -v
Ubuntu clang version 3.4.1-1~exp1 (branches/release_34) (based on LLVM 3.4.1)
Target: x86_64-pc-linux-gnu
$ clang -O shlist.c
$ ./a.out
after remove:
  list: 16 / 16
  node: 0 / 0
fail: list
$ clang -O0 shlist.c
$ ./a.out
after remove:
  list: 0 / 0
  node: 0 / 0

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/20140621/f142e9fe/attachment.html>

More information about the llvm-bugs mailing list