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 fortran/21125] New: gfortran - bus error printing warning message


I get a bus error when I try to compile this program. If you look at the trace
back, translate_common was making a call to gfc_warning with this statement -

	      gfc_warning ("Padding of %d bytes required before '%s' in "
			   "COMMON '%s' at %L", offset, s->sym->name,
			   common->name, &common->where);
	    }

offset is declared by -

  HOST_WIDE_INT offset;

on the Macintosh, the program is crashing because HOST_WIDE_INT is 8 bytes and
the %d format is only skipping 4 bytes throwing off the address for the later
arguments. Cast statements are needed on the calls with the "long int" to
gfc_warning or a new "%ld" option needs to be added to gfc_warning.



[dranta:~/tests/gfortran] dir% gfortran -c tex3d.f
tex3d.f: In function 'MAIN__':
tex3d.f:9: internal compiler error: Segmentation Fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
[dranta:~/tests/gfortran] dir% cat tex3d.f
      PROGRAM GAP3D
C     IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      DOUBLE PRECISION NINE,NINETH,MILLON
      COMMON /FLTNUM/ ZERO,ONE,TWO,THREE,FOUR,FIVE,SIX,SEVEN,EIGHT,
     1   NINE,TEN,HALF,THIRD,FOURTH,FIFTH,SIXTH,SEVNTH,EIGHTH,NINETH,
     2   TENTH,HUNDRD,THOU,MILLON
C
C
      END


Thread 0 Crashed:
0   f951 	0x00014d40 error_print + 0x120 (error.c:435)
1   f951 	0x00014d30 error_print + 0x110 (error.c:435)
2   f951 	0x00015b3c gfc_warning + 0xbc (error.c:541)
3   f951 	0x0005c810 translate_common + 0x214 (trans-common.c:874)
4   f951 	0x0004d834 gfc_traverse_symtree + 0x28 (symbol.c:2283)
5   f951 	0x0005c9dc gfc_trans_common + 0x80 (trans-common.c:967)
6   f951 	0x00061ab4 gfc_generate_function_code + 0xc0 (trans-decl.c:2212)
7   f951 	0x00053850 gfc_generate_code + 0xc8 (trans.c:678)
8   f951 	0x00038b8c gfc_parse_file + 0x2c4 (parse.c:2637)
9   f951 	0x0004ed68 gfc_be_parse_file + 0x20 (f95-lang.c:264)
10  f951 	0x0034b8e4 compile_file + 0x70 (toplev.c:1004)
11  f951 	0x0034d894 do_compile + 0xac (toplev.c:2122)
12  f951 	0x0034d918 toplev_main + 0x58 (toplev.c:2154)
13  f951 	0x00001ae0 _start + 0x188 (crt.c:267)
14  dyld 	0x8fe1a558 _dyld_start + 0x64

-- 
           Summary: gfortran - bus error printing warning message
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dir at lanl dot gov
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: powerpc-apple-darwin7.8.0


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


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