comparison gcc/testsuite/g++.dg/opt/new1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // PR c++/39367 1 // PR c++/39367 - ICE at tree-inline.c:1042 with -O
2 // { dg-options "-O" } 2 // { dg-options "-O" }
3 3
4 class QScriptEnginePrivate; 4 class QScriptEnginePrivate;
5 class QScriptClassInfo; 5 class QScriptClassInfo;
6 namespace QScript { 6 namespace QScript {
13 }; 13 };
14 namespace QScript { 14 namespace QScript {
15 namespace Ecma { 15 namespace Ecma {
16 class Core { 16 class Core {
17 public: 17 public:
18 inline QScriptEnginePrivate *engine() const { } 18 inline QScriptEnginePrivate *engine() const { return 0; }
19 inline QScriptClassInfo *classInfo() const { } 19 inline QScriptClassInfo *classInfo() const { return 0; }
20 QScriptValueImpl publicPrototype; 20 QScriptValueImpl publicPrototype;
21 }; 21 };
22 class Boolean: public Core { 22 class Boolean: public Core {
23 void newBoolean(QScriptValueImpl *result, bool value = false); 23 void newBoolean(QScriptValueImpl *result, bool value = false);
24 }; 24 };
35 template <typename T> void QScript::Buffer<T>::resize(int s) { 35 template <typename T> void QScript::Buffer<T>::resize(int s) {
36 if (m_capacity < s) 36 if (m_capacity < s)
37 reserve (s << 1); 37 reserve (s << 1);
38 } 38 }
39 template <typename T> void QScript::Buffer<T>::reserve(int x) { 39 template <typename T> void QScript::Buffer<T>::reserve(int x) {
40 /* The following may be optimized into a trap because the function
41 is called from resize(0) and so with m_capacity < 0. When not
42 optimized it may trigger -Walloc-size-larger-than= since
43 operator new() is called with an excessively large value.
44 The warning is pruned from the test output below. */
40 T *new_data = new T[m_capacity]; 45 T *new_data = new T[m_capacity];
41 for (int i=0; i<m_size; ++i) 46 for (int i=0; i<m_size; ++i)
42 new_data[i] = m_data[i]; 47 new_data[i] = m_data[i];
43 } 48 }
44 class QScriptObject { 49 class QScriptObject {
67 { 72 {
68 engine()->newObject(result, publicPrototype, classInfo()); 73 engine()->newObject(result, publicPrototype, classInfo());
69 } 74 }
70 } 75 }
71 } 76 }
77
78 // { dg-prune-output "\\\[-Walloc-size-larger-than=]" }