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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to