public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15209] New: Runs out of memory with packed structs
@ 2004-04-29 19:50 bangerth at dealii dot org
  2004-04-29 19:54 ` [Bug c++/15209] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-04-29 19:50 UTC (permalink / raw)
  To: gcc-bugs

Taken from  http://gcc.gnu.org/ml/gcc-bugs/2004-04/msg02848.html :  
  
This is somewhat ironic: we run out of memory when using packed structs 
the wrong way ;-) 
 
I took the files from the package in above mail and tried to compile. Indeed, 
we get 
into a memory eating loop with the preprocessed source files I attach 
(it quickly runs into the 500-600 MB range and then eventually crashes 
for me). Removing the cause of the warning messages  
  x.ii:34314: warning: ignoring packed attribute on unpacked non-POD field 
    `MD5Hash PACKET_HEADER::hash' 
  x.ii:34315: warning: ignoring packed attribute on unpacked non-POD field 
   `MD5Hash PACKET_HEADER::setid' 
makes the problem to go away, though. Compile line is simply 
  c++ x.ii 
 
With 3.3.4, I get an ICE somewhere in the libstdc++ parts of 3.4, so I can't 
say from the preprocessed sources (all that I have left on my harddisk right 
now) whether this is a regression. 
 
I don't have the time to reduce memory hogs at present, so if someone else 
is interested in picking this up, feel free to. 
 
Wolfgang

-- 
           Summary: Runs out of memory with packed structs
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bangerth at dealii dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

* [Bug c++/15209] Runs out of memory with packed structs
  2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
@ 2004-04-29 19:54 ` bangerth at dealii dot org
  2004-04-29 20:28 ` [Bug c++/15209] [3.4/3.5 Regression]Runs " pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2004-04-29 19:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-29 19:41 -------
Created an attachment (id=6189)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6189&action=view)
preprocessed sources


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

* [Bug c++/15209] [3.4/3.5 Regression]Runs out of memory with packed structs
  2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
  2004-04-29 19:54 ` [Bug c++/15209] " bangerth at dealii dot org
@ 2004-04-29 20:28 ` pinskia at gcc dot gnu dot org
  2004-05-22 19:30 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-29 20:28 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-29 20:04 -------
Confirmed, reduced to at least (note this can most likely be reduced down further):
typedef unsigned int size_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;

typedef unsigned int uint32_t;
__extension__ typedef unsigned long long int uint64_t;

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;

struct MAGIC {u8 magic[8];} __attribute__ ((packed));
struct PACKETTYPE {u8 type[16];} __attribute__ ((packed));


typedef u16 leu16;
typedef u32 leu32;
typedef u64 leu64;

class MD5Hash
{
public:

  MD5Hash(void) {};

  void *print(void) const;
  MD5Hash(const MD5Hash &other);
  MD5Hash& operator=(const MD5Hash &other);

public:
  u8 hash[16];
};

struct PACKET_HEADER
{

  MAGIC magic;
  leu64 length;
  MD5Hash hash;
  MD5Hash setid;
  PACKETTYPE type;
} __attribute__ ((packed));


struct MAINPACKET
{
  PACKET_HEADER header;

  leu64 blocksize;
  leu32 recoverablefilecount;
  MD5Hash fileid[0];


} __attribute__ ((packed));

struct CriticalPacket
{
  u8 *packetdata;
  size_t packetlength;
};

class MainPacket : public CriticalPacket
{
  const MD5Hash& SetId(void) const;

  u64 blocksize;
  u32 totalfilecount;
  u32 recoverablefilecount;
};

inline const MD5Hash& MainPacket::SetId(void) const
{
  return ((const MAINPACKET*)packetdata)->header.setid;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code, memory-
                   |                            |hog
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-29 20:04:38
               date|                            |
            Summary|Runs out of memory with     |[3.4/3.5 Regression]Runs out
                   |packed structs              |of memory with packed
                   |                            |structs
   Target Milestone|---                         |3.4.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

* [Bug c++/15209] [3.4/3.5 Regression]Runs out of memory with packed structs
  2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
  2004-04-29 19:54 ` [Bug c++/15209] " bangerth at dealii dot org
  2004-04-29 20:28 ` [Bug c++/15209] [3.4/3.5 Regression]Runs " pinskia at gcc dot gnu dot org
@ 2004-05-22 19:30 ` pinskia at gcc dot gnu dot org
  2004-05-22 19:31 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-22 19:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-21 19:29 -------
*** Bug 15573 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |twalberg at mindspring dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

* [Bug c++/15209] [3.4/3.5 Regression]Runs out of memory with packed structs
  2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
                   ` (2 preceding siblings ...)
  2004-05-22 19:30 ` pinskia at gcc dot gnu dot org
@ 2004-05-22 19:31 ` pinskia at gcc dot gnu dot org
  2004-05-29 14:49 ` mmitchel at gcc dot gnu dot org
  2004-05-29 16:01 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-22 19:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-21 19:44 -------
And here is the most reduced source:
struct MD5Hash
{
  MD5Hash(void) {};
  void *print(void) const;
  MD5Hash (const MD5Hash&);
};
struct PACKET_HEADER
{
  MD5Hash setid;
} __attribute__ ((packed));
const MD5Hash& SetId(unsigned char *packetdata)
{
  return ((const PACKET_HEADER*)packetdata)->setid;
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

* [Bug c++/15209] [3.4/3.5 Regression]Runs out of memory with packed structs
  2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
                   ` (3 preceding siblings ...)
  2004-05-22 19:31 ` pinskia at gcc dot gnu dot org
@ 2004-05-29 14:49 ` mmitchel at gcc dot gnu dot org
  2004-05-29 16:01 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-05-29 14:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-05-28 21:03 -------
I cannot reproduce this with the reduced case in Comment #4 using current 3.4.1
sources.  Is this still a problem?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

* [Bug c++/15209] [3.4/3.5 Regression]Runs out of memory with packed structs
  2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
                   ` (4 preceding siblings ...)
  2004-05-29 14:49 ` mmitchel at gcc dot gnu dot org
@ 2004-05-29 16:01 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-29 16:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-28 21:22 -------
Hmm, I think I reduced comment #2 too much.  I can still reproduce the one in comment #2 but not the 
one in comment #4.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15209


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

end of thread, other threads:[~2004-05-28 21:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-29 19:50 [Bug c++/15209] New: Runs out of memory with packed structs bangerth at dealii dot org
2004-04-29 19:54 ` [Bug c++/15209] " bangerth at dealii dot org
2004-04-29 20:28 ` [Bug c++/15209] [3.4/3.5 Regression]Runs " pinskia at gcc dot gnu dot org
2004-05-22 19:30 ` pinskia at gcc dot gnu dot org
2004-05-22 19:31 ` pinskia at gcc dot gnu dot org
2004-05-29 14:49 ` mmitchel at gcc dot gnu dot org
2004-05-29 16:01 ` pinskia at gcc dot gnu dot org

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