segmentation-fault

Why does bash (from git installation) give me segmentation fault suddenly?

大憨熊 提交于 2019-12-10 10:23:03
问题 I had a Git installation (version 2.16.2) on my Windows 10 Pro. And all of a sudden, it started throwing me segmentation fault when typing commands in bash.exe (all kinds of commands). I uninstalled that version and installed the latest (2.18.0) but I still have the same issue. I don't know what to do to get my bash back. I also use Cmder which has its own bash installation and it throws me the same error. I don't know if it's of any use but here is the stackdump I got from executing ls in a

C Programming: seg faults, printf, and related quirks

て烟熏妆下的殇ゞ 提交于 2019-12-10 10:20:18
问题 As many young programmers do, I learned the usefulness of inserting numerous print-to-console statements of "here1," "here2," and so on at different points in code to figure out when my programs are going awry. This brute force debugging technique has saved me many, many times throughout my CS studies. However, when I started programming in C, I stumbled onto an interesting problem. If I were to try and run void* test; printf("hello world"); test[5] = 234; Of course I get a segfault for not

Should segmentation fault handlers be written at all by a application programmer in C?

為{幸葍}努か 提交于 2019-12-10 10:12:45
问题 If someone is a operating system programmer or writing a system level library code, it makes sense to write a segmentation fault handler. Like, for example, OS programmer would write code send a signal SIGSEGV to that application process. OR a systems library programmer might handle that signal SIGSEGV and may undo the operations caused by the library code for creating segmentation Fault. But why would an application programmer in C need to write segmentation fault handler? If he writes an

Segmentation fault on 2D array

穿精又带淫゛_ 提交于 2019-12-10 10:05:33
问题 I have the code below. When I uncomment temperature(i,j) = anode_temperature , I SegFault. forall(i=0:Cells(1), j=0:Cells(2), j >= nint(upperBoundary(i * delta(1)) / delta(2))) phi(i,j) = Anode_Voltage ! temperature(i,j) = anode_temperature end forall However, I can access every element using the code below. do i = 0,Cells(1) do j = 0,Cells(2) temperature(i,j) = anode_temperature write(*,*) i,j,temperature(i,j) enddo enddo Here is a self-contained program. Since someone mentioned they used

Debugging a Ruby segfault

百般思念 提交于 2019-12-10 04:11:50
问题 How do I determine if a segfault is due to inconsistent libraries, or a bug in some gem I'm using? $ uname -a Linux [redacted] 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux $ ruby1.9.1 --version ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] $ CPUPROFILE_OBJECTS=1 CPUPROFILE=/tmp/my_app_profile_objects RUBYOPT="-r`gem1.9.1 which perftools | tail -1`" ruby1.9.1 -e '[].map' -e:1: [BUG] Segmentation fault ruby 1.9.3p0 (2011-10-30 revision

C++11 std::vector in concurrent environment

让人想犯罪 __ 提交于 2019-12-10 03:06:57
问题 I had an issue (segfault) running a multithreaded code in C++11. Here it is the code: #include <vector> #include <thread> std::vector<int> values; int i; void values_push_back() { values.push_back(i); } int main() { while(true) { std::vector<std::thread> threads; for(i=0; i<10; ++i) { std::thread t(values_push_back); threads.push_back(std::move(t)); } for(i=0; i<10; ++i) threads[i].join(); } return 0; } And here the backtrace on gdb: http://pastebin.com/5b5TN70c What's wrong in that? 回答1:

Turning on g++ optimization causes segfault - I don't get it

戏子无情 提交于 2019-12-10 02:04:11
问题 I've been working on my program, and I decided to turn on some optimizations using g++ -O3 . Suddenly, my program started segfaulting. I've hunted the problematic code down, and minimized my program to something that still segfaults (only when using level 3 optimizations). I was hoping someone could take a quick peek at the code (I tried minimizing it as much as possible): // src/main.cpp #include "rt/lights/point.hpp" int main(int argc, char **argv) { rt::Light *light = new rt::light::Point

Why does std::sort throw a segmentation fault on this code?

社会主义新天地 提交于 2019-12-09 18:18:31
问题 Can someone explain why the sort below causes seg faults? Is this a known bug with g++ (sorting vector of pointers)? I am compiling with g++ 4.5.2. #include <iostream> #include <algorithm> #include <vector> using namespace std; typedef vector<int> A; bool face_cmp(const A *x, const A *y) { return x != y; } int main(int argc, char* argv[]) { vector<A *> vec; for (int i=0; i<100; i++) { vec.push_back( new vector<int>(i%100, i*i) ); } vector<A *>::iterator it; sort(vec.begin(), vec.end(), face

grep -f on OS X produces segfault

徘徊边缘 提交于 2019-12-09 16:51:36
问题 If you've got a Mac, try this: echo 'abcd*' > grepfile echo 'abc$' >> grepfile echo '^abc' >> grepfile echo "fojeiwuroiuwet\nljfajsljkfabcdddjlfkajlkj\nabcaaa\nzzzabc\n" | grep -f grepfile Here's the version: $ grep --v grep (BSD grep) 2.5.1-FreeBSD This is a machine (a rMBP of the 2012 flavor) that's kept up with Apple's software updates, so I am on 10.8.4. I verified that GNU grep compiled from source does not suffer from this problem. Indeed it is version 2.14, which is a whole lot of

Why does Linux program that derefrences (char*)0 not always segfault?

蹲街弑〆低调 提交于 2019-12-09 13:01:43
问题 I'm testing code that is designed to detect when a child process has segfaulted. Imagine my surprised when this code does not always segfault: #include <stdio.h> int main() { char *p = (char *)(unsigned long)0; putchar(*p); return 0; } I'm running under a Debian Linux 2.6.26 kernel; my shell is the AT&T ksh93 from the Debian ksh package, Version M 93s+ 2008-01-31. Sometimes this program segfault but otherwise it simply terminates silently with a nonzero exit status but no message. My signal