[llvm-bugs] [Bug 34827] New: Csmith program prints checksum at -O0, but crashes at -O1

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 3 23:02:23 PDT 2017


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

            Bug ID: 34827
           Summary: Csmith program prints checksum at -O0, but crashes at
                    -O1
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: paulsson at linux.vnet.ibm.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19228
  --> https://bugs.llvm.org/attachment.cgi?id=19228&action=edit
reduced testcase

Csmith generated a program that when built and executed at -O0 gives completely
different behaviour as when the same is done with -O1:

bin/clang -O0 -march=z13 tc_O1IllegalIns.ll -o a.out
./a.out 
checksum = F8458AC2

bin/clang -O1 -march=z13 tc_O1IllegalIns.ll -o a.out
./a.out 
Illegal instruction (core dumped)

>From what I am seeing, the Trap instruction is generated at -O1, but not at
-O0, and my best guess is that this difference is the reason for the crash with
-O1.

tc_O1IllegalIns.ll is the reduced input that has apparently the same behaviour
as the original csmith program.

Is this expected for some reason, or should this be fixed per the rule that
optimization levels should not affect the program result?

-- 
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/20171004/8ccae3d6/attachment.html>


More information about the llvm-bugs mailing list