The type that triggers the ICE never got completed by the semantic
analysis pass. Checking for size forces it to be done, or issue a
compile-time error.
PR d/106555
gcc/d/ChangeLog:
* d-target.cc (Target::isReturnOnStack): Check for return type size.
gcc/testsuite/ChangeLog:
* gdc.dg/imports/pr106555.d: New test.
* gdc.dg/pr106555.d: New test.
(cherry picked from commit
4b0253b019943abf2cc5f4db0b7ed67caedffe4a)
return false;
Type *tn = tf->next->toBasetype ();
+ if (tn->size () == SIZE_INVALID)
+ return false;
return (tn->ty == TY::Tstruct || tn->ty == TY::Tsarray);
}
--- /dev/null
+module imports.pr106555;
+struct S106555
+{
+ int[] f106555;
+ int max106555;
+ this(int)
+ {
+ f106555.length = max106555;
+ }
+}
--- /dev/null
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106555
+// { dg-do compile }
+// { dg-additional-options "-O2" }
+// { dg-additional-sources "imports/pr106555.d" }