Re: gcc 4.9.1 Bug or not

2014-10-09 Thread Jakub Jelinek
On Thu, Oct 09, 2014 at 01:54:57PM +0800, Rongqing Li wrote: > The attachment is a piece of C code. > When compile it with -O2 option, a segfault occurs: > > strncpy(new, old, cp-old); It is a bug of course, but in the testcase. Calling strncpy with NULL second argument, even when the size

gcc 4.9.1 Bug or not

2014-10-08 Thread Rongqing Li
The attachment is a piece of C code. When compile it with -O2 option, a segfault occurs: ## root@qemux86-64:~# gcc -o test test.c root@qemux86-64:~# ./test 192.168.1.1 root@qemux86-64:~# root@qemux86-64:~# gcc -O2 -o test test.c root@qemux86-64:~# ./test test[893]: segfault at 0 ip