Control: tags -1 important Control: forwarded -1 https://gcc.gnu.org/PR87036
On 20.08.2018 21:53, Lumin wrote: > This is the minimal code for repro #906753: > > OK with -O0, FAIL with -O2 on i386, ppc64el, ... that always failed on i386 and ppc64el with -O2, so not a regression. You talked about other architectures, but don't name these with the reduced test case. > > masssq1 and masssq2 are computed from the same vector [1.1, 2.2, 3.3, 4.4], > but the results are different! > > ========================================================== > > #include <cmath> > #include <algorithm> // for swap > #include <iostream> > > namespace HepMC { > class FourVector { > public: > double m_x, m_y, m_z, m_t; > FourVector( double xin, double yin, double zin, double tin=0) : m_x(xin), > m_y(yin), m_z(zin), m_t(tin) {} > inline double m2() const { > return m_t*m_t - (m_x*m_x + m_y*m_y + m_z*m_z); > } > inline double m() const { > double mm = m2(); > return mm < 0.0 ? -std::sqrt(-mm) : std::sqrt(mm); > } > }; > } // HepMC > > int main() > { > double eps = 1.e-15; // allowed differnce between doubles > > // FourVector > HepMC::FourVector vector(1.1,2.2,3.3,4.4); > HepMC::FourVector v4 (1.1,2.2,3.3,4.4); > > //vector = v4; > > double masssq1 = v4.m2(); > double mass1 = v4.m(); > double masssq2 = vector.m2(); > double mass2 = vector.m(); > > if( fabs( masssq1 - masssq2 ) > eps ) { > std::cout << "different mass sq values: " << masssq1 << " " << masssq2 > << std::endl; > std::cout << "difference is : " << ( masssq1 - masssq2 ) << std::endl; > } > > return 0; > } > -- debian-science-maintainers mailing list debian-science-maintainers@alioth-lists.debian.net https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-science-maintainers