Bug 12123 - segfault for a C++ program with a compilicated array initializer
Summary: segfault for a C++ program with a compilicated array initializer
Status: RESOLVED DUPLICATE of bug 11665
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-09-01 07:01 UTC by Nitin Yewale
Modified: 2003-11-21 16:19 UTC (History)
4 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-09-01 12:19:59


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nitin Yewale 2003-09-01 07:01:33 UTC
Following C++ program when compiled for H8/300 target, compiler generates an 
Internal Compiler Error.

The error is observed on GCC 3.3 as well as GCC 3.4 branch.

h8300-elf-g++ test.cc -S


------------------- test.cc Start -----------------------------
static unsigned int array1[7];

typedef struct
{
   unsigned long sar;
   unsigned long dar;
   unsigned int cra;
   unsigned int crb;
} DtcRamInfo;


static const DtcRamInfo test =
{
   0,
   (((int)&array1[0]) & 0xFFFFFF),
   7,
   0
};

------------------- test.cc End -----------------------------
Comment 1 Kazu Hirata 2003-09-01 12:19:59 UTC
Minimized down to

int g;

struct foo {
  int a;
  int b;
};

struct foo bar = {
  0,
  (((int) &g) & 0xFFFFFF)
};

Confirmed with gcc-3.4 on i686-pc-linux-gnu (native).
Confirmed with gcc-3.2.2 (RH9) on i686-pc-linux-gnu (native).
Confirmed with gcc-3.4 on i686-pc-linux-gnu cross h8300-hms.
Comment 2 Andrew Pinski 2003-11-21 16:19:56 UTC
This is a dup of bug 11665 which was fixed for 3.3.2.

*** This bug has been marked as a duplicate of 11665 ***