re PR c++/23180 (Segfault on const initializer with bogus pointer arithmetics)
PR c++/23180 * g++.dg/init/struct2.C: New test. * g++.dg/init/struct3.C: New test. From-SVN: r104254
This commit is contained in:
parent
bb9baf1c9b
commit
68a2828871
|
@ -1,3 +1,9 @@
|
|||
2005-09-13 Josh Conner <jconner@apple.com>
|
||||
|
||||
PR c++/23180
|
||||
* g++.dg/init/struct2.C: New test.
|
||||
* g++.dg/init/struct3.C: New test.
|
||||
|
||||
2005-09-13 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* gcc.dg/pr15784-4.c, gcc.dg/pr20130-1.c, gcc.dg/ucnid-6.c:
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* PR c++/23180. */
|
||||
/* Initialize a local structure with an expression that attempts to use
|
||||
pointer arithmetic to calculate another structure field offset. */
|
||||
|
||||
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);
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/* PR c++/23180. */
|
||||
/* Initialize a global variable with an expression that attempts to use
|
||||
pointer arithmetic to calculate a structure field offset. */
|
||||
|
||||
struct Track {
|
||||
char soundName[15];
|
||||
};
|
||||
|
||||
struct SaveLoadEntry {
|
||||
int offs;
|
||||
int type;
|
||||
int size;
|
||||
};
|
||||
|
||||
int foobar = ((long) (& ((Track *) 42)->soundName[0])) - 42;
|
Loading…
Reference in New Issue