Bug#966026: gdc-10: ICE building gtk-d on armhf/armel/s390x
On 22/07/2020 17:42, Matthias Klose wrote:
> Control: tags -1 + moreinfo
>
> On 7/22/20 12:59 PM, Adrian Bunk wrote:
>> Package: gdc-10
>> Version: 10.1.0-6
>> Severity: important
>> Tags: ftbfs
>> Control: affects -1 src:gtk-d
>>
>> https://buildd.debian.org/status/package.php?p=gtk-d&suite=sid
>>
>> ...
>> during RTL pass: expand
>> /usr/lib/gcc/arm-linux-gnueabihf/10/include/d/std/algorithm/mutation.d: In function ‘gtkd_container_remove’:
>> /usr/lib/gcc/arm-linux-gnueabihf/10/include/d/std/algorithm/mutation.d:2044:10: internal compiler error: Segmentation fault
>> 2044 | auto result = range;
>> | ^
>> Please submit a full bug report,
>> with preprocessed source if appropriate.
>> See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
>> make[2]: *** [GNUmakefile:260: generated/gtkd/gtk/Container.pic.o] Error 1
>>
>
> I see this on armhf with a -j8 build. Trying to re-run the command succeeds.
> Building the package with -j1 also succeeds. Are you able to get a stacktrace?
>
I think fixing upstream PR96156 and PR96157 will deal with this.
However for the gcc-10 release, obviously will need a smaller change to fix
this issue.
Issue raised here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96301
Testing the following patch doesn't show up any regressions in the testsuite,
despite my initial reservations that it would do the right thing for POD types.
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 845fc5cf877..e1ec1719b4c 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -981,11 +981,13 @@ public:
{
tree resdecl = DECL_RESULT (fndecl);
- TREE_TYPE (resdecl)
- = build_reference_type (TREE_TYPE (resdecl));
- DECL_BY_REFERENCE (resdecl) = 1;
- TREE_ADDRESSABLE (resdecl) = 0;
- relayout_decl (resdecl);
+ if (TREE_ADDRESSABLE (TREE_TYPE (resdecl)))
+ {
+ TREE_TYPE (resdecl) = build_reference_type (TREE_TYPE (resdecl));
+ DECL_BY_REFERENCE (resdecl) = 1;
+ TREE_ADDRESSABLE (resdecl) = 0;
+ relayout_decl (resdecl);
+ }
if (d->nrvo_var)
{
@@ -995,7 +997,9 @@ public:
DECL_NAME (resdecl) = DECL_NAME (var);
/* Don't forget that we take its address. */
TREE_ADDRESSABLE (var) = 1;
- resdecl = build_deref (resdecl);
+
+ if (DECL_BY_REFERENCE (resdecl))
+ resdecl = build_deref (resdecl);
SET_DECL_VALUE_EXPR (var, resdecl);
DECL_HAS_VALUE_EXPR_P (var) = 1;
Reply to: