segfault in translate_common()

Bernhard Fischer rep.nop@aon.at
Wed Aug 10 18:27:00 GMT 2005


Hi,

I'm seeing this:

Program received signal SIGSEGV, Segmentation fault.
translate_common (common=0x8606580, var_list=0x864c9f0) at
../../../src/gcc/gcc/fortran/trans-common.c:823
823		  align = TYPE_ALIGN_UNIT (s->field);
(gdb) bt
#0  translate_common (common=0x8606580, var_list=0x864c9f0) at
../../../src/gcc/gcc/fortran/trans-common.c:823
#1  0x080a1a0b in named_common (st=0x0) at
../../../src/gcc/gcc/fortran/trans-common.c:931
#2  0x08092f39 in gfc_traverse_symtree (st=0x8606560, func=0x80a19f0
<named_common>)
    at ../../../src/gcc/gcc/fortran/symbol.c:2295
#3  0x08092f48 in gfc_traverse_symtree (st=0x86066c8, func=0x80a19f0
<named_common>)
    at ../../../src/gcc/gcc/fortran/symbol.c:2297
#4  0x080a1a3a in gfc_trans_common (ns=0x86053c0) at
../../../src/gcc/gcc/fortran/trans-common.c:956
#5  0x080a5881 in gfc_generate_function_code (ns=0x86053c0) at
../../../src/gcc/gcc/fortran/trans-decl.c:2343
#6  0x08099833 in gfc_generate_code (ns=0x86053c0) at
../../../src/gcc/gcc/fortran/trans.c:681
#7  0x0807f91d in gfc_parse_file () at
../../../src/gcc/gcc/fortran/parse.c:2639
#8  0x08094100 in gfc_be_parse_file (set_yydebug=0) at
../../../src/gcc/gcc/fortran/f95-lang.c:256
#9  0x082f4c00 in compile_file () at ../../../src/gcc/gcc/toplev.c:971
#10 0x082f632b in do_compile () at ../../../src/gcc/gcc/toplev.c:1914
#11 0x082f63a5 in toplev_main (argc=0, argv=0xbffff634) at
../../../src/gcc/gcc/toplev.c:1946
#12 0x080b97fb in main (argc=0, argv=0x0) at
../../../src/gcc/gcc/main.c:35

Unfortunately I cannot provide a simple testcase for this so far.

I take it that there is something else wrong as the attached would make
it not segfault, but is most likely not the right fix.

Ideas?
-- 
Bernhard
-------------- next part --------------
Index: gcc/fortran/trans-common.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/trans-common.c,v
retrieving revision 1.30
diff -u -p -r1.30 trans-common.c
--- gcc/fortran/trans-common.c	6 Aug 2005 12:56:18 -0000	1.30
+++ gcc/fortran/trans-common.c	10 Aug 2005 16:40:57 -0000
@@ -813,11 +813,10 @@ translate_common (gfc_common_head *commo
   /* Add symbols to the segment.  */
   for (sym = var_list; sym; sym = sym->common_next)
     {
-      if (sym->equiv_built)
+      if (sym->equiv_built && (s = find_segment_info (sym)) != NULL)
 	{
 	  /* Symbol has already been added via an equivalence.  */
 	  current_segment = common_segment;
-	  s = find_segment_info (sym);
 
 	  /* Ensure the current location is properly aligned.  */
 	  align = TYPE_ALIGN_UNIT (s->field);


More information about the Fortran mailing list