[llvm-bugs] [Bug 26891] New: C: Feature-request: diagnostic for assignments of read-only locations (eg string literals)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 9 12:10:17 PST 2016


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

            Bug ID: 26891
           Summary: C: Feature-request: diagnostic for assignments of
                    read-only locations (eg string literals)
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrey.vul at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This is a feature-request for Clang to emit a diagnostic related to assignment
to string-only location, as is seen in the test-case. 
The fact that this is UB via const-violation is obvious, but gcc emits a
diagnostic since 4.8 or earlier.

Test case:

int main() {
"abc"[1] = '1';
}

-- 
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/20160309/9d275b39/attachment.html>


More information about the llvm-bugs mailing list