[UPS bug] Problem displaying certain "typedef" variables

From: Bob Carragher (bob_at_fla.fujitsu.com)
Date: Fri Apr 09 1999 - 04:49:32 BST


Hello,

I'm sorry to always post a bug report to this mailing list.  So let
me first thank everyone who helps maintain UPS, because it's what
lets me do my job (or at least not go crazy doing it B-)!

My bug seems to occur when one defines a variable of a user-defined
type (using "typedef struct").  This particular type is defined
in terms of another user-defined type.  Further, there's a third
user-defined type which is defined in terms of the second type.
All of this seems necessary.  If you omit one of these types, the
bug goes away.

(If this sounds confusing, don't worry, I included a completely
contained C file which causes the bug to occur.)

By the way, the bug in question causes UPS to core dump.  I've been
able to cause versions 3.32, 3.32.1, and 3.33 to core dump.  Here
is how you do it.

     (1)  Save the C code after the "Cut Here" line to a
          file (say, "main.c").

     (2)  Compile it for debugging.  E.g.

               gcc -g main.c

     (3)  Start ups on it:

               ups a.out

     (4)  Execute to the "return" statement in the main() function
          (e.g. by using the "Execute to here" right-mouse menu
          option in the code subwindow).

     (5)  Place local variable (its the only one in the code),
          core_dump, in the display area (e.g. by clicking on it).

     (6)  Now try to expand it (either by double-clicking on it
          in the display area, or by clicking on the "Expand" menu
          option at the top.

     (7)  The result should be a core dump.  You will receive the
          following message in the window from which you launched
          UPS:

               Fatal error: segmentation fault.
               Dumping core ... Segmentation fault (core dumped)

I've tried various configurations to see if it may simply be a
subtle bug of the OS, or the version of UPS.  That doesn't seem
to be the case.  Here are the system configurations that I've
tried.  Feel free to mix and match, as all should allow the bug
to be produced.

     OS:            SunOS 4.1.4, Sun Solaris 2.5.1, 2.6
     C Compiler:    gcc 2.8.1
     UPS versions:  3.32 (compiled with gcc 2.7.2.2),
                    3.32.1 (compiled with gcc 2.7.2.2),
                    3.33 (compiled with gcc 2.8.1)

Note:  this problem doesn't appear when I compile main.c using
gcc 2.7.0 (under SunOS 4.1.4), or 2.7.2 (under Solaris 2.6).
Nor does it appear with Sun's C compiler, version 4.2 (under
SunOS 4.1.4).  (I wonder if it's a problem with gcc 2.8.1 ...?)

If you can find a way to smash this bug, I would greatly appreciate
it!

Thanks!

				Bob

------------------------------Cut Here------------------------------
typedef struct _type1 {
   struct _type2 *type2_field;
} type1;

typedef struct _type2 {
   struct _type3 *type3_field;
} type2, *type2_ptr;

typedef struct _type3 {
   type2_ptr      type2_field;
} type3;

main(){
   type3 core_dump;
   return;
}


This archive was generated by hypermail 2.1.4 : Wed Feb 13 2002 - 21:51:32 GMT