public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/11091] New: vta-test.exp failure loc2c u_const declaration duplication with multiple pieces
@ 2009-12-14 14:33 mjw at redhat dot com
  2010-01-13 11:50 ` [Bug translator/11091] " mjw at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: mjw at redhat dot com @ 2009-12-14 14:33 UTC (permalink / raw)
  To: systemtap

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2404 bytes --]

With latest gcc (GCC) 4.4.2 20091027 (Red Hat 4.4.2-7) on Fedora 12 with i386
vta-test.exp started failing with:

$ stap -k /home/mark/src/systemtap/testsuite/systemtap.base/vta-test.stp -c
./vta-test.exe
/tmp/stap0GRdMF/stap_8812.c: In function ‘function__dwarf_tvar_get_i_0’:
/tmp/stap0GRdMF/stap_8812.c:161: error: conflicting types for ‘u_const’
/tmp/stap0GRdMF/stap_8812.c:157: note: previous declaration of ‘u_const’ was here
make[1]: *** [/tmp/stap0GRdMF/stap_8812.o] Error 1
make: *** [_module_/tmp/stap0GRdMF] Error 2
Pass 4: compilation failed.  Try again with another '--vp 0001' option.
Keeping temporary directory "/tmp/stap0GRdMF"

The problem is:

  {
    union {
      char bytes[8];
      struct {
        uint32_t p0;
        uint32_t p4;
      } pieces __attribute__ ((packed));
      uint64_t whole;
    } u_pieces;
    union {
      char bytes[4];
      uint32_t whole;
    } u_const;
    union {
      char bytes[4];
      uint32_t whole;
    } u_const;
    u_const.bytes[0] = 0x21;
    u_const.bytes[1] = 0x43;
    u_const.bytes[2] = 0x65;
    u_const.bytes[3] = 0x87;
    u_pieces.pieces.p0 = u_const.whole;
    u_const.bytes[0] = 0xef;
    u_const.bytes[1] = 0xbe;
    u_const.bytes[2] = 0xad;
    u_const.bytes[3] = 0xde;
    u_pieces.pieces.p4 = u_const.whole;
    THIS->__retvalue = u_pieces.whole;
  }

Which is generated from loc2c.c (declare_noncontig_union). Which currently only
takes into account that a loc_noncontiguous and a loc_constant could be in the
same scope:

  // Different loc types could be in the same syntactical scope, so
  // should be named differently.
  const char *uname;
  if (loc->type == loc_noncontiguous)
    uname = "u_pieces";
  else if (loc->type == loc_constant)
    uname = "u_const";

This should probably be extended to have a "count" added for the nesting level.

-- 
           Summary: vta-test.exp failure loc2c u_const declaration
                    duplication with multiple pieces
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap at sources dot redhat dot com
        ReportedBy: mjw at redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11091

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

* [Bug translator/11091] vta-test.exp failure loc2c u_const declaration duplication with multiple pieces
  2009-12-14 14:33 [Bug translator/11091] New: vta-test.exp failure loc2c u_const declaration duplication with multiple pieces mjw at redhat dot com
@ 2010-01-13 11:50 ` mjw at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: mjw at redhat dot com @ 2010-01-13 11:50 UTC (permalink / raw)
  To: systemtap


------- Additional Comments From mjw at redhat dot com  2010-01-13 11:50 -------
commit 9fa29c5277f3e3f4525ff3335a2cbc2b518c2010
Author: Mark Wielaard <mjw@redhat.com>
Date:   Thu Jan 7 17:54:28 2010 +0100

    Fix multi-piece constant failure in vta-test.exp on 32bit systems.
    
    Commit 73b5e9 "Make sure loc2c declare_noncontig_union for different locs
    don't overlap", wasn't complete. It only took into account having a piece
    becuase of a noncontiguous loc and a constant loc together. But pieces can
    be nested deeper (newer gcc outputs multiple constant locations for one
    piece on 32bit systems). This patch keeps track of the piece declaration
    depth. Another approach could have been to have each sub-piece in its own
    local scope, but keeping track of the depth and naming the temporary unions
    distinct fitted the current code better. It currently only supports a depth
    of 10. An error will be emitted if a location construct needs more than 10
    pieces to be assembled.
    
    * loc2c.c (declare_noncontig_union): Take depth argument. Always use the
      same name for the union (u_pieces<depth>).
      (translate_base_fetch): Take depth argument. Use it to calculate union
      names.
      (translate_base_store): Likewise.
      (c_translate_fetch): Pass in depth zero.
      (c_translate_store): Likewise.
      (c_translate_pointer): Likewise.
      (c_translate_pointer_store): Likewise.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=11091

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

end of thread, other threads:[~2010-01-13 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-14 14:33 [Bug translator/11091] New: vta-test.exp failure loc2c u_const declaration duplication with multiple pieces mjw at redhat dot com
2010-01-13 11:50 ` [Bug translator/11091] " mjw at redhat dot com

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).