| 1 |
// { dg-do run } |
| 2 |
// { dg-additional-options "-fstack-protector-strong -fno-late-combine-instructions" } |
| 3 |
// { dg-require-effective-target fstack_protector } |
| 4 |
// { dg-require-effective-target c++11 } |
| 5 |
|
| 6 |
struct Private { |
| 7 |
char data[24]{}; |
| 8 |
long moved_from : 4; |
| 9 |
Private() : moved_from (0) {} |
| 10 |
}; |
| 11 |
|
| 12 |
struct QVariant { |
| 13 |
__attribute__((noipa)) |
| 14 |
~QVariant() { |
| 15 |
if (!d.moved_from && d.data[0] != 42) |
| 16 |
__builtin_abort (); |
| 17 |
} |
| 18 |
__attribute__((noipa)) |
| 19 |
QVariant() { |
| 20 |
d.data[0] = 42; |
| 21 |
} |
| 22 |
__attribute__((noipa)) |
| 23 |
QVariant(QVariant &other) : d(other.d) {} |
| 24 |
QVariant(QVariant &&other) : d(other.d) { |
| 25 |
other.d = Private(); |
| 26 |
other.d.moved_from = true; |
| 27 |
} |
| 28 |
QVariant &operator=(QVariant); |
| 29 |
Private d; |
| 30 |
}; |
| 31 |
|
| 32 |
QVariant id (QVariant v) { return v; } |
| 33 |
QVariant &QVariant::operator=(QVariant other) |
| 34 |
{ |
| 35 |
id(other); |
| 36 |
return *this; |
| 37 |
} |
| 38 |
|
| 39 |
template <typename T> struct QList { |
| 40 |
T d; |
| 41 |
struct const_iterator { |
| 42 |
T *ptr; |
| 43 |
T &operator*() { return *ptr; } |
| 44 |
__attribute__((noipa)) |
| 45 |
bool operator!=(const_iterator other) { return ptr != other.ptr; } |
| 46 |
void operator++() { ptr++; } |
| 47 |
}; |
| 48 |
__attribute__((noipa)) |
| 49 |
T at() { return d; } |
| 50 |
const_iterator begin() { return const_iterator { &d }; } |
| 51 |
const_iterator end() { return const_iterator { &d }; } |
| 52 |
}; |
| 53 |
struct QArrayDataPointer { |
| 54 |
int d; |
| 55 |
int *ptr; |
| 56 |
long size; |
| 57 |
}; |
| 58 |
|
| 59 |
QArrayDataPointer null_qadp; |
| 60 |
|
| 61 |
struct QString { |
| 62 |
__attribute__((noipa)) |
| 63 |
QList<QString> split() const { |
| 64 |
return QList<QString> {null_qadp}; |
| 65 |
} |
| 66 |
__attribute__((noipa)) |
| 67 |
friend bool operator==(QString, QString) { return true; } |
| 68 |
|
| 69 |
__attribute__((noipa)) |
| 70 |
QString(QArrayDataPointer dp) : d(dp) {} |
| 71 |
QArrayDataPointer d; |
| 72 |
}; |
| 73 |
|
| 74 |
__attribute__((noipa)) |
| 75 |
QString as_qstr (QVariant *v) |
| 76 |
{ |
| 77 |
return QString (null_qadp); |
| 78 |
} |
| 79 |
|
| 80 |
int *getNode(const QString &tagContent) { |
| 81 |
auto expr = tagContent.split(); |
| 82 |
auto blockName = expr.at(); |
| 83 |
auto loadedBlocksVariant = QVariant (); |
| 84 |
QList<QVariant> blockVariantList; |
| 85 |
for (auto &item : blockVariantList) { |
| 86 |
auto blockNodeName = as_qstr (&item); |
| 87 |
blockNodeName == blockName; |
| 88 |
QString q(null_qadp); |
| 89 |
} |
| 90 |
loadedBlocksVariant = QVariant(); |
| 91 |
return nullptr; |
| 92 |
} |
| 93 |
|
| 94 |
int main(void) |
| 95 |
{ |
| 96 |
QString foo(null_qadp); |
| 97 |
getNode(foo); |
| 98 |
} |