[SCIP] Multiple SCIP_ConsData cause heap corruption

Horváth Markó marko.horvath at sztaki.hu
Thu Oct 22 12:26:01 CEST 2020


Dear Marc, Gergor, Jim,

thank you for your quick responses!

Jim, I was aware of ODR, however, since this pattern is already used in 
SCIP, I also wanted to use it.

Gregor, I tried something like this earlier, but did not worked. 
However, it should be OK, so next time I will try again.

Marc, surprisingly, removing the default member initializers solved the 
issue. I guess, this type of member initialization in structures with 
the same name causes a problem to the linker (since in other cases it 
works perfectly).

Sorry for the off-topic, but at least my problem is seems to be solved. :D

Regards,
Marko

2020. 10. 22. 10:37 keltezéssel, Horváth Markó írta:
> Dear All,
>
> I am working on a branch-and-price project using SCIP, but I got stuck 
> on something. Actually, I reduced my problem to a "simple" C++ issue, 
> but due to the design of SCIP maybe you have already run into this 
> problem and know the solution.
>
> So, my problem is that I have three different user-defined constraints 
> and thus three different user-defined constraint data, that is, three 
> different structures in three different .cpp files with the same name: 
> SCIP_ConsData. (Due to the design of SCIP, I must use this name for 
> all structures). Everything was fine when I used only the first two 
> constraints (it was also a luck, I guess), however, the third one 
> ruined everything. The problem is that in runtime these structures are 
> mixed up which causes a heap corruption.
>
> More precisely, I have three SCIP_ConsData structures in different 
> .cpp files (say, one.cpp, two.cpp, three.cpp) and when I want to 
> create a new instance of the corresponding SCIP_ConsData in file 
> two.cpp, the structure in file one.cpp is going to be created. Later, 
> it will cause a heap corruption.
>
> What should I do to fix this issue?
>
> I attach a very minimal working example for this phenomenon. I use 
> Visual Studio 2019 under Windows 10 with C++17 Standard.
>
> Best Regards,
> Marko
>
> _______________________________________________
> Scip mailing list
> Scip at zib.de
> https://listserv.zib.de/mailman/listinfo/scip

-- 
Markó HORVÁTH MSc,
research associate
-------------------------------------------------------------
Research Laboratory on Engineering & Management Intelligence,
Institute for Computer Science and Control
  H-1111 Budapest, Kende u. 13-17.
  Room : K318
  Phone: +36 1 279 7164

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.zib.de/pipermail/scip/attachments/20201022/99629eec/attachment.html>


More information about the Scip mailing list