This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ program produces no output (g++ 4.3.2, cygwin 1.7)


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]