#57726 closed defect (wontfix)
pgplot demo 'cpgdemo' segfaults with variant gcc8, ok with gcc7
Reported by: | d-lamb (Derek Lamb) | Owned by: | MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ||
Port: | pgplot |
Description
Just like the title says. I installed the default pgplot @5.2.2_11+gcc8+x11, and the demos /opt/local/share/pgplot/examples/pgdemo* work just fine, but cpgdemo (which shows the C-language bindings) in that same directory segfaults when drawing the second plot.
I installed pgplot @5.2.2_11+gcc7+x11, and now cpgdemo works just fine. Is there something special about how the C interface libcpgplot.dylib gets made with gcc8?
Change History (8)
comment:1 Changed 6 years ago by jmroot (Joshua Root)
Owner: | set to MarcusCalhoun-Lopez |
---|---|
Status: | new → assigned |
comment:2 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
comment:3 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
It turns out that I spoke too soon.
Sometimes, calling cpgmtxt
even once can cause problems.
I will add a warning in the notes
, but a real solution would probably take a great deal of effort.
If anyone has any better ideas, we can reopen.
comment:4 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
comment:5 Changed 5 years ago by d-lamb (Derek Lamb)
I just rebuilt my whole MacPorts tree, using only gcc9, and the cpgdemo now works. I think the note that is present, that the C bindings do not work with gcc8, is still sufficient.
comment:6 Changed 5 years ago by paulray (Paul Ray)
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
I just encountered this on my Mac that was newly updated to Mojave. I compiled everything with gcc9 and I'm getting segfaults in cpgmtxt(). It does NOT happen in cpgdemo, but it does happen in two other codes that use cpgplot. Here is an example:
Thread 2 received signal SIGSEGV, Segmentation fault. 0x0000000100a9574b in _gfortran_string_len_trim () from /opt/local/lib/libgcc/libgfortran.5.dylib (gdb) where #0 0x0000000100a9574b in _gfortran_string_len_trim () from /opt/local/lib/libgcc/libgfortran.5.dylib #1 0x00000001007b61d2 in grtrim_ () from /opt/local/lib/libpgplot5.dylib #2 0x00000001007c0880 in pgmtxt_ () from /opt/local/lib/libpgplot5.dylib #3 0x00000001007a4305 in cpgmtxt () from /opt/local/lib/libcpgplot5.dylib #4 0x0000000100006640 in prepfold_plot (search=0x100066eca, flags=<optimized out>, xwin=<optimized out>, ppdot=0x108000000) at prepfold_plot.c:752 #5 0x00000001000616f7 in ?? () #6 0x00007fff66e703d5 in dispatch_logfile () from /usr/lib/system/libdispatch.dylib #7 0x0000000000000000 in ?? ()
The version of pgplot installed is:
pgplot @5.2.2_12+gcc9+x11 (active)
And, here are the libraries that are linked into the code that is crashing:
mcxr2 : 25>otool -L /Users/paulr/src/presto-paulray/bin/prepfold /Users/paulr/src/presto-paulray/bin/prepfold: /opt/local/lib/libcfitsio.dylib (compatibility version 7.0.0, current version 7.3.45) /opt/local/lib/libcurl.4.dylib (compatibility version 11.0.0, current version 11.0.0) /opt/local/lib/libfftw3f.3.dylib (compatibility version 9.0.0, current version 9.8.0) /opt/local/lib/libcpgplot5.dylib (compatibility version 5.0.0, current version 5.2.2) /opt/local/lib/libpgplot5.dylib (compatibility version 5.0.0, current version 5.2.2) /opt/local/lib/libX11.6.dylib (compatibility version 10.0.0, current version 10.0.0) /opt/local/lib/libpng16.16.dylib (compatibility version 54.0.0, current version 54.0.0) /opt/local/lib/libgcc/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0) /opt/local/lib/libgcc/libgomp.1.dylib (compatibility version 2.0.0, current version 2.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.250.1) /opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /opt/local/lib/libgcc/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
comment:7 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Unfortunately, this seem to be very much an upstream issue.
The PGPLOT website suggests contacting the author with problems.
However, it has been nine years since the last release of PGPLOT.
C and Fortran strings are very different and it was probably always dangerous to try to pass a C string to Fortran.
It is actually surprising that it works at all.
I am sorry I cannot be more help.
If you manage to work something out (especially with the upstream developer), please consider opening a pull request.
comment:8 Changed 6 weeks ago by paulray (Paul Ray)
Note that Karl Glazebrook made a simple standalone example of this crash here: https://github.com/PDLPorters/perl5-PGPLOT/issues/14
Note that it is fixed when "gcc" is used for the compile, rather than the "cc" compiler (from Apple's Xcode).
Calling Fortran subroutines from C functions is a tricky business, especially when strings are passed between them.
The last release of PGPOT was almost eight years ago, so GCC 8 was never tested.
The problem seems to be when
cpgmtxt
is called more than once from different functions.I have no idea why this might be the case, but I will patch the demo program to call
cpgmtxt
only once.I believe that is the best we can do without a great deal of time and effort.