public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
@ 2014-06-06 20:33 zsojka at seznam dot cz
  2014-06-10 10:13 ` [Bug c++/61433] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: zsojka at seznam dot cz @ 2014-06-06 20:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

            Bug ID: 61433
           Summary: [4.9/4.10 Regression] ICE: SIGSEGV in
                    friend_accessible_p (search.c:778) with -std=gnu++11
                    -O -fcompare-debug -fno-inline -fno-ipa-pure-const
                    -fipa-sra
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 32906
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32906&action=edit
reduced testcase

Compiler output (under valgrind):
$ gcc -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
testcase.C
==2513== Invalid read of size 2
==2513==    at 0x7C4941: friend_accessible_p(tree_node*, tree_node*,
tree_node*) (search.c:778)
==2513==    by 0x7C4F58: accessible_p(tree_node*, tree_node*, bool)
(search.c:928)
==2513==    by 0x7C5114: accessible_base_p(tree_node*, tree_node*, bool)
(search.c:171)
==2513==    by 0x7C4564: lookup_base(tree_node*, tree_node*, int, base_kind*,
int) (search.c:273)
==2513==    by 0x79AE19: finish_class_member_access_expr(tree_node*,
tree_node*, bool, int) (typeck.c:2755)
==2513==    by 0x6A7BD0: tsubst_copy_and_build(tree_node*, tree_node*, int,
tree_node*, bool, bool) (pt.c:15187)
==2513==    by 0x6AC207: tsubst(tree_node*, tree_node*, int, tree_node*)
(pt.c:12280)
==2513==    by 0x738DB0: dump_substitution(cxx_pretty_printer*, tree_node*,
tree_node*, tree_node*, int) (error.c:330)
==2513==    by 0x73B815: decl_as_string(tree_node*, int) (error.c:2738)
==2513==    by 0xDAE0E5: dump_function_header(_IO_FILE*, tree_node*, int)
(tree-pretty-print.c:3454)
==2513==    by 0xA3589E: (anonymous
namespace)::pass_clean_state::execute(function*) (final.c:4605)
==2513==    by 0xC17387: execute_one_pass(opt_pass*) (passes.c:2180)
==2513==    by 0xC177B5: execute_pass_list_1(opt_pass*) (passes.c:2233)
==2513==    by 0xC17808: execute_pass_list(function*, opt_pass*)
(passes.c:2244)
==2513==    by 0x94D6AF: expand_function(cgraph_node*) (cgraphunit.c:1787)
==2513==    by 0x94F863: compile() (cgraphunit.c:1921)
==2513==    by 0x94FF64: finalize_compilation_unit() (cgraphunit.c:2342)
==2513==    by 0x72C2DE: cp_write_global_declarations() (decl2.c:4647)
==2513==    by 0xD1245C: compile_file() (toplev.c:562)
==2513==    by 0xD14494: toplev_main(int, char**) (toplev.c:1918)
==2513==    by 0x5A46BF4: (below main) (in /lib64/libc-2.17.so)
==2513==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2513== 
==2513== 
==2513== Process terminating with default action of signal 11 (SIGSEGV)
==2513==  Access not within mapped region at address 0x0
==2513==    at 0x7C4941: friend_accessible_p(tree_node*, tree_node*,
tree_node*) (search.c:778)
==2513==    by 0x7C4F58: accessible_p(tree_node*, tree_node*, bool)
(search.c:928)
==2513==    by 0x7C5114: accessible_base_p(tree_node*, tree_node*, bool)
(search.c:171)
==2513==    by 0x7C4564: lookup_base(tree_node*, tree_node*, int, base_kind*,
int) (search.c:273)
==2513==    by 0x79AE19: finish_class_member_access_expr(tree_node*,
tree_node*, bool, int) (typeck.c:2755)
==2513==    by 0x6A7BD0: tsubst_copy_and_build(tree_node*, tree_node*, int,
tree_node*, bool, bool) (pt.c:15187)
==2513==    by 0x6AC207: tsubst(tree_node*, tree_node*, int, tree_node*)
(pt.c:12280)
==2513==    by 0x738DB0: dump_substitution(cxx_pretty_printer*, tree_node*,
tree_node*, tree_node*, int) (error.c:330)
==2513==    by 0x73B87E: decl_as_string_translate(tree_node*, int)
(error.c:2746)
==2513==    by 0x73AEA2: cp_diagnostic_starter(diagnostic_context*,
diagnostic_info*) (error.c:3087)
==2513==    by 0x15EA4B8: diagnostic_report_diagnostic(diagnostic_context*,
diagnostic_info*) (diagnostic.c:798)
==2513==    by 0x15EB21F: internal_error(char const*, ...) (diagnostic.c:1136)
==2513==    by 0xD123CF: crash_signal(int) (toplev.c:337)
==2513==    by 0x5A5A5AF: ??? (in /lib64/libc-2.17.so)
==2513==    by 0x7C4940: friend_accessible_p(tree_node*, tree_node*,
tree_node*) (search.c:778)
==2513==    by 0x7C4F58: accessible_p(tree_node*, tree_node*, bool)
(search.c:928)
==2513==    by 0x7C5114: accessible_base_p(tree_node*, tree_node*, bool)
(search.c:171)
==2513==    by 0x7C4564: lookup_base(tree_node*, tree_node*, int, base_kind*,
int) (search.c:273)
==2513==    by 0x79AE19: finish_class_member_access_expr(tree_node*,
tree_node*, bool, int) (typeck.c:2755)
==2513==    by 0x6A7BD0: tsubst_copy_and_build(tree_node*, tree_node*, int,
tree_node*, bool, bool) (pt.c:15187)
==2513==    by 0x6AC207: tsubst(tree_node*, tree_node*, int, tree_node*)
(pt.c:12280)
==2513==    by 0x738DB0: dump_substitution(cxx_pretty_printer*, tree_node*,
tree_node*, tree_node*, int) (error.c:330)
==2513==    by 0x73B815: decl_as_string(tree_node*, int) (error.c:2738)
==2513==    by 0xDAE0E5: dump_function_header(_IO_FILE*, tree_node*, int)
(tree-pretty-print.c:3454)
==2513==    by 0xA3589E: (anonymous
namespace)::pass_clean_state::execute(function*) (final.c:4605)
==2513==    by 0xC17387: execute_one_pass(opt_pass*) (passes.c:2180)
==2513==    by 0xC177B5: execute_pass_list_1(opt_pass*) (passes.c:2233)
==2513==    by 0xC17808: execute_pass_list(function*, opt_pass*)
(passes.c:2244)
==2513==    by 0x94D6AF: expand_function(cgraph_node*) (cgraphunit.c:1787)
==2513==    by 0x94F863: compile() (cgraphunit.c:1921)
==2513==    by 0x94FF64: finalize_compilation_unit() (cgraphunit.c:2342)
==2513==    by 0x72C2DE: cp_write_global_declarations() (decl2.c:4647)
==2513==    by 0xD1245C: compile_file() (toplev.c:562)
==2513==    by 0xD14494: toplev_main(int, char**) (toplev.c:1918)
==2513==    by 0x5A46BF4: (below main) (in /lib64/libc-2.17.so)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
@ 2014-06-10 10:13 ` rguenth at gcc dot gnu.org
  2014-06-25 12:59 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-10 10:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
  2014-06-10 10:13 ` [Bug c++/61433] " rguenth at gcc dot gnu.org
@ 2014-06-25 12:59 ` jakub at gcc dot gnu.org
  2014-06-26 12:46 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-06-25 12:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-06-25
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jamborm at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r210426.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
  2014-06-10 10:13 ` [Bug c++/61433] " rguenth at gcc dot gnu.org
  2014-06-25 12:59 ` jakub at gcc dot gnu.org
@ 2014-06-26 12:46 ` rguenth at gcc dot gnu.org
  2014-06-26 16:35 ` jamborm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-06-26 12:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, -compare-debug not working is bad.  Martin, can you have a look?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2014-06-26 12:46 ` rguenth at gcc dot gnu.org
@ 2014-06-26 16:35 ` jamborm at gcc dot gnu.org
  2014-06-27  4:05 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-06-26 16:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #2)
> Hmm, -compare-debug not working is bad.  Martin, can you have a look?

Well, the C++ front-end crashes when DECL_LANG_SPECIFIC is cleared on
clones.  We started doing this in Jakub's revision r207465 which fixed
PR 60002.  So if this is OK (and since Jason approved of it in that
PR, I assume it is), the front-end needs to be aware of this.  I do
not know it well enough to propose anything more clever than the
following (so far untested) patch.  However, DECL_LANG_SPECIFIC is
accessed by many macros in cp-tree.h so issues like these are likely
to continue popping up.


diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 424b26c..cc77d8f 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -775,7 +775,13 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
     return 0;

   if (DECL_DECLARES_FUNCTION_P (scope))
-    befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
+    {
+      if (DECL_ABSTRACT_ORIGIN (scope))
+       befriending_classes = DECL_BEFRIENDING_CLASSES
+         (DECL_ABSTRACT_ORIGIN (scope));
+      else
+       befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
+    }
   else if (TYPE_P (scope))
     befriending_classes = CLASSTYPE_BEFRIENDING_CLASSES (scope);
   else
@@ -800,6 +806,9 @@ friend_accessible_p (tree scope, tree decl, tree binfo)
          && friend_accessible_p (DECL_CONTEXT (scope), decl, binfo))
        return 1;

+      if (DECL_ABSTRACT_ORIGIN (scope))
+       scope = DECL_ABSTRACT_ORIGIN (scope);
+      
       /* Or an instantiation of something which is a friend.  */
       if (DECL_TEMPLATE_INFO (scope))
        {


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2014-06-26 16:35 ` jamborm at gcc dot gnu.org
@ 2014-06-27  4:05 ` jason at gcc dot gnu.org
  2014-06-27 21:39 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-06-27  4:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2014-06-27  4:05 ` jason at gcc dot gnu.org
@ 2014-06-27 21:39 ` jason at gcc dot gnu.org
  2014-06-28  3:46 ` jason at gcc dot gnu.org
  2014-06-28  3:46 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-06-27 21:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jun 27 21:38:24 2014
New Revision: 212091

URL: https://gcc.gnu.org/viewcvs?rev=212091&root=gcc&view=rev
Log:
    PR c++/61433
    * error.c (dump_template_bindings): Don't tsubst in a clone.

Added:
    trunk/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/error.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2014-06-27 21:39 ` jason at gcc dot gnu.org
@ 2014-06-28  3:46 ` jason at gcc dot gnu.org
  2014-06-28  3:46 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-06-28  3:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.9.1.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/61433] [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra
  2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2014-06-28  3:46 ` jason at gcc dot gnu.org
@ 2014-06-28  3:46 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2014-06-28  3:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61433

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Sat Jun 28 03:44:53 2014
New Revision: 212098

URL: https://gcc.gnu.org/viewcvs?rev=212098&root=gcc&view=rev
Log:
    PR c++/61433
    * error.c (dump_template_bindings): Don't tsubst in a clone.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/debug/dwarf2/pr61433.C
Modified:
    branches/gcc-4_9-branch/gcc/cp/ChangeLog
    branches/gcc-4_9-branch/gcc/cp/error.c


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-06-28  3:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-06 20:33 [Bug c++/61433] New: [4.9/4.10 Regression] ICE: SIGSEGV in friend_accessible_p (search.c:778) with -std=gnu++11 -O -fcompare-debug -fno-inline -fno-ipa-pure-const -fipa-sra zsojka at seznam dot cz
2014-06-10 10:13 ` [Bug c++/61433] " rguenth at gcc dot gnu.org
2014-06-25 12:59 ` jakub at gcc dot gnu.org
2014-06-26 12:46 ` rguenth at gcc dot gnu.org
2014-06-26 16:35 ` jamborm at gcc dot gnu.org
2014-06-27  4:05 ` jason at gcc dot gnu.org
2014-06-27 21:39 ` jason at gcc dot gnu.org
2014-06-28  3:46 ` jason at gcc dot gnu.org
2014-06-28  3:46 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).