diff options
author | Marek Polacek <polacek@redhat.com> | 2022-08-22 12:43:30 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2022-08-23 09:09:46 -0400 |
commit | b25c5d6133d356a34aee72a24fd4cdec5637cc17 (patch) | |
tree | b3f27e1c22689142e7a22320bda0905d391e8a6f /gcc | |
parent | fcd9671e73c877d0bd8a2c0a16cf7cf2ce93fe60 (diff) | |
download | gcc-b25c5d6133d356a34aee72a24fd4cdec5637cc17.zip gcc-b25c5d6133d356a34aee72a24fd4cdec5637cc17.tar.gz gcc-b25c5d6133d356a34aee72a24fd4cdec5637cc17.tar.bz2 |
testsuite: Add test for r11-4123
r11-4123 came without a test but I happened upon a nice test case that
got fixed by that revision. So I think it'd be good to add it. The
ICE was:
phi-1.C: In constructor 'ElementManager::ElementManager()':
phi-1.C:28:1: error: missing definition
28 | ElementManager::ElementManager() : array_(makeArray()) {}
| ^~~~~~~~~~~~~~
for SSA_NAME: _12 in statement:
_10 = PHI <_12(3), _11(5)>
PHI argument
_12
for PHI node
_10 = PHI <_12(3), _11(5)>
during GIMPLE pass: fixup_cfg
phi-1.C:28:1: internal compiler error: verify_ssa failed
gcc/testsuite/ChangeLog:
* g++.dg/torture/phi-1.C: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/torture/phi-1.C | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/torture/phi-1.C b/gcc/testsuite/g++.dg/torture/phi-1.C new file mode 100644 index 0000000..69fb3d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/phi-1.C @@ -0,0 +1,28 @@ +// { dg-do compile { target c++11 } } +// { dg-options "--param early-inlining-insns=14" } + +struct Element; +template <int _Nm> struct __array_traits { typedef Element _Type[_Nm]; }; +template <int _Nm> struct array { + typename __array_traits<_Nm>::_Type _M_elems; +}; +bool logLevel(); +struct LogCapture { + void stream(); +}; +struct Element { + Element(); + long data_; +}; +using ElementArray = array<6>; +struct ElementManager { + ElementManager(); + ElementArray array_; +}; +static ElementArray makeArray() { + if (logLevel()) + LogCapture().stream(); + ElementArray foo; + return foo; +} +ElementManager::ElementManager() : array_(makeArray()) {} |