Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#41555 closed defect (worksforme)

gcc46: gfortran not working after upgrade

Reported by: liampg72@… Owned by: mww@…
Priority: Normal Milestone:
Component: ports Version: 2.2.1
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), kurtjaeke@…, cooljeanius (Eric Gallager)
Port: gcc46

Description

I did selfupdate and upgrade outdated recently and gfortran-mp-4.6 stopped working. I followed a few threads and rebuilt gmp from source with no effect. I tried to rebuild libgcc from source and it failed so switched back to the binary.

The specific error is:

f951: internal compiler error: Illegal instruction: 4

Here is the thing I'm trying to compile, which works on lots of tested systems, including my own before the upgrade: http://www.pas.rochester.edu/~hayes/gosia_versions/gosia2_20081208.14.f

I've attached the output of the compilation step and my system profile.

Liam

Attachments (4)

gfortran_verbose.txt (2.5 KB) - added by liampg72@… 8 years ago.
my.spx (560.7 KB) - added by liampg72@… 8 years ago.
libgcc.log (13.6 MB) - added by liampg72@… 8 years ago.
log of libgcc fail (from source with '-s' option)
libgcc_config.log (80.5 KB) - added by liampg72@… 8 years ago.
libgcc config.log

Change History (19)

Changed 8 years ago by liampg72@…

Attachment: gfortran_verbose.txt added

Changed 8 years ago by liampg72@…

Attachment: my.spx added

comment:1 Changed 8 years ago by ryandesign (Ryan Schmidt)

Cc: mww@… removed
Owner: changed from macports-tickets@… to mww@…
Summary: gfortran (gcc46) not working after upgradegcc46: gfortran not working after upgrade

comment:2 Changed 8 years ago by mf2k (Frank Schima)

Cc: jeremyhu@… added

comment:3 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Can you provide the crash log? Can you disassemble the problematic function, so we can see the illegal instruction?

comment:4 in reply to:  3 Changed 8 years ago by liampg72@…

Replying to jeremyhu@…:

Can you provide the crash log? Can you disassemble the problematic function, so we can see the illegal instruction?

Sadly not, this error comes directly at the compilation stage. The code is rather complex so finding the problematic function here would be impossible, especially with so little information. Were you able to test it on your system? Should I file a new ticket for the libgcc failure, or post the log here?

Changed 8 years ago by liampg72@…

Attachment: libgcc.log added

log of libgcc fail (from source with '-s' option)

comment:5 Changed 8 years ago by liampg72@…

Ok, this looks like more of an upstream problem, maybe?

:info:build configure: error: GNU Fortran is not working; please report a bug in http://gcc.gnu.org/bugzilla, attaching /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_gcc48/libgcc/work/build/x86_64-apple-darwin12/libgfortran/config.log

I've attached the config.log file which it asks for too. Maybe I'll report this at gcc.gnu.org too.

Cheers, Liam

Changed 8 years ago by liampg72@…

Attachment: libgcc_config.log added

libgcc config.log

comment:6 Changed 8 years ago by kurtjaeke@…

Please use the test program from config.log:

        program foo
        real, parameter :: bar = sin (12.34 / 2.5)
        end program foo

save it in a file test.f, and compile it using

gfortran-mp-4.6 -v -c -o test.o test.f

This should trigger your SIGILL. Then, run

lldb -- gfortran-mp-4.6 v -c -o test.o test.f

This gives you the lldb debugger shell. There, type run. This should trigger the crash. Then type bt, and post the output.

Version 0, edited 8 years ago by kurtjaeke@… (next)

comment:7 Changed 8 years ago by kurtjaeke@…

Cc: kurtjaeke@… added

Cc Me!

comment:8 Changed 8 years ago by liampg72@…

Not sure that this was really what you expected as output to the bt command

$ lldb -- gfortran-mp-4.6 -v -c -o test.o test.f90 
Current executable set to 'gfortran-mp-4.6' (x86_64).
(lldb) run
Process 22169 launched: '/opt/local/bin/gfortran-mp-4.6' (x86_64)
Using built-in specs.
COLLECT_GCC=gfortran-mp-4.6
COLLECT_LTO_WRAPPER=/opt/local/libexec/gcc/x86_64-apple-darwin12/4.6.4/lto-wrapper
Target: x86_64-apple-darwin12
Configured with: /opt/local/var/macports/build/_opt_mports_dports_lang_gcc46/gcc46/work/gcc-4.6.4/configure --prefix=/opt/local --build=x86_64-apple-darwin12 --enable-languages=c,c++,objc,obj-c++,lto,fortran --libdir=/opt/local/lib/gcc46 --includedir=/opt/local/include/gcc46 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.6 --with-local-prefix=/opt/local --with-libiconv-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.6 --with-gxx-include-dir=/opt/local/include/gcc46/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --disable-cloog-version-check --enable-stage1-checking --disable-multilib --enable-lto --enable-libstdcxx-time --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --disable-ppl-version-check --with-pkgversion='MacPorts gcc46 4.6.4_3'
Thread model: posix
gcc version 4.6.4 (MacPorts gcc46 4.6.4_3) 
COLLECT_GCC_OPTIONS='-mmacosx-version-min=10.8.5' '-v' '-c' '-o' 'test.o' '-mtune=core2'
 /opt/local/libexec/gcc/x86_64-apple-darwin12/4.6.4/f951 test.f90 -fPIC -quiet -dumpbase test.f90 -mmacosx-version-min=10.8.5 -mtune=core2 -auxbase-strip test.o -version -fintrinsic-modules-path /opt/local/lib/gcc46/gcc/x86_64-apple-darwin12/4.6.4/finclude -o /var/folders/59/jbgfvmm54xbg2fhp_swhgl2c0000gn/T//cc3EZ5SQ.s
GNU Fortran (MacPorts gcc46 4.6.4_3) version 4.6.4 (x86_64-apple-darwin12)
	compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (MacPorts gcc46 4.6.4_3) version 4.6.4 (x86_64-apple-darwin12)
	compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
f951: internal compiler error: Illegal instruction: 4
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://trac.macports.org/newticket> for instructions.
Process 22169 stopped and restarted: thread 1 received signal: SIGCHLD
Process 22169 exited with status = 1 (0x00000001) 
(lldb) bt
error: invalid thread
(lldb) 

comment:9 Changed 8 years ago by kurtjaeke@…

I forgot one step, obviously. Please run

lldb -- /opt/local/libexec/gcc/x86_64-apple-darwin12/4.6.4/f951 test.f90 -fPIC -quiet -dumpbase test.f90 -mmacosx-version-min=10.8.5 -mtune=core2 -auxbase-strip test.o -version -fintrinsic-modules-path /opt/local/lib/gcc46/gcc/x86_64-apple-darwin12/4.6.4/finclude -o /var/folders/59/jbgfvmm54xbg2fhp_swhgl2c0000gn/T//cc3EZ5SQ.s

and type run, then bt, as above, and post the results.

comment:10 Changed 8 years ago by liampg72@…

$ lldb -- /opt/local/libexec/gcc/x86_64-apple-darwin12/4.6.4/f951 test.f90 -fPIC -quiet -dumpbase test.f90 -mmacosx-version-min=10.8.5 -mtune=core2 -auxbase-strip test.o -version -fintrinsic-modules-path /opt/local/lib/gcc46/gcc/x86_64-apple-darwin12/4.6.4/finclude -o /var/folders/59/jbgfvmm54xbg2fhp_swhgl2c0000gn/T//cc3EZ5SQ.s
Current executable set to '/opt/local/libexec/gcc/x86_64-apple-darwin12/4.6.4/f951' (x86_64).
(lldb) run
Process 28342 launched: '/opt/local/libexec/gcc/x86_64-apple-darwin12/4.6.4/f951' (x86_64)
GNU Fortran (MacPorts gcc46 4.6.4_3) version 4.6.4 (x86_64-apple-darwin12)
	compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Fortran (MacPorts gcc46 4.6.4_3) version 4.6.4 (x86_64-apple-darwin12)
	compiled by GNU C version 4.6.4, GMP version 5.1.2, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Process 28342 stopped
* thread #1: tid = 0x1f793d, 0x0000000141796466 libgmp.10.dylib`__gmpn_popcount + 134, queue = 'com.apple.main-thread, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000141796466 libgmp.10.dylib`__gmpn_popcount + 134
libgmp.10.dylib`__gmpn_popcount + 134:
-> 0x141796466:  popcntq 56(%rdi,%rsi,8), %r9
   0x14179646d:  addq   %r9, %rax
   0x141796470:  addq   $8, %rsi
   0x141796474:  js     0x141796420               ; __gmpn_popcount + 64
(lldb) bt
* thread #1: tid = 0x1f793d, 0x0000000141796466 libgmp.10.dylib`__gmpn_popcount + 134, queue = 'com.apple.main-thread, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000141796466 libgmp.10.dylib`__gmpn_popcount + 134
    frame #1: 0x000000014174a1ff libmpfr.4.dylib`parsed_string_to_mpfr + 2535
    frame #2: 0x0000000141749799 libmpfr.4.dylib`mpfr_strtofr + 1852
    frame #3: 0x00000001417308a7 libmpfr.4.dylib`mpfr_set_str + 32
    frame #4: 0x0000000100004381 f951`gfc_convert_real + 49
    frame #5: 0x0000000100070838 f951`match_real_constant + 728
    frame #6: 0x000000010007188a f951`gfc_match_literal_constant + 954

comment:11 in reply to:  10 Changed 8 years ago by kurtjaeke@…

Replying to liampg72@…:

* thread #1: tid = 0x1f793d, 0x0000000141796466 libgmp.10.dylib`__gmpn_popcount + 134, queue = 'com.apple.main-thread, stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x0000000141796466 libgmp.10.dylib`__gmpn_popcount + 134

Please reinstall gmp from source (with "-s"):

port uninstall -f gmp
port install -s gmp

As this seems to be a recurring issue, I'll open an issue requesting that gmp be always built from source.

comment:12 Changed 8 years ago by liampg72@…

Yes... All is well with the world now. Although, I was sure that I did this before submitting the ticket. Oh well, it does seem sensible to build from source as standard

comment:13 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: worksforme
Status: newclosed

comment:14 Changed 8 years ago by ralph@…

unfortunately, this does not work for me, as trying to build gmp from source fails...

comment:15 Changed 7 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

Note: See TracTickets for help on using tickets.