[llvm-bugs] [Bug 44975] New: 'Segmentation fault: 11' in the special index for an array

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 20 08:53:00 PST 2020


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

            Bug ID: 44975
           Summary: 'Segmentation fault: 11' in the special index for an
                    array
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Hi, I am developing a random c generation tool to find c compiler bugs.

I found an interesting code that compiles successfully but get a "Segmentation
fault:11" result when executing it.

The c code is 

void foo(int* a ) {
  a[8]=1;
}
int main (int argc, char* argv[]) {
  int array[] = {0};
  foo(array);
  return 0;
}

My compile command is "clang-6.0 test.cc" and it succeeds. Then I execute it
using "./a.out" but I got a "Segmentation fault:11" error. 

I know we should initialize an array before using it. But the most interesting
thing is that only an index of 8 in a array can trigger the error, other index
is fine for execution.

I test the code in clang-3.8, clang-6.0, clang-7 in ubuntu16.04 and got the
same error.

-- 
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/20200220/5b721991/attachment.html>


More information about the llvm-bugs mailing list