re PR c++/23180 (Segfault on const initializer with bogus pointer arithmetics)

PR c++/23180
        * g++.dg/init/pr23180-1.C: New test.
        * g++.dg/init/pr23180-2.C: New test.

From-SVN: r104070
This commit is contained in:
Josh Conner 2005-09-09 01:39:36 +00:00 committed by Josh Conner
parent d047a20198
commit 84bb243df1
3 changed files with 34 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2005-09-08 Josh Conner <jconner@apple.com>
PR c++/23180
* g++.dg/init/pr23180-1.C: New test.
* g++.dg/init/pr23180-2.C: New test.
2005-09-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/18878

View file

@ -0,0 +1,17 @@
void saveLoadEntries(const void *);
void saveOrLoad() {
struct Track {
char soundName[15];
};
struct SaveLoadEntry {
int offs;
int type;
int size;
};
SaveLoadEntry trackEntries = {
((long) (&((Track *) 42)->soundName[0])) - 42,
0, 1
};
saveLoadEntries(&trackEntries);
}

View file

@ -0,0 +1,11 @@
struct Track {
char soundName[15];
};
struct SaveLoadEntry {
int offs;
int type;
int size;
};
int foobar = ((long) (& ((Track *) 42)->soundName[0])) - 42;