public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11767] New: different code behaviour with -fprofile-arcs -ftest-coverage
@ 2003-08-01 20:33 lothar at xcerla dot com
  2003-08-01 20:45 ` [Bug c++/11767] " lothar at xcerla dot com
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: lothar at xcerla dot com @ 2003-08-01 20:33 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: different code behaviour with -fprofile-arcs -ftest-
                    coverage
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lothar at xcerla dot com
                CC: gcc-bugs at gcc dot gnu dot org

lothar@janus$ gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

The code behaviour is different if I compile with -fprofile-arcs
-ftest-coverage or not. In both cases I compiled with -O0 (no
optimizations). I noticed it, as some of my cppunit tests failed. Here
is one of the tests: It basically only stores a value in a class which
acts as a wrapper to the GNU MP library and get's the same value back.
To my surprise the value I get back is both, the same and not the same
as I put in (at least according to the C++ comparison operators
available).

  void gccbug ( void )
  {
    {
      signed long const c_v(5);
      RawInteger i(c_v);
      signed long const c_v2(i.valueSignedLong());
      
      std::cout << "long " << std::endl
                << c_v2 << " "
                << c_v  << " "
                << (c_v2 > c_v)  << " "
                << (c_v2 >= c_v) << " "
                << (c_v2 < c_v)  << " "
                << (c_v2 <= c_v) << " "
                << (c_v2 == c_v) << " "
                << (c_v2 != c_v) << " "
                << std::endl;
    }
    {
      double const c_v(5.0);
      RawInteger i(c_v);
      double const c_v2(i.valueDouble());
      
      std::cout << "double " << std::endl
                << c_v2 << " "
                << c_v  << " "
                << (c_v2 > c_v)  << " "
                << (c_v2 >= c_v) << " "
                << (c_v2 < c_v)  << " "
                << (c_v2 <= c_v) << " "
                << (c_v2 == c_v) << " "
                << (c_v2 != c_v) << " "
                << std::endl;
    }
  }


Here's the output of this code fragment:
  without code coverage:
long
5 5 0 1 0 1 1 0
double
5 5 0 1 0 1 1 0

  with code coverage:
long
5 5 0 1 0 1 1 0
double
5 5 0 1 0 1 0 1


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

end of thread, other threads:[~2004-03-04  7:50 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-01 20:33 [Bug c++/11767] New: different code behaviour with -fprofile-arcs -ftest-coverage lothar at xcerla dot com
2003-08-01 20:45 ` [Bug c++/11767] " lothar at xcerla dot com
2003-08-01 21:59 ` pinskia at physics dot uc dot edu
2003-08-03 14:14 ` pinskia at physics dot uc dot edu
2003-08-04 17:01 ` lothar at xcerla dot com
2003-08-04 17:10 ` lothar at xcerla dot com
2003-08-04 18:18 ` pinskia at physics dot uc dot edu
2003-08-04 21:37 ` lothar at xcerla dot com
2003-08-04 21:40 ` lothar at xcerla dot com
2003-08-04 23:37 ` [Bug c++/11767] different code behaviour with -fnon-call-exceptions -fprofile-arcs pinskia at physics dot uc dot edu
2003-08-05  0:43 ` [Bug target/11767] " pinskia at physics dot uc dot edu
2003-08-05  1:51 ` lothar at xcerla dot com
2003-08-23  1:07 ` dhazeghi at yahoo dot com
2003-08-28 16:21 ` pinskia at gcc dot gnu dot org
2004-01-01  0:56 ` [Bug target/11767] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2004-03-02 23:39 ` [Bug target/11767] [3.3/3.4/3.5 " rth at gcc dot gnu dot org
2004-03-03  0:45 ` [Bug middle-end/11767] " cvs-commit at gcc dot gnu dot org
2004-03-03  0:46 ` cvs-commit at gcc dot gnu dot org
2004-03-03  0:48 ` cvs-commit at gcc dot gnu dot org
2004-03-03  0:54 ` rth at gcc dot gnu dot org
2004-03-04  7:50 ` cvs-commit 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).