[Bug c++/18049] wrong result without -O2 with g++-3.4.2 and completely wrong result with any other g++ version
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Mon Oct 18 20:32:00 GMT 2004
------- Additional Comments From bangerth at dealii dot org 2004-10-18 20:32 -------
Actually, the typedef has nothing to do with it. Here's a modified FEMmain.cc
file:
-------------------------
#include <iostream>
#include "Elements.h"
int main()
{
Container2D<R> Vec(6,6,1.0);
FiniteElement<Simplex, _2D, P2> SP2(&Vec);
Mesh mesh;
AssemblyTerm<0, Simplex, _2D, P2> u(mesh, &Vec);
AssemblyTerm<0, Simplex, _2D, P2> v(mesh, &Vec);
// Give Vec its final values
for (size_t i = 0; i < 6; i++)
for (unsigned int j=0; j<6; ++j)
Vec[j][i] += j;
R x = 1.0;
R y = 0.0;
R z = 2.0;
AssemblyTerm<1, Simplex, _2D, P2> vdx(mesh, &Vec);
std::cout << "Before: " << vdx(0,x,y,z) << "\n";
std::cout << "After: " << vdx(0,x,y,z) << "\n";
}
--------------------------
The typedef is gone, and I output only the first element. What I get is this:
g/x> /home/bangerth/bin/gcc-3.4.3-pre/bin/c++ *.cc -o x ; ./x
Before: 3
After: -0.994019
In other words, the output changes if I call the same function vdx(0,x,y,z)
twice. I will have to see what's going on in the function.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18049
More information about the Gcc-bugs
mailing list