[R-SIG-Mac] Problem with gfortran 4.8.2

Berend Hasselman bhh at xs4all.nl
Sat May 24 09:23:40 CEST 2014


I am experiencing a problem with gfortran 4.8.2 obtained from r.research.att.com (http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2).

Compiling a simple program (in fixed format)

      program test2
          double precision a
          a = 12.438739
          print *, a      
     stop     
     end

on a Mac Mini with the following hardware review

  Model Name:	Mac mini
  Model Identifier:	Macmini4,1
  Processor Name:	Intel Core 2 Duo
  Processor Speed:	2.66 GHz
  Number of Processors:	1
  Total Number of Cores:	2
  L2 Cache:	3 MB
  Memory:	8 GB
  Bus Speed:	1.07 GHz
  Boot ROM Version:	MM41.0042.B03
  SMC Version (system):	1.65f2

running with OS X Mavericks 10.9.3 (13D65) leads to a crash of f951.
This is what appears in Terminal:

[.../test2]: gfortran test2.f
f951: internal compiler error: Illegal instruction: 4

f951: internal compiler error: Abort trap: 6
gfortran: internal compiler error: Abort trap: 6 (program f951)
Abort trap: 6

Following a discussion in http://trac.macports.org/ticket/41364 I ran the debugger lldb.
With this as result

[.../test2]: lldb -- /usr/local/libexec/gcc/x86_64-apple-darwin13.0.0/4.8.2/f951 test2.f
Current executable set to '/usr/local/libexec/gcc/x86_64-apple-darwin13.0.0/4.8.2/f951' (x86_64).
(lldb) run
Process 1755 launched: '/usr/local/libexec/gcc/x86_64-apple-darwin13.0.0/4.8.2/f951' (x86_64)
Process 1755 stopped
* thread #1: tid = 0x6bb2, 0x0000000100914486 f951`__gmpn_popcount + 134, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000100914486 f951`__gmpn_popcount + 134
f951`__gmpn_popcount + 134:
-> 0x100914486:  popcntq 0x38(%rdi,%rsi,8), %r9
   0x10091448d:  addq   %r9, %rax
   0x100914490:  addq   $0x8, %rsi
   0x100914494:  js     0x100914440               ; __gmpn_popcount + 64
(lldb) bt
* thread #1: tid = 0x6bb2, 0x0000000100914486 f951`__gmpn_popcount + 134, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x0000000100914486 f951`__gmpn_popcount + 134
    frame #1: 0x00000001008fac03 f951`parsed_string_to_mpfr + 2595
    frame #2: 0x00000001008fa0ee f951`mpfr_strtofr + 1870
    frame #3: 0x00000001008e3520 f951`mpfr_set_str + 32
    frame #4: 0x00000001000043cc f951`gfc_convert_real(char const*, int, locus*) + 44
    frame #5: 0x0000000100078fce f951`match_real_constant(gfc_expr**, int) + 798
    frame #6: 0x000000010007a50c f951`gfc_match_literal_constant(gfc_expr**, int) + 1404
    frame #7: 0x0000000100061097 f951`match_mult_operand(gfc_expr**) + 87
    frame #8: 0x000000010006137d f951`match_add_operand(gfc_expr**) + 29
    frame #9: 0x00000001000616c5 f951`match_level_2(gfc_expr**) + 261
    frame #10: 0x0000000100061785 f951`match_level_3(gfc_expr**) + 21
    frame #11: 0x00000001000618b6 f951`match_and_operand(gfc_expr**) + 54
    frame #12: 0x0000000100061ab5 f951`match_or_operand(gfc_expr**) + 21
    frame #13: 0x0000000100061bc5 f951`match_equiv_operand(gfc_expr**) + 21
    frame #14: 0x0000000100061cd7 f951`match_level_5(gfc_expr**) + 23
    frame #15: 0x0000000100060f47 f951`gfc_match_expr(gfc_expr**) + 23
    frame #16: 0x000000010005a48a f951`gfc_match(char const*, ...) + 842
    frame #17: 0x000000010005baec f951`gfc_match_assignment() + 124
    frame #18: 0x000000010007102a f951`match_word(char const*, match (*)(), locus*) (.part.3) + 10
    frame #19: 0x00000001000726d5 f951`decode_statement() + 229
    frame #20: 0x0000000100073f6a f951`next_statement() + 810
    frame #21: 0x0000000100074b2d f951`parse_spec(gfc_statement) + 1325
    frame #22: 0x0000000100076fb9 f951`parse_progunit(gfc_statement) + 9
    frame #23: 0x00000001000782e7 f951`gfc_parse_file() + 1127
    frame #24: 0x00000001000b7f46 f951`gfc_be_parse_file() + 38
    frame #25: 0x000000010063d774 f951`compile_file() + 52
    frame #26: 0x000000010063f519 f951`toplev_main(int, char**) + 2825
(lldb) 


Compiling the exact same program on a Macbook Air 11-inch with an Intel Core i5 as processor  and the exact same OS X 10.9.3 does not give an internal compiler error at all. The program compiles and runs.

It seems the crash in connected to the Intel Core 2 Duo processor in this case.
gfortran-4.2.3 obtained from CRAN compiles the program without any problems.

Since I maintain packages using Fortran I can’t switch to the Mavericks distribution of R and use gfortran 4.8.2.
Using the Snow Leopard  version of R together with gfortran 4.2.3 from CRAN works perfectly.

Maybe someone can throw some light on this and hopefully the problem can be fixed.

Berend



More information about the R-SIG-Mac mailing list