View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001393 | OpenFOAM | Bug | public | 2014-09-07 19:31 | 2014-12-28 14:46 |
Reporter | Assigned To | henry | |||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Intel Core | OS | Debian GNU/Linux Jessie (amd64) | OS Version | Jessie/testing |
Summary | 0001393: reconstructPar crashes in tutorials cyclone and wingMotion2D_pimpleDyMFoam | ||||
Description | OpenFoam-2.3.x git snapshot 03.09.2014 compiled with clang-3.5. Logs attached. By the way, in tutorials/lagrangian/MPPICFoam/cyclone/Allrun something like runApplication reconstructPar is missing. | ||||
Tags | No tags attached. | ||||
2014-09-07 19:31
|
|
2014-09-07 19:32
|
|
2014-09-08 11:41
|
|
|
I cannot replicate this. Did you compile from sources? Are you using a supported g++ version? Attached (part of) my output of reconstructPar of wingMotion2D_pimpleDyMFoam. |
|
Sorry, overlooked your clang-3.5 specification. Does it work for you with other clang/g++ versions? |
|
In June I used g++-4.9 and there were no problems. Good, I've compiled a debug version with clang-3.5 and reconstructPar seems to work. Then I've compiled a "-g -O2" version. There is a lot of warnings during build. An example is attached. And here is a backtrace: gursky@hpprobook:~/OpenFOAM/gursky-2.3.x/run/tutorials/lagrangian/MPPICFoam/cyclone$ gdb reconstructPar GNU gdb (Debian 7.7.1+dfsg-3) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from reconstructPar...done. (gdb) r Starting program: /home/gursky/projects/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64ClangDPOpt/bin/reconstructPar [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". /*---------------------------------------------------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 2.3.x Exec : /home/gursky/projects/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64ClangDPOpt/bin/reconstructPar Date : Sep 09 2014 Time : 15:01:45 Host : "hpprobook" PID : 19631 Case : /home/gursky/OpenFOAM/gursky-2.3.x/run/tutorials/lagrangian/MPPICFoam/cyclone nProcs : 1 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Reconstructing fields for mesh region0 Time = 0.1 Reconstructing FV fields Reconstructing volScalarField::DimensionedInternalFields kinematicCloud:UCoeff Reconstructing volVectorField::DimensionedInternalFields kinematicCloud:UTrans Reconstructing volScalarFields k.air Program received signal SIGSEGV, Segmentation fault. Foam::fvPatchField<double>::fvPatchField (this=0x1207800, ptf=..., p=..., iF=..., mapper=...) at lnInclude/fvPatchField.C:101 101 if (&iF && iF.size()) (gdb) bt full #0 Foam::fvPatchField<double>::fvPatchField (this=0x1207800, ptf=..., p=..., iF=..., mapper=...) at lnInclude/fvPatchField.C:101 No locals. #1 0x00007ffff6be4759 in Foam::fixedValueFvPatchField<double>::fixedValueFvPatchField (this=0x1207800, ptf=warning: can't find linker symbol for virtual table for `Foam::fixedValueFvPatchField<double>' value warning: found `std::string::_Rep::_S_empty_rep_storage' instead ..., p=..., iF=..., mapper=...) at fields/fvPatchFields/basic/fixedValue/fixedValueFvPatchField.C:68 No locals. #2 0x00007ffff6be4708 in Foam::fvPatchField<double>::addpatchMapperConstructorToTable<Foam::fixedValueFvPatchField<double> >::New (ptf=..., p=..., iF=..., m=...) at lnInclude/fvPatchField.H:132 No locals. #3 0x00000000004f2422 in Foam::fvPatchField<double>::New (ptf=..., p=..., iF=..., pfMapper=...) at /home/gursky/projects/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/fvPatchFieldNew.C:217 No locals. #4 0x00000000004f1760 in Foam::fvFieldReconstructor::reconstructFvVolumeField<double> (this=0x7fffffffb578, fieldIoObject=..., procFields=...) at /home/gursky/projects/OpenFOAM/OpenFOAM-2.3.x/src/parallel/reconstruct/reconstruct/lnInclude/fvFieldReconstructorReconstructFields.C:170 curPatchStart = <optimized out> procI = <optimized out> #5 0x00000000004f0fd2 in Foam::fvFieldReconstructor::reconstructFvVolumeField<double> (this=0x7fffffffb578, fieldIoObject=...) at /home/gursky/projects/OpenFOAM/OpenFOAM-2.3.x/src/parallel/reconstruct/reconstruct/lnInclude/fvFieldReconstructorReconstructFields.C:339 procFields = <optimized out> #6 0x0000000000442086 in Foam::fvFieldReconstructor::reconstructFvVolumeFields<double> (this=0x7fffffffb578, objects=..., selectedFields=...) at /home/gursky/projects/OpenFOAM/OpenFOAM-2.3.x/src/parallel/reconstruct/reconstruct/lnInclude/fvFieldReconstructorReconstructFields.C:656 fieldClassName = <optimized out> fields = <optimized out> #7 0x000000000043a6e0 in main (argc=<optimized out>, argv=<optimized out>) at reconstructPar.C:409 procStat = <optimized out> meshStat = <optimized out> regionName = <optimized out> (gdb) |
2014-09-09 16:34
|
|
|
We can repeat this. Looks like it is due to a very strict interpretation of null references in the optimiser. |
|
Yes, I've written a minimal test case. It is attached. Thus all checks of values passed by references being null are not legal. But the main problem is that somewhere in the code instead of an object a null is actually passed by reference. |
2014-09-26 19:44
|
test_pass_null_obj_by_ref.cpp (1,894 bytes)
// OK: g++-4.9 -Wall -g -O3 -o test test.cpp // OK: clang++-3.4 -Wall -g -O3 -o test test.cpp // OK : clang++-3.5 -Wall -g -o test test.cpp // FAIL: clang++-3.5 -Wall -g -O1 -o test test.cpp /* test.cpp:57:14: warning: reference cannot be bound to dereferenced null pointer in well-defined C++ code; pointer may be assumed to always convert to true [-Wundefined-bool-conversion] if (&foo && foo.method()) ^~~ ~~ 1 warning generated. */ #include <iostream> #include <cstdlib> struct Foo{ int *data; Foo(); ~Foo(); bool method() const; }; Foo::Foo() { const int len = 100; data = new int[len]; for (int i=0; i<len; i++) data[i]=0; std::cout << "Foo constructor" << std::endl; } Foo::~Foo() { delete[] data; std::cout << "Foo destructor" << std::endl; } bool Foo::method() const { std::cout << "Foo::method(): foo object supposed to exist, really?" << std::endl << "accessing foo::data[1]..." << std::endl; std::cout << "data[1]=" << data[1] << std::endl; return true; } const Foo& nullFoo() { Foo* nullFoo = NULL; return static_cast<const Foo&>(*nullFoo); } void test(const Foo& foo) { if (&foo && foo.method()) std::cout << "foo exists and method() OK" << std::endl; else std::cout << "foo doesn't exist, OK" << std::endl; } int main(int argc, char* argv[]) { int useNullFoo = 1; if (argc == 2) useNullFoo = atoi(argv[1]); std::cout << "Usage: test [0/1]" << std::endl << " 0 create object" << std::endl << " 1 \"create\" null object (default)" << std::endl; if (useNullFoo) test(nullFoo()); else test(Foo()); return 0; } |
|
The handling for references to NULL has been changed in Clang-3.5 which required substantial changes to the way in which OpenFOAM creates and checks null objects. Resolved by commit 3dd3e6157ccc3bb6d6a1b2208deb7eca92784929 in https://github.com/OpenFOAM/OpenFOAM-dev |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-09-07 19:31 |
|
New Issue | |
2014-09-07 19:31 |
|
File Added: cyclone.log.reconstructPar | |
2014-09-07 19:32 |
|
File Added: wingMotion2D_pimpleDyMFoam.log.reconstructPar | |
2014-09-08 11:41 |
|
File Added: log.reconstructPar_bit | |
2014-09-08 11:42 |
|
Note Added: 0003224 | |
2014-09-08 11:45 |
|
Note Added: 0003225 | |
2014-09-09 16:33 |
|
Note Added: 0003230 | |
2014-09-09 16:34 |
|
File Added: reconstrcutPar-warnings-example.txt | |
2014-09-25 16:02 |
|
Note Added: 0003239 | |
2014-09-26 19:44 |
|
Note Added: 0003240 | |
2014-09-26 19:44 |
|
File Added: test_pass_null_obj_by_ref.cpp | |
2014-12-28 14:46 | henry | Note Added: 0003366 | |
2014-12-28 14:46 | henry | Status | new => closed |
2014-12-28 14:46 | henry | Assigned To | => henry |
2014-12-28 14:46 | henry | Resolution | open => fixed |