delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/24/15:08:34

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS,WEIRD_PORT
X-Spam-Check-By: sourceware.org
Message-ID: <49F210AB.8000602@gmail.com>
Date: Fri, 24 Apr 2009 20:19:07 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: C++ program produces no output (g++ 4.3.2, cygwin 1.7)
References: <gsqjs7$qsb$1 AT ger DOT gmane DOT org>
In-Reply-To: <gsqjs7$qsb$1@ger.gmane.org>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Eric Lilja wrote:

> The code was written september 2007 and then it ran and displayed its
> output just fine. It's a simple AVL Tree with a small test program.
> I'm using g++ 4.3.2. Something seems to be up with cygcheck too, because
> I have attached the wierd looking output it gave me (and it took a while
> for it to complete as well).

  Something seems to be up with tar as well, unless you meant for all those
files to have no perms when unpacked?

$ tar xvf cpp-program.tar
AVL_Tree.h
AVL_Tree.cc
avl_tree-test.cc
Makefile

$ ls -lart
total 105
---------- 1 DKAdmin None   299 Sep 13  2007 Makefile
---------- 1 DKAdmin None  1584 Sep 13  2007 AVL_Tree.h
---------- 1 DKAdmin None 13774 Sep 13  2007 AVL_Tree.cc
---------- 1 DKAdmin None  5616 Apr 23 21:31 avl_tree-test.cc
drwxrwxrwt 1 DKAdmin None 73728 Apr 24 20:06 ..
drwxr-xr-x 1 DKAdmin None  4096 Apr 24 20:06 .

$

> Maybe someone could try the program I attached and see if they get the
> same problems as me?

$ make
g++ -Wall -Wextra -std=c++98 -pedantic -g -c avl_tree-test.cc
AVL_Tree.cc: In static member function 'static void
AVL_Tree_Node<Comparable>::insert(const Comparable&,
AVL_Tree_Node<Comparable>*&) [with Comparable = int]':
AVL_Tree.cc:481:   instantiated from 'void AVL_Tree<Comparable>::insert(const
Comparable&) [with Comparable = int]'
avl_tree-test.cc:20:   instantiated from here
AVL_Tree.cc:194: warning: null argument where non-null required (argument 1)
g++ avl_tree-test.o -o testavl.exe

$ ./testavl.exe ; echo $?
Entering main()
Performing LL-test.
Should perform single_rotate_with_left_child.
Inserting 50, 22, 75, 80, 43, 15, 9.
    80
   /
  75
 /
50
 \
    43
   /
  22
   \
    15
     \
      9


Removing 80.
Performing single_rotate_with_left_child
    75
   /
  50
   \
    43
 /
22
 \
  15
   \
    9



Performing LR-rest.
Should perform double_rotate_with_left_child.
Inserting 50, 22, 75, 80, 43, 15, 28.
    80
   /
  75
 /
50
 \
    43
     \
      28
   /
  22
   \
    15


Removing 80.
Peforming double_rotate_with_left_child
    75
   /
  50
 /
43
 \
    28
   /
  22
   \
    15



Performing RR-test.
Should perform single_rotate_with_right_child.
Inserting 50, 35, 75, 25, 65, 85, 95.
      95
     /
    85
   /
  75
   \
    65
 /
50
 \
  35
   \
    25


Removing 25.
Performing single_rotate_with_right_child.
    95
   /
  85
 /
75
 \
    65
   /
  50
   \
    35



Performing RL-test.
Should perform double_rotate_with_right_child.
Inserting 50, 25, 75, 15, 65, 80, 70.
    80
   /
  75
   \
      70
     /
    65
 /
50
 \
  25
   \
    15


Removing 15.
Performing double_rotate_with_right_child.
    80
   /
  75
   \
    70
 /
65
 \
  50
   \
    25

0

$

> I don't know how to use gdb, but I did try running my code under gdb,
> here's what I got:
> $ gdb testavl.exe

> Program exited with code 030000000005.

  That's octal for 0xC0000005 aka STATUS_ACCESS_VIOLATION.  Does adding
"-Wl,--enable-auto-import" to LDFLAGS help any?

    cheers,
      DaveK


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019