Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 3.7.0 coredumps #222

Closed
antonio-rojas opened this issue Apr 22, 2019 · 7 comments
Closed

Version 3.7.0 coredumps #222

antonio-rojas opened this issue Apr 22, 2019 · 7 comments

Comments

@antonio-rojas
Copy link

The following code (used by polymake to check for normaliz presence):

> cat main.cpp
#include <cstddef>
#include <vector>
#include <fstream>
#include <iostream>
#include <omp.h>
#include <gmpxx.h>
#include <libnormaliz/libnormaliz.h>
#include <libnormaliz/cone.h>
#include <libnormaliz/vector_operations.h>
#include <libnormaliz/cone_property.h>
#include <libnormaliz/integer.h>
using namespace std;
using namespace libnormaliz;
typedef mpz_class Integer;

int main (int argc, char *argv[])
{
   vector<vector<Integer> > rays {{1,0},{1,2}};
   Cone<Integer> nmzcone(Type::cone,rays);
}

coredumps in version 3.7.0, it worked fine in 3.6.3. Backtrace:

#0  0x00007ffff769282f in raise () from /usr/lib/libc.so.6
#1  0x00007ffff767d672 in abort () from /usr/lib/libc.so.6
#2  0x00007ffff76d4e78 in __libc_message () from /usr/lib/libc.so.6
#3  0x00007ffff7766855 in __fortify_fail_abort () from /usr/lib/libc.so.6
#4  0x00007ffff7766806 in __stack_chk_fail () from /usr/lib/libc.so.6
#5  0x0000555555555568 in main (argc=1, argv=0x7fffffffe538) at main.cpp:20
@w-bruns
Copy link
Contributor

w-bruns commented Apr 22, 2019

On my system (g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609) it compiles and runs fine.

@sebasguts
Copy link
Member

I can reproduce this problem on Arch, using gcc (GCC) 8.2.1 20181127.

However, allocating the Cone using new makes the problem disappear, so I would guess this is a general problem with allocating Cones on the stack. We will investigate.

@sebasguts
Copy link
Member

@antonio-rojas

We investigated a bit, and found a typo in the Cone destructor, in source/libnormaliz/cone.cpp, line 473. The destructor should be

template<typename Integer>
Cone<Integer>::~Cone() {
    if(IntHullCone!=NULL)
        delete IntHullCone;
    if(SymmCone!=NULL)
        delete SymmCone;
    if(ProjCone!=NULL)
        delete ProjCone;
}

Could you try if the problem disappears when you change the destructor? At least for me it disappeared.

@antonio-rojas
Copy link
Author

It doesn't make any difference for me

@sebasguts
Copy link
Member

I see, sorry for making a premature suggestion. It seems like this error only appears if Normaliz is compiled with enfnormaliz. We will investigate further.

@w-bruns
Copy link
Contributor

w-bruns commented Apr 22, 2019

Correction to my first comment: everything works fine in a completely static build with g++ 5.4. But a dynamic build fails.

@w-bruns
Copy link
Contributor

w-bruns commented Apr 22, 2019

The problem is solved. See #223

@w-bruns w-bruns closed this as completed Apr 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants