This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/26991] Target Help Seg Fault.



------- Comment #3 from corsepiu at gcc dot gnu dot org  2006-06-26 16:41 -------
Traceback:

Program received signal SIGSEGV, Segmentation fault.
print_filtered_help (flag=4194304) at ../../gcc-4.1.1/gcc/opts.c:1301
(gdb) where
#0  print_filtered_help (flag=4194304) at ../../gcc-4.1.1/gcc/opts.c:1301
#1  0x081f61d7 in decode_options (argc=13, argv=0xbfc6fc34) at
../../gcc-4.1.1/gcc/opts.c:738
#2  0x08243b08 in toplev_main (argc=13, argv=0xbfc6fc34) at
../../gcc-4.1.1/gcc/toplev.c:1975
#3  0x080978f2 in main (argc=0, argv=0x1f9) at ../../gcc-4.1.1/gcc/main.c:35
#4  0x00b68724 in __libc_start_main () from /lib/libc.so.6
#5  0x08049ad1 in _start ()

The offending code is this (From gcc-4.1.1/gcc/opts.c):

1293   const char *help, *opt, *tab;
1294   static char *printed;
1295 
1296   if (flag == CL_COMMON || flag == CL_TARGET)
1297     {
1298       filter = flag;
1299       if (!printed)
1300         printed = xmalloc (cl_options_count);
1301       memset (printed, 0, cl_options_count);
1302     }

=> the SEGFAULT occurs in memset.

Could it be, "static char* printed" should be initialized = 0?

I.e. static char* printed = 0;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26991


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]