[llvm-bugs] [Bug 41391] New: "Function marked read-only and write-only" assertion at -O1

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 5 05:20:08 PDT 2019


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

            Bug ID: 41391
           Summary: "Function marked read-only and write-only" assertion
                    at -O1
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: luke.lau at intel.com
                CC: llvm-bugs at lists.llvm.org

Using clang to compile the following C code at -O1:

```
int i = 0;
void foo();
void bar() { if (!i) foo(); }
void foo() { i = 1; bar(); }
```

> clang -O1 test.c

... clang-8: llvm-project/llvm/lib/Transforms/IPO/FunctionAttrs.cpp:263: bool
addReadAttrs(const (anonymous namespace)::SCCNodeSet &, AARGetterT &&)
[AARGetterT = llvm::LegacyAARGetter &]: Assertion `!(ReadsMemory &&
WritesMemory) && "Function marked read-only and write-only"' failed.


> clang -v

clang version 9.0.0 (https://github.com/llvm/llvm-project.git
31e4fec3c021b21eae8cb7b26691632716c1e3cc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/luke/Source/llvm-project/build/./bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20190405/9fb2d9a6/attachment.html>


More information about the llvm-bugs mailing list