segmentation-fault

Python core dump on sys.exit() from signal handler

北城以北 提交于 2020-01-13 06:14:08
问题 I am seeing python core dump for a seemingly harmless program. I have written following piece of code to demonstrate my problem: proc = None def __signalHandler(signum, frame): print "In __signalHandler" if proc is not None: print "Send signal to BG proc" os.killpg(os.getpgid(proc.pid), signal.SIGINT) print "Wait for it to finish" proc.communicate() print "sys exit" sys.exit(130) signal.signal(signal.SIGINT, __signalHandler) # Start the process proc = subprocess.Popen(["a.out"], stdout

Using STL vector with SIMD intrinsic data type

China☆狼群 提交于 2020-01-13 03:14:13
问题 As the title reads, I am trying to use STL vector with SIMD intrinsic data type. I know it is not a good practice due to the potential overhead of load/store, but I encountered a quite weird fault. Here is the code: #include "immintrin.h" #include <vector> #include <stdio.h> #define VL 8 int main () { std::vector<__m256> vec_1(10); std::vector<__m256> vec_2(10); float * tmp_1 = new float[VL]; printf("vec_1[0]:\n"); _mm256_storeu_ps(tmp_1, vec_1[0]); // seems to go as expected for (int i = 0;

ifort and out of bound Index - Odd Behaviour

浪尽此生 提交于 2020-01-11 13:36:46
问题 Recently I've resumed Fortran and probably there's something I'm missing but this behaviour looks very odd When I run the following code (compiled with ifort), that just declares an array and sets one of his elements PROGRAM sol_kernel2 IMPLICIT NONE INTEGER, PARAMETER :: jpi=5,jpj=5 REAL, DIMENSION(jpi,jpj) :: sshn PRINT *,jpi,jpj sshn(10,10) = 150.0 PRINT *,sshn(10,10) END PROGRAM sol_kernel2 I expect to get an ERROR Statement, such as SEGMENTATION FAULT, since I'm trying to set the sshn

ifort and out of bound Index - Odd Behaviour

蹲街弑〆低调 提交于 2020-01-11 13:36:18
问题 Recently I've resumed Fortran and probably there's something I'm missing but this behaviour looks very odd When I run the following code (compiled with ifort), that just declares an array and sets one of his elements PROGRAM sol_kernel2 IMPLICIT NONE INTEGER, PARAMETER :: jpi=5,jpj=5 REAL, DIMENSION(jpi,jpj) :: sshn PRINT *,jpi,jpj sshn(10,10) = 150.0 PRINT *,sshn(10,10) END PROGRAM sol_kernel2 I expect to get an ERROR Statement, such as SEGMENTATION FAULT, since I'm trying to set the sshn

ifort and out of bound Index - Odd Behaviour

Deadly 提交于 2020-01-11 13:36:08
问题 Recently I've resumed Fortran and probably there's something I'm missing but this behaviour looks very odd When I run the following code (compiled with ifort), that just declares an array and sets one of his elements PROGRAM sol_kernel2 IMPLICIT NONE INTEGER, PARAMETER :: jpi=5,jpj=5 REAL, DIMENSION(jpi,jpj) :: sshn PRINT *,jpi,jpj sshn(10,10) = 150.0 PRINT *,sshn(10,10) END PROGRAM sol_kernel2 I expect to get an ERROR Statement, such as SEGMENTATION FAULT, since I'm trying to set the sshn

Why does C++ array creation cause segmentation fault?

♀尐吖头ヾ 提交于 2020-01-11 12:55:14
问题 I have a program that needs an array of set<vector<bool>> . For the small value of array size, the program works well. When the program runs into large array size, it exits with exit code -1073741571. So, I debug the code and find when it occurs. Below is the simplest code that reproduces my error. #include <iostream> #include <cmath> #include <omp.h> #include <set> #include <vector> using namespace std; int main() { set<vector<bool>> C[43309]; } Values smaller than 43309 cause no error. I

Segmentation fault (core dumped) in a simple C code

倖福魔咒の 提交于 2020-01-11 09:58:07
问题 I am new in C. I am referring to the book "The C Programming Language" by Brian W Kernighian and Dennis Ritchie. There is a code for pointer increment and assignment given in the book as follows. #include<stdio.h> int main() { char *s = "Goal"; char *t = "Home"; while(*s++ = *t++) printf(*s); return 0; } The code is saved and compiled using the command gcc ptr.c -o ptr -std=c99 Now on running the code by running command ./ptr I get the following error Segmentation fault (core dumped) The

Allocate a string array from inside a function in C

天涯浪子 提交于 2020-01-11 09:19:45
问题 I have a function that scans a file and returns the number of the lines along with the lines in a string array, my function looks like this : int load_lines(char* _file, char** _array){ FILE *infile; char line_buffer[BUFSIZ]; char line_number; infile = fopen(_file, "r"); ine_number = 0; while (fgets(line_buffer, sizeof(line_buffer), infile)) ++line_number; fclose(infile); _array = malloc (line_number * sizeof(char*)); infile = fopen(_file, "r"); line_number = 0; while (fgets(line_buffer,

Segmentation fault due to recursion

混江龙づ霸主 提交于 2020-01-11 04:05:10
问题 I'm writing a program that is to take a number between 1-10 and display all possible ways of arranging the numbers. Ex input: 3 output: 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 Whenever I input 9 or 10, the program gives a segmentation fault and dumps the core. I believe the issue is my recursive algorithm is being called too many times. Could someone help point out how I could limit the amount of recursive calls necessary? Here is my current code: void rearange(int numbers[11], int index, int num

Python Segmentation fault: 11 on OSX

送分小仙女□ 提交于 2020-01-10 09:54:07
问题 Im starting development with python, and tried some simple commands like calculations. But, some times python aborts with "Segmentation fault:11" In google i didnt find a similar issue or solution for that. Python is installed with homebrew. home-brew doctor command don't show any issues for the python installation and is up to date. Have anyone an Idea how to fix this ? Here is the OSX Crash Log: http://pastebin.com/rKpPJKxJ 回答1: Hmmm... spread the word. The following seems that it fixed it: