public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39002]  New: codegen bug?
@ 2009-01-28 14:18 r dot emrich at de dot tecosim dot com
  2009-01-28 14:21 ` [Bug c++/39002] " r dot emrich at de dot tecosim dot com
                   ` (30 more replies)
  0 siblings, 31 replies; 32+ messages in thread
From: r dot emrich at de dot tecosim dot com @ 2009-01-28 14:18 UTC (permalink / raw)
  To: gcc-bugs

I have a complex C++ application, which used to work at least until gcc-4.4.0
snapshot 20081219, which now segfaults in a strange way.

double distance_2(NODE *P_node1, NODE *P_node2)
{
  return
sqrt(((*P_node1).globalx-(*P_node2).globalx)*((*P_node1).globalx-(*P_node2).globalx)+
             
((*P_node1).globaly-(*P_node2).globaly)*((*P_node1).globaly-(*P_node2).globaly)+
             
((*P_node1).globalz-(*P_node2).globalz)*((*P_node1).globalz-(*P_node2).globalz));
}


void calc_tria_height_2(NODE *n1, NODE *n2, NODE *n11,ostream &out_info,int
&xerror,int &xwarning,double &x,double &y,double &z)
{
  if( distance_2(n1,n2) == 0.0 )
    {
      x = (*n11).globalx;
      y = (*n11).globaly;
      z = (*n11).globalz;
      return;
    }
  if( distance_2(n1,n11) == 0.0 )
    {
      x = (*n11).globalx;
      y = (*n11).globaly;
      z = (*n11).globalz;
      return;
    }
  if( distance_2(n2,n11) == 0.0 )
    {
      x = (*n11).globalx;
      y = (*n11).globaly;
      z = (*n11).globalz;
      return;
    }

  double a1, b1 , c1, la1, la1max;
  double dx, dy, dz, dxyz;
  double dxa1;


  a1 = (*n2).globalx - (*n1).globalx;
  b1 = (*n2).globaly - (*n1).globaly;
  c1 = (*n2).globalz - (*n1).globalz;

  la1max = sqrt (a1 * a1 + b1 * b1 + c1 * c1);

  a1 = a1 / la1max;
  b1 = b1 / la1max;
  c1 = c1 / la1max;

  dx = (*n1).globalx - (*n11).globalx;
  dy = (*n1).globaly - (*n11).globaly;
  dz = (*n1).globalz - (*n11).globalz;

  dxyz = dx * dx + dy * dy + dz * dz;

  dxa1 = 2.0 * dx * a1 + 2.0 * dy * b1 + 2.0 * dz * c1;

  la1 = -dxa1 / 2.0;

  x = (*n1).globalx + (a1 * la1);
  y = (*n1).globaly + (b1 * la1);
  z = (*n1).globalz + (c1 * la1);

  return;
}

compiled with -g0 -O3 it segfaults at the last return.

I will upload the assembler files for gcc snapshot and for trunk.


-- 
           Summary: codegen bug?
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: r dot emrich at de dot tecosim dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39002


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2009-01-30  9:29 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28 14:18 [Bug c++/39002] New: codegen bug? r dot emrich at de dot tecosim dot com
2009-01-28 14:21 ` [Bug c++/39002] " r dot emrich at de dot tecosim dot com
2009-01-28 14:22 ` r dot emrich at de dot tecosim dot com
2009-01-28 14:25 ` falk at debian dot org
2009-01-28 14:27 ` r dot emrich at de dot tecosim dot com
2009-01-28 14:44 ` falk at debian dot org
2009-01-28 14:45 ` r dot emrich at de dot tecosim dot com
2009-01-28 14:57 ` r dot emrich at de dot tecosim dot com
2009-01-28 16:52 ` r dot emrich at de dot tecosim dot com
2009-01-28 17:01 ` r dot emrich at de dot tecosim dot com
2009-01-28 17:02 ` r dot emrich at de dot tecosim dot com
2009-01-28 17:06 ` r dot emrich at de dot tecosim dot com
2009-01-28 18:04 ` r dot emrich at de dot tecosim dot com
2009-01-28 19:06 ` r dot emrich at de dot tecosim dot com
2009-01-29  8:05 ` [Bug target/39002] codegen bug, stack pointer is not restored ubizjak at gmail dot com
2009-01-29  8:06 ` [Bug target/39002] [4,4 Regression] " ubizjak at gmail dot com
2009-01-29 10:31 ` [Bug target/39002] [4.4 " jakub at gcc dot gnu dot org
2009-01-29 10:47 ` r dot emrich at de dot tecosim dot com
2009-01-29 11:35 ` r dot emrich at de dot tecosim dot com
2009-01-29 12:04 ` jakub at gcc dot gnu dot org
2009-01-29 12:21 ` ktietz at gcc dot gnu dot org
2009-01-29 12:27 ` ktietz at gcc dot gnu dot org
2009-01-29 12:53 ` ktietz at gcc dot gnu dot org
2009-01-29 13:24 ` jakub at gcc dot gnu dot org
2009-01-29 13:46 ` ktietz at gcc dot gnu dot org
2009-01-29 13:54 ` jakub at gcc dot gnu dot org
2009-01-29 14:05 ` ktietz at gcc dot gnu dot org
2009-01-29 14:34 ` jakub at gcc dot gnu dot org
2009-01-29 22:48 ` sezeroz at gmail dot com
2009-01-30  8:54 ` ktietz at gcc dot gnu dot org
2009-01-30  9:23 ` jakub at gcc dot gnu dot org
2009-01-30  9:29 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).