Bug 87156 - [9 Regression] ICE building libstdc++ for mips64
Summary: [9 Regression] ICE building libstdc++ for mips64
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: 9.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
: 87285 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-30 17:38 UTC by Joseph S. Myers
Modified: 2018-11-14 18:18 UTC (History)
5 users (show)

See Also:
Host:
Target: mips64-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-09-28 00:00:00


Attachments
Preprocessed source (66.71 KB, text/plain)
2018-08-30 17:38 UTC, Joseph S. Myers
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2018-08-30 17:38:02 UTC
Created attachment 44632 [details]
Preprocessed source

I see the following ICE building libstdc++ for mips64-linux-gnu.  Compile with: -S -O2 -std=gnu++11 compatibility-c++0x.ii

Bisecting shows it first appearing with r263962, though I don't really see what it has to do with that commit.  Still fails as of r263983 (line numbers in this backtrace are from that revision).

during GIMPLE pass: fnsplit
/scratch/jmyers/glibc/many9/src/gcc/libstdc++-v3/src/c++11/compatibility-c++0x.cc: In function 'virtual std::error_condition std::error_category::default_error_condition(int) const':
/scratch/jmyers/glibc/many9/src/gcc/libstdc++-v3/src/c++11/compatibility-c++0x.cc:256:1: internal compiler error: Segmentation fault
256 | }
    | ^
0xd71e5f crash_signal
        /scratch/jmyers/glibc/many9/src/gcc/gcc/toplev.c:325
0x1036ca8 tree_class_check(tree_node*, tree_code_class, char const*, int, char const*)
        /scratch/jmyers/glibc/many9/src/gcc/gcc/tree.h:3235
0x1036ca8 decl_function_context(tree_node const*)
        /scratch/jmyers/glibc/many9/src/gcc/gcc/tree.c:8994
0x10d0cb7 mips_get_compress_mode
        /scratch/jmyers/glibc/many9/src/gcc/gcc/config/mips/mips.c:1355
0x10d1fa8 mips_set_current_function
        /scratch/jmyers/glibc/many9/src/gcc/gcc/config/mips/mips.c:19636
0xa6ba9b invoke_set_current_function_hook
        /scratch/jmyers/glibc/many9/src/gcc/gcc/function.c:4616
0xa74533 invoke_set_current_function_hook
        /scratch/jmyers/glibc/many9/src/gcc/gcc/function.c:4600
0xa74533 allocate_struct_function(tree_node*, bool)
        /scratch/jmyers/glibc/many9/src/gcc/gcc/function.c:4729
0xe05d4d initialize_cfun
        /scratch/jmyers/glibc/many9/src/gcc/gcc/tree-inline.c:2452
0xe05d4d tree_function_versioning(tree_node*, tree_node*, vec<ipa_replace_map*, va_gc, vl_embed>*, bool, bitmap_head*, bool, bitmap_head*, basic_block_def*)
        /scratch/jmyers/glibc/many9/src/gcc/gcc/tree-inline.c:5833
0x92e80c cgraph_node::create_version_clone_with_body(vec<cgraph_edge*, va_heap, vl_ptr>, vec<ipa_replace_map*, va_gc, vl_embed>*, bitmap_head*, bool, bitmap_head*, basic_block_def*, char const*)
        /scratch/jmyers/glibc/many9/src/gcc/gcc/cgraphclones.c:984
0x58b18c split_function
        /scratch/jmyers/glibc/many9/src/gcc/gcc/ipa-split.c:1330
0x14269d2 execute_split_functions
        /scratch/jmyers/glibc/many9/src/gcc/gcc/ipa-split.c:1825
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 1 Paul Hua 2018-09-04 13:00:39 UTC
confirmed.

cced: Jan Hubicka <hubicka@ucw.cz>
Comment 2 Thomas Preud'homme 2018-09-28 10:06:29 UTC
Just hit it again with yesterday's trunk on the compile farm.
Comment 3 Jan Hubicka 2018-09-28 10:12:03 UTC
Does the attached patch fix the bootstrap?
Index: cgraphclones.c
===================================================================
--- cgraphclones.c      (revision 264180)
+++ cgraphclones.c      (working copy)
@@ -967,6 +967,8 @@ cgraph_node::create_version_clone_with_b
   SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
   SET_DECL_RTL (new_decl, NULL);
 
+  DECL_VIRTUAL_P (new_decl) = 0;
+
   /* When the old decl was a con-/destructor make sure the clone isn't.  */
   DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
   DECL_STATIC_DESTRUCTOR (new_decl) = 0;
Comment 4 Paul Hua 2018-09-29 07:50:25 UTC
(In reply to Jan Hubicka from comment #3)
> Does the attached patch fix the bootstrap?
> Index: cgraphclones.c
> ===================================================================
> --- cgraphclones.c      (revision 264180)
> +++ cgraphclones.c      (working copy)
> @@ -967,6 +967,8 @@ cgraph_node::create_version_clone_with_b
>    SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
>    SET_DECL_RTL (new_decl, NULL);
>  
> +  DECL_VIRTUAL_P (new_decl) = 0;
> +
>    /* When the old decl was a con-/destructor make sure the clone isn't.  */
>    DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
>    DECL_STATIC_DESTRUCTOR (new_decl) = 0;

Yes, fixed. Thanks.
Comment 5 Thomas Preud'homme 2018-10-03 13:51:05 UTC
(In reply to Paul Hua from comment #4)
> (In reply to Jan Hubicka from comment #3)
> > Does the attached patch fix the bootstrap?
> > Index: cgraphclones.c
> > ===================================================================
> > --- cgraphclones.c      (revision 264180)
> > +++ cgraphclones.c      (working copy)
> > @@ -967,6 +967,8 @@ cgraph_node::create_version_clone_with_b
> >    SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
> >    SET_DECL_RTL (new_decl, NULL);
> >  
> > +  DECL_VIRTUAL_P (new_decl) = 0;
> > +
> >    /* When the old decl was a con-/destructor make sure the clone isn't.  */
> >    DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
> >    DECL_STATIC_DESTRUCTOR (new_decl) = 0;
> 
> Yes, fixed. Thanks.

Likewise for me on gcc23.
Comment 6 Iain Buclaw 2018-10-06 19:13:42 UTC
(In reply to Jan Hubicka from comment #3)
> Does the attached patch fix the bootstrap?
> Index: cgraphclones.c
> ===================================================================
> --- cgraphclones.c      (revision 264180)
> +++ cgraphclones.c      (working copy)
> @@ -967,6 +967,8 @@ cgraph_node::create_version_clone_with_b
>    SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl));
>    SET_DECL_RTL (new_decl, NULL);
>  
> +  DECL_VIRTUAL_P (new_decl) = 0;
> +
>    /* When the old decl was a con-/destructor make sure the clone isn't.  */
>    DECL_STATIC_CONSTRUCTOR (new_decl) = 0;
>    DECL_STATIC_DESTRUCTOR (new_decl) = 0;

I just got round to checking this, and reached the same conclusion without realising you already made a patch.

Has this been posted yet?
Comment 7 Jeffrey A. Law 2018-10-12 02:40:49 UTC
Author: law
Date: Fri Oct 12 02:40:17 2018
New Revision: 265074

URL: https://gcc.gnu.org/viewcvs?rev=265074&root=gcc&view=rev
Log:
	PR target/87156
	* cgraphclones.c (cgraph_node::create_version_clone_with_body):
	Set new_decl virtual flag to zero.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphclones.c
Comment 8 Jeffrey A. Law 2018-10-12 02:41:25 UTC
I committed Jan's patch to the trunk.
Comment 9 Jakub Jelinek 2018-11-14 18:18:40 UTC
*** Bug 87285 has been marked as a duplicate of this bug. ***