> On Linux/x86_64,
> 
> d7145b4bb6c8729a1e782373cb6256c06ed60465 is the first bad commit
> commit d7145b4bb6c8729a1e782373cb6256c06ed60465
> Author: Jan Hubicka <j...@suse.cz>
> Date:   Wed Mar 31 11:35:29 2021 +0200
> 
>     Small refactoring of cgraph_node::release_body
> 
> caused
> 
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++14 (internal compiler error)

This should be fixed by the attached patch. Sorry for this - I added the
check at last minute and apparently did not fully retest.
We now have clones of thunks that does make sense even after body was
released.  What does not make much sense to me is why we consider them
clones at all, but that is something to revisit next stage1.

Honza

gcc/ChangeLog:

        PR lto/99447
        * cgraph.c (cgraph_node::release_body): Fix overactive check.

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index b77c676a58a..d7c78d518bc 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1860,7 +1860,15 @@ cgraph_node::release_body (bool keep_arguments)
       lto_free_function_in_decl_state_for_node (this);
       lto_file_data = NULL;
     }
-  gcc_assert (!clones);
+  if (flag_checking && clones)
+    {
+      /* It is invalid to release body before materializing clones except
+        for thunks that don't really need a body.  Verify also that we do
+        not leak pointers to the call statements.  */
+      for (cgraph_node *node = clones; node;
+          node = node->next_sibling_clone)
+       gcc_assert (node->thunk && !node->callees->call_stmt);
+    }
   remove_callees ();
   remove_all_references ();
 }
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++17 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++17 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++2a (internal compiler error)
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++2a (test for excess errors)
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++98 (internal compiler error)
> FAIL: g++.dg/ipa/devirt-7.C  -std=gnu++98 (test for excess errors)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++14 (internal compiler error)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++17 (internal compiler error)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++17 (test for excess errors)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++2a (internal compiler error)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++2a (test for excess errors)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++98 (internal compiler error)
> FAIL: g++.dg/ipa/pr71146.C  -std=gnu++98 (test for excess errors)
> FAIL: g++.dg/ipa/pr85421.C   (internal compiler error)
> FAIL: g++.dg/ipa/pr85421.C   (test for excess errors)
> FAIL: g++.dg/ipa/pr92528.C   (internal compiler error)
> FAIL: g++.dg/ipa/pr92528.C   (test for excess errors)
> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (internal compiler error)
> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (test for excess errors)
> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fuse-linker-plugin 
> -fno-fat-lto-objects  (internal compiler error)
> FAIL: g++.dg/torture/covariant-1.C   -O2 -flto -fuse-linker-plugin 
> -fno-fat-lto-objects  (test for excess errors)
> FAIL: g++.dg/torture/pr46287.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (internal compiler error)
> FAIL: g++.dg/torture/pr46287.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (test for excess errors)
> FAIL: g++.dg/torture/pr46287.C   -O2 -flto -fuse-linker-plugin 
> -fno-fat-lto-objects  (internal compiler error)
> FAIL: g++.dg/torture/pr46287.C   -O2 -flto -fuse-linker-plugin 
> -fno-fat-lto-objects  (test for excess errors)
> FAIL: g++.dg/torture/pr46287.C   -O2  (internal compiler error)
> FAIL: g++.dg/torture/pr46287.C   -O2  (test for excess errors)
> FAIL: g++.dg/torture/pr46287.C   -O3 -fomit-frame-pointer -funroll-loops 
> -fpeel-loops -ftracer -finline-functions  (internal compiler error)
> FAIL: g++.dg/torture/pr46287.C   -O3 -fomit-frame-pointer -funroll-loops 
> -fpeel-loops -ftracer -finline-functions  (test for excess errors)
> FAIL: g++.dg/torture/pr46287.C   -O3 -g  (internal compiler error)
> FAIL: g++.dg/torture/pr46287.C   -O3 -g  (test for excess errors)
> FAIL: g++.dg/torture/pr78692.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (internal compiler error)
> FAIL: g++.dg/torture/pr78692.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (test for excess errors)
> FAIL: g++.dg/torture/pr78692.C   -O2  (internal compiler error)
> FAIL: g++.dg/torture/pr78692.C   -O2  (test for excess errors)
> FAIL: g++.dg/torture/pr78692.C   -O3 -g  (internal compiler error)
> FAIL: g++.dg/torture/pr78692.C   -O3 -g  (test for excess errors)
> FAIL: g++.dg/torture/pr83619.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (internal compiler error)
> FAIL: g++.dg/torture/pr83619.C   -O2 -flto -fno-use-linker-plugin 
> -flto-partition=none  (test for excess errors)
> FAIL: g++.dg/torture/pr83619.C   -O2  (internal compiler error)
> FAIL: g++.dg/torture/pr83619.C   -O2  (test for excess errors)
> FAIL: g++.dg/torture/pr83619.C   -O3 -g  (internal compiler error)
> FAIL: g++.dg/torture/pr83619.C   -O3 -g  (test for excess errors)
> FAIL: libgomp.c/declare-variant-1.c (test for excess errors)
> 
> with GCC configured with
> 
> ../../gcc/configure 
> --prefix=/local/skpandey/gccwork/toolwork/gcc-bisect-master/master/r11-7926/usr
>  --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld 
> --with-fpmath=sse --enable-languages=c,c++,fortran --enable-cet --without-isl 
> --enable-libmpx x86_64-linux --disable-bootstrap
> 
> To reproduce:
> 
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/devirt-7.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/devirt-7.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/devirt-7.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/devirt-7.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr71146.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr71146.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr71146.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr71146.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr85421.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr85421.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr85421.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr85421.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr92528.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr92528.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr92528.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check RUNTESTFLAGS="dg.exp=g++.dg/ipa/pr92528.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/covariant-1.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/covariant-1.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/covariant-1.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/covariant-1.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr46287.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr46287.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr46287.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr46287.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr78692.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr78692.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr78692.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr78692.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr83619.C 
> --target_board='unix{-m32}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr83619.C 
> --target_board='unix{-m32\ -march=cascadelake}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr83619.C 
> --target_board='unix{-m64}'"
> $ cd {build_dir}/gcc && make check 
> RUNTESTFLAGS="dg-torture.exp=g++.dg/torture/pr83619.C 
> --target_board='unix{-m64\ -march=cascadelake}'"
> $ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check 
> RUNTESTFLAGS="c.exp=libgomp.c/declare-variant-1.c --target_board='unix{-m32}'"
> $ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check 
> RUNTESTFLAGS="c.exp=libgomp.c/declare-variant-1.c --target_board='unix{-m32\ 
> -march=cascadelake}'"
> $ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check 
> RUNTESTFLAGS="c.exp=libgomp.c/declare-variant-1.c --target_board='unix{-m64}'"
> $ cd {build_dir}/x86_64-linux/libgomp/testsuite && make check 
> RUNTESTFLAGS="c.exp=libgomp.c/declare-variant-1.c --target_board='unix{-m64\ 
> -march=cascadelake}'"
> 
> (Please do not reply to this email, for question about this report, contact 
> me at skpgkp2 at gmail dot com)

Reply via email to