Red Hat Bugzilla – Bug 131679
Compiling in 64-bit yields segmentation fault when program run, 32-bit compilation is fine
Last modified: 2007-11-30 17:10:48 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Description of problem:
Compiling a simple C program with gcc in 64-bit mode. When the program
is run, it seg faults. GDB reports:
Program received signal SIGSEGV, Segmentation fault.
0x000000344026e3a0 in strlen () from /lib64/tls/libc.so.6
#0 0x000000344026e3a0 in strlen () from /lib64/tls/libc.so.6
#1 0x0000003440240a01 in vfprintf () from /lib64/tls/libc.so.6
#2 0x0000000000400570 in io_vprint ()
#3 0x0000000000400644 in io_printf ()
#4 0x00000000004006cc in main ()
When the same C program is compiled with gcc but in 32-bit mode (with
the flag -m32) it works fine.
The program being used is attached and can also be downloaded at:
Version-Release number of selected component (if applicable):
kernel-2.6.5-1.358 gcc-3.4.1-9 glibc-2.3.3-27
Steps to Reproduce:
1. gcc -Wall test_var.c -o test
Actual Results: The message is outputted to the command line
(correct) along with the error message "Segmentation fault".
Expected Results: The message should be outputted to the command
line, but also a file (temp3.txt) should be created and the same
message should be written into that file.
Building on an Athlon64, FC2 X86_64.
Created attachment 103420 [details]
The test file that I was testing 64-bit compilation with.