pro64-support
[Top] [All Lists]

C to Whirl

To: pro64-support@xxxxxxxxxxx
Subject: C to Whirl
From: "Charles R. Hardnett" <hardnett@xxxxxxxxxxxxx>
Date: Mon, 25 Jun 2001 09:47:47 -0400 (EDT)
Reply-to: hardnett@xxxxxxxxxxxxx
Sender: owner-pro64-support@xxxxxxxxxxx

Hello,

I have a question that involves the C to Whirl generation. I am using
the whirl2C module, and noticed a bug with code such as the following:


        struct stat sbuf;
 
        if (sbuf.st_mode) {
          printf("hello");
        }


The above code comes out of pro64 after whirl2c translation to look
something like:

if((_UINT32)(*(struct stat0 {
    _UINT64 st_dev;
    _UINT32 st_ino;
    _INT32 __pad1;
    _UINT32 st_mode;
    _UINT32 st_nlink;
    _UINT32 st_uid;
    _UINT32 st_gid;
    _UINT64 st_rdev;
    _INT64 st_size;
    _INT64 st_atime;
    _INT64 st_mtime;
    _INT64 st_ctime;
    _INT32 st_blocks;
    _INT32 __pad2;
    _UINT32 st_blksize;
    _INT32 __pad3;
    _INT64 __unused[6LL];
  } *)(((_INT8 *) & sbuf) + 16LL)) != 0U)
  {
    printf((const _INT8 *)(_INT8(*)[6LL]) "hello");
  }                                                                             

The problem of course is cast contains a declaration of the struct,
and not just the name of the struct. I have tracked down the problem
to where this only occurs when a struct field is accessed within a
cond exp i.e. within while, if, for, etc.

I have also convinced myself that the problem is not in the whirl2c
conversion because it appears that whirl2C is only outputing the token
information that is stored in the WN for this object's
type. Therefore, it appears that the problem is the translation from C
to whirl by GFEC is most likely the culprit. 

My questions are: 

   1. Is there anyone else looking at the whirl2c module that may have
run into this problem?

   2. If not, does anyone have any good information on GFEC and how
its exprs are stored? operated on to create the whirl? I was looking
at the code this weekend, and could use any documentation anyone may
have on it.

Thanks,

Charles
  
-- 
--------------------------------------------------------------------
Charles R. Hardnett www.spelman.edu/~hardnett 


<Prev in Thread] Current Thread [Next in Thread>