public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12789] New: [tree-ssa] Miscompilation of small program
@ 2003-10-27 14:33 bangerth at dealii dot org
  2003-10-27 14:34 ` [Bug c++/12789] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-10-27 14: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=12789

           Summary: [tree-ssa] Miscompilation of small program
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org

This small program
---------------------------
#include <fstream>
#include <string>

void foo (const int i) {
  std::ifstream in("irrelevant");
  std::string line;
  if (i == 1) return;
  foo (1);
}

int main () {
  foo (0);
}
---------------------------
segfaults on running when compiled with the tree-ssa
branch from
  gcc version 3.5-tree-ssa 20031024 (merged 20031017)
It doesn't segfault with mainline from the same day, though.
Assuming that the code in libstdc++ is the same on the two
branches, this means that something is being miscompiled. This
could, theoretically also include a miscompilation in libstdc++
itself, since I can't get around using parts of it, but it 
strikes me as odd that I need the tail recursion in foo() to
actually trigger the bug in the program. Maybe it is just
some interaction of the tail recursion and the stack space/
constructors/exception handling details of the objects in use
in this function that make this happen, so this could actually
be simple to track down than it looks like.

W.


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

* [Bug c++/12789] [tree-ssa] Miscompilation of small program
  2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
@ 2003-10-27 14:34 ` bangerth at dealii dot org
  2003-10-27 17:22 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-10-27 14:34 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=12789


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical
   Target Milestone|---                         |tree-ssa


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

* [Bug c++/12789] [tree-ssa] Miscompilation of small program
  2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
  2003-10-27 14:34 ` [Bug c++/12789] " bangerth at dealii dot org
@ 2003-10-27 17:22 ` pinskia at gcc dot gnu dot org
  2003-10-28 19:13 ` bangerth at dealii dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-27 17:22 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=12789



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-27 17:19 -------
Most likely the same bug as PR 12751.


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

* [Bug c++/12789] [tree-ssa] Miscompilation of small program
  2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
  2003-10-27 14:34 ` [Bug c++/12789] " bangerth at dealii dot org
  2003-10-27 17:22 ` pinskia at gcc dot gnu dot org
@ 2003-10-28 19:13 ` bangerth at dealii dot org
  2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-10-28 19:13 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=12789



------- Additional Comments From bangerth at dealii dot org  2003-10-28 18:02 -------
This is indeed almost certainly the same bug. Here's something smaller: 
----------------------------- 
#include <cstdio> 
 
struct X 
{ 
    X()  { printf ("X::X\n"); } 
    ~X() { printf ("X::~X\n"); } 
}; 
 
void foo (const int i) { 
  X x1, x2; 
  if (i == 1) return; 
  foo (1); 
} 
 
int main () { 
  foo (0); 
} 
------------------------------ 
 
I get 4 calls to the ctor, and 5 to the dtor. 
 
W.


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

* [Bug c++/12789] [tree-ssa] Miscompilation of small program
  2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
                   ` (3 preceding siblings ...)
  2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
@ 2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
  2003-11-14 16:50 ` bangerth at dealii dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-30  4:53 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=12789


pinskia at gcc dot gnu dot org changed:

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


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-30 04:51 -------
It is a dup of bug 12751, as it works correctly with -fno-exception and it has nothing to do with 
tail recursion (or switch's), it is eh related.


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

* [Bug c++/12789] [tree-ssa] Miscompilation of small program
  2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
                   ` (2 preceding siblings ...)
  2003-10-28 19:13 ` bangerth at dealii dot org
@ 2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
  2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
  2003-11-14 16:50 ` bangerth at dealii dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-10-30  4:53 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=12789


pinskia at gcc dot gnu dot org changed:

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


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-10-30 04:53 -------


*** This bug has been marked as a duplicate of 12751 ***


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

* [Bug c++/12789] [tree-ssa] Miscompilation of small program
  2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
                   ` (4 preceding siblings ...)
  2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
@ 2003-11-14 16:50 ` bangerth at dealii dot org
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-11-14 16:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2003-11-14 16:50 -------
Confirmed fixed with rth's patch to 12751. 
Thanks a lot! 

-- 


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


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

end of thread, other threads:[~2003-11-14 16:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-27 14:33 [Bug c++/12789] New: [tree-ssa] Miscompilation of small program bangerth at dealii dot org
2003-10-27 14:34 ` [Bug c++/12789] " bangerth at dealii dot org
2003-10-27 17:22 ` pinskia at gcc dot gnu dot org
2003-10-28 19:13 ` bangerth at dealii dot org
2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
2003-10-30  4:53 ` pinskia at gcc dot gnu dot org
2003-11-14 16:50 ` bangerth at dealii 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).