More gcc 5 issues - calling C++ from C

Orion Poplawski orion at cora.nwra.com
Tue Feb 17 22:48:25 UTC 2015


I'm starting to see a segfault in the plplot tests building on F23.  I see
that the C code is calling some C++ code in this case.  This has worked before
for a long time so I'm wondering what has changed it this regard.

valgrind reports:

11: ==28186== Invalid read of size 8
11: ==28186==    at 0x73079DC: operator<< (ostream:132)
11: ==28186==    by 0x73079DC: operator<< <std::ios_base& (*)(std::ios_base&)>
(LASi.h:121)
11: ==28186==    by 0x73079DC: ps_init(PLStream*) (psttf.cc:239)
11: ==28186==    by 0x4E52F78: plP_init (plcore.c:144)
11: ==28186==    by 0x4E5773B: c_plinit (plcore.c:2268)
11: ==28186==    by 0x4009D9: main (x00c.c:44)
11: ==28186==  Address 0xffffffffffffffe8 is not stack'd, malloc'd or
(recently) free'd
11: ==28186==
11: ==28186==
11: ==28186== Process terminating with default action of signal 11 (SIGSEGV)
11: ==28186==  Access not within mapped region at address 0xFFFFFFFFFFFFFFE8
11: ==28186==    at 0x73079DC: operator<< (ostream:132)
11: ==28186==    by 0x73079DC: operator<< <std::ios_base& (*)(std::ios_base&)>
(LASi.h:121)
11: ==28186==    by 0x73079DC: ps_init(PLStream*) (psttf.cc:239)
11: ==28186==    by 0x4E52F78: plP_init (plcore.c:144)
11: ==28186==    by 0x4E5773B: c_plinit (plcore.c:2268)
11: ==28186==    by 0x4009D9: main (x00c.c:44)

Program received signal SIGSEGV, Segmentation fault.
ps_init (pls=0x7ffff7dcf600 <pls0>) at
/builddir/build/BUILD/plplot-5.10.0-git/drivers/psttf.cc:239
239         doc->osBody() << fixed;
Missing separate debuginfos, use: debuginfo-install
bzip2-libs-1.0.6-14.fc22.x86_64 expat-2.1.0-10.fc22.x86_64
fontconfig-2.11.92-1.fc22.x86_64 freetype-2.5.5-1.fc22.x86_64
glib2-2.43.4-1.fc23.x86_64 graphite2-1.2.4-3.fc22.x86_64
harfbuzz-0.9.38-3.fc22.x86_64 lasi-1.1.2-2.fc22.x86_64
libffi-3.1-7.fc22.x86_64 libgcc-5.0.0-0.14.fc23.x86_64
libpng-1.6.16-1.fc22.x86_64 libstdc++-5.0.0-0.14.fc23.x86_64
libtool-ltdl-2.4.6-1.fc23.x86_64 pango-1.36.8-2.fc22.x86_64
qhull-2003.1-25.fc22.x86_64 shapelib-1.3.0f-5.fc22.x86_64 zlib-1.2.8-7.fc22.x86_64
(gdb) bt
#0  0x00007ffff5b039dc in ps_init(PLStream*) (pls=0x7ffff7dcf600 <pls0>)
    at /builddir/build/BUILD/plplot-5.10.0-git/drivers/psttf.cc:239
#1  0x00007ffff7b88f79 in plP_init () at
/builddir/build/BUILD/plplot-5.10.0-git/src/plcore.c:144
#2  0x00007ffff7b8d73c in c_plinit () at
/builddir/build/BUILD/plplot-5.10.0-git/src/plcore.c:2268
#3  0x00000000004009da in main (argc=1, argv=<optimized out>)
    at /builddir/build/BUILD/plplot-5.10.0-git/examples/c/x00c.c:44
(gdb) print doc
$1 = <optimized out>
(gdb) print fixed
No symbol "fixed" in current context.
(gdb) list
234         if ( pls->psdoc != NULL )
235             delete (PostscriptDocument *) pls->psdoc;
236
237         pls->psdoc = new PostscriptDocument();
238         doc        = (PostscriptDocument *) ( pls->psdoc );
239         doc->osBody() << fixed;
240         doc->osBody().precision( 3 );
241
242     // Allocate and initialize device-specific data
243
(gdb) print pls
$2 = (PLStream *) 0x7ffff7dcf600 <pls0>
(gdb) print pls->psdoc
$3 = (void *) 0x62a930
(gdb) print fixed
No symbol "fixed" in current context.

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion at nwra.com
Boulder, CO 80301                   http://www.nwra.com


More information about the devel mailing list