[LLVMbugs] [Bug 24158] New: -03 Optimization causes function to execute twice

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 16 11:43:10 PDT 2015


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

            Bug ID: 24158
           Summary: -03 Optimization causes function to execute twice
           Product: new-bugs
           Version: 3.6
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: hbowden at securelabsllc.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I started writing a new C project and I noticed that a function was executing
twice even though It's only being called once. While trying to figure out what
was going on I removed, -O3 from the Makefile and built and ran the program and
saw that the function was no longer being called twice.

To reproduce the problem pull the repository below, don't worry there's barely
any code, it's a new project.

https://github.com/Secure-Labs/nextgen.git

Then use gmake to build the project, I put the -O3 back in the Makefile, and
I'm using clang 3.6.1 on FreeBSD 10.1 Release.

To run the program use sudo ./nextgen --file --in / --out / --exec /usr/bin/ls

The function that's being called twice is start_runtime which is in the file
runtime.c and starts on line 90. start_runtime is called from nextgen.c in
main.

Remove -03 from the makefile and start_runtime is only executed once.

-- 
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/20150716/a681a583/attachment.html>


More information about the llvm-bugs mailing list