[Bug c++/41986] New: incorrect execution via addition of -finline-functions

View: New views
4 Messages — Rating Filter:   Alert me  

[Bug c++/41986] New: incorrect execution via addition of -finline-functions

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Compiling with "-Wall -O2" results in the correct execution of this code.
Compiling with "-Wall -O2 -finline-functions" with the code as attached, causes
the assertion to fail, which should not happen. However, if you uncomment
either of the std::cout lines in Decoder.cc or DecoderDerivs.cc and recompile
with "-Wall -O2 -finline-functions", the assertion does not fail. It appears if
you force the any of the "node" variables to be read, the assertion will not
fail (the correct execution).


--
           Summary: incorrect execution via addition of -finline-functions
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim dot dawborn at gmail dot com


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


[Bug c++/41986] incorrect execution via addition of -finline-functions

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #1 from tim dot dawborn at gmail dot com  2009-11-08 09:45 -------
Created an attachment (id=18992)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18992&action=view)
the code required to reproduce the bug

$ tar -zxf test.tgz
$ cd test
$ make clean all
$ ./main
main: Decoder.cc:22: Node* Decoder::best_equiv(Node*): Assertion
`max_node->score == max_score' failed.
Aborted


--


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


[Bug c++/41986] incorrect execution via addition of -finline-functions

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #2 from rguenth at gcc dot gnu dot org  2009-11-08 11:36 -------
You seem to run afoul generic floating point equality comparison issues.
best_score possibly modifies scores and calls back to best_equiv.  Roudning
issues with the accumulation can lead to the failure.

So, we need some analysis on your part to prove this is a bug with GCC,
we're not application debuggers ;)


--

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


[Bug c++/41986] incorrect execution via addition of -finline-functions

by Bugzilla from gcc-bugzilla@gcc.gnu.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



------- Comment #3 from tim dot dawborn at gmail dot com  2009-11-08 14:15 -------
Thanks. Your comment sparked an idea. There is no bug in the logic of the
source code itself, nor should there be any floating point differences
anywhere. There should be no floating point differences as for every two
floating point variables $a$ and $b$ which are checked for equality, before the
check happens, $a$ will be assigned the value $b$. I've refined the code needed
to replicate down a lot and will repost the bug under a more suitable heading,
as it has nothing to do with inline-functions. Sorry to waste your time :)

Summary:
Upon further inspection, the description of this ticket is not correct. Will
re-file bug under appropriate heading.


--

tim dot dawborn at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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