CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   OpenFOAM 1.7.1 and gcc 4.6.3: scalarField no bounds check? (https://www.cfd-online.com/Forums/openfoam/102251-openfoam-1-7-1-gcc-4-6-3-scalarfield-no-bounds-check.html)

adhiraj May 26, 2012 08:37

OpenFOAM 1.7.1 and gcc 4.6.3: scalarField no bounds check?
 
Hi
I am using OpenFOAM-1.7.1 and gcc 4.6.3 in Ubuntu. I noticed that when the code is compiled in Optimized mode, I can access elements outside of scalarField bounds without segfaulting.
So if you have a scalarField a(10) and you write
Code:

Info<<a[100]<<endl;
you get zero instead of a segfault.
In the debug version you get an error when you run, telling you that the index is not within limits.

This is unlikely to be an OpenFOAM problem, for in gcc 4.3.3, OpenFOAM 1.7.1 segfaults on array bound exceeding, as it should.

Any thoughts/comments welcome.

wyldckat May 26, 2012 09:20

Greetings Adhiraj,

It was for these reasons that I created this page: http://openfoamwiki.net/index.php/In...tion_.28GCC.29
As you can see, Gcc 4.6.3 is incompatible with OpenFOAM 1.7.1.

You can try and look in the OpenFOAM 2.0.x and 2.1.x git repositories for the modifications required for things to work as intended with Gcc 4.6.

Best regards,
Bruno


All times are GMT -4. The time now is 04:57.