public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace
@ 2012-09-07 10:02 werner.henze at alumni dot tu-berlin.de
  2012-09-07 10:25 ` [Bug middle-end/54515] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: werner.henze at alumni dot tu-berlin.de @ 2012-09-07 10:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

             Bug #: 54515
           Summary: cc1plus sigsegv -O2 anonymous namespace
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: werner.henze@alumni.tu-berlin.de


cc1plus crashes with a sigsegv.
The crash does occur with -O2, not with -Os or -O1.
The crash does not occur if I do not use an anonymous namespace for the
functions ReadPIB7400, ReadPIB7420, AddAdapterAndReferencedAdapters and
GenerateTrafficForPhyRate (by commenting out the lines #73452, #73458, #74520
and #74616).


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
@ 2012-09-07 10:25 ` rguenth at gcc dot gnu.org
  2012-09-07 10:53 ` werner.henze at alumni dot tu-berlin.de
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-07 10:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-09-07
     Ever Confirmed|0                           |1

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-07 10:24:50 UTC ---
Attachment missing.


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
  2012-09-07 10:25 ` [Bug middle-end/54515] " rguenth at gcc dot gnu.org
@ 2012-09-07 10:53 ` werner.henze at alumni dot tu-berlin.de
  2012-09-07 11:49 ` werner.henze at alumni dot tu-berlin.de
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: werner.henze at alumni dot tu-berlin.de @ 2012-09-07 10:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #2 from Werner Henze <werner.henze at alumni dot tu-berlin.de> 2012-09-07 10:53:33 UTC ---
Created attachment 28144
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28144
preprocessed file as written by the sigsegv handler


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
  2012-09-07 10:25 ` [Bug middle-end/54515] " rguenth at gcc dot gnu.org
  2012-09-07 10:53 ` werner.henze at alumni dot tu-berlin.de
@ 2012-09-07 11:49 ` werner.henze at alumni dot tu-berlin.de
  2012-09-07 11:56 ` markus at trippelsdorf dot de
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: werner.henze at alumni dot tu-berlin.de @ 2012-09-07 11:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #3 from Werner Henze <werner.henze at alumni dot tu-berlin.de> 2012-09-07 11:49:43 UTC ---
Created attachment 28145
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28145
preprocessed file as written by the sigsegv handler

Just saw a second sigsegv. This might be related to the bug (including same
project files), but it might also be another bug.
This compilation succeeds with -O0 and -O1, it crashes with -O3, -O2 and -Os.
In this case there is no anonymous namespace involved.


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (2 preceding siblings ...)
  2012-09-07 11:49 ` werner.henze at alumni dot tu-berlin.de
@ 2012-09-07 11:56 ` markus at trippelsdorf dot de
  2012-09-07 11:59 ` markus at trippelsdorf dot de
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: markus at trippelsdorf dot de @ 2012-09-07 11:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

Markus Trippelsdorf <markus at trippelsdorf dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |markus at trippelsdorf dot
                   |                            |de

--- Comment #4 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-09-07 11:56:34 UTC ---
gcc-4.7 and 4.8 are also affected.

markus@x4 tmp % cat test.ii
template < typename T > T h2le (T)
{
    T a;
    unsigned short &b = a;
    short c = 0;
    unsigned char (&d)[2] = reinterpret_cast < unsigned char (&)[2] > (c);
    unsigned char (&e)[2] = reinterpret_cast < unsigned char (&)[2] > (b);
    e[0] = d[0];
    return a;
}

void
bar ()
{
    h2le ((unsigned short) 0);
}

markus@x4 tmp % gdb /var/tmp/foo/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/g++
Reading symbols from
/var/tmp/foo/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/g++...done.
(gdb) run -c -O2 -std=c++0x test.ii
Starting program: /var/tmp/foo/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/g++ -c -O2
-std=c++0x test.ii
warning: no loadable sections found in added symbol-file system-supplied DSO at
0x7ffff7ffa000
[New process 18282]
process 18282 is executing new program:
/var/tmp/foo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0/cc1plus

Program received signal SIGSEGV, Segmentation fault.
[Switching to process 18282]
0x00000000008b5803 in disqualify_base_of_expr(tree_node*, char const*) () at
../../gcc/gcc/tree-sra.c:987
987     ../../gcc/gcc/tree-sra.c: No such file or directory.
(gdb) bt
#0  0x00000000008b5803 in disqualify_base_of_expr(tree_node*, char const*) ()
at ../../gcc/gcc/tree-sra.c:987
#1  0x00000000008b6eb5 in build_access_from_expr_1(tree_node*,
gimple_statement_d*, bool) () at ../../gcc/gcc/tree-sra.c:1025
#2  0x00000000008b74ab in scan_function() () at ../../gcc/gcc/tree-sra.c:1119
#3  0x00000000008bb622 in ipa_early_sra() () at ../../gcc/gcc/tree-sra.c:4814
#4  0x00000000007ca012 in execute_one_pass(opt_pass*) () at
../../gcc/gcc/passes.c:2158
#5  0x00000000007ca385 in execute_pass_list(opt_pass*) () at
../../gcc/gcc/passes.c:2213
#6  0x00000000007ca397 in execute_pass_list(opt_pass*) () at
../../gcc/gcc/passes.c:2214
#7  0x00000000007c95fd in do_per_function_toporder(void (*)(void*), void*) ()
at ../../gcc/gcc/passes.c:1702
#8  0x00000000007ca7ec in execute_ipa_pass_list(opt_pass*) () at
../../gcc/gcc/passes.c:2527
#9  0x000000000064f758 in compile() ()
#10 0x000000000064fb15 in finalize_compilation_unit() ()
#11 0x0000000000528a57 in cp_write_global_declarations() () at
../../gcc/gcc/cp/decl2.c:4024
#12 0x000000000085a565 in compile_file() ()
#13 0x000000000085bd5a in toplev_main(int, char**) ()
#14 0x00007ffff74ef755 in __libc_start_main () from /lib/libc.so.6
#15 0x00000000004c8249 in _start ()


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (3 preceding siblings ...)
  2012-09-07 11:56 ` markus at trippelsdorf dot de
@ 2012-09-07 11:59 ` markus at trippelsdorf dot de
  2012-09-07 15:23 ` markus at trippelsdorf dot de
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: markus at trippelsdorf dot de @ 2012-09-07 11:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #5 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-09-07 11:59:45 UTC ---
(In reply to comment #3)
> Created attachment 28145 [details]
> preprocessed file as written by the sigsegv handler
> 
> Just saw a second sigsegv. This might be related to the bug (including same
> project files), but it might also be another bug.
> This compilation succeeds with -O0 and -O1, it crashes with -O3, -O2 and -Os.
> In this case there is no anonymous namespace involved.

It's the same issue.


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (4 preceding siblings ...)
  2012-09-07 11:59 ` markus at trippelsdorf dot de
@ 2012-09-07 15:23 ` markus at trippelsdorf dot de
  2012-09-10  9:48 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: markus at trippelsdorf dot de @ 2012-09-07 15:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #6 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-09-07 15:23:04 UTC ---
The following patch fixes the issue for me:

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index aafaa15..2bb92e9 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -984,7 +984,8 @@ static void
 disqualify_base_of_expr (tree t, const char *reason)
 {
   t = get_base_address (t);
-  if (sra_mode == SRA_MODE_EARLY_IPA
+  if (t
+      && sra_mode == SRA_MODE_EARLY_IPA
       && TREE_CODE (t) == MEM_REF)
     t = get_ssa_base_param (TREE_OPERAND (t, 0));


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (5 preceding siblings ...)
  2012-09-07 15:23 ` markus at trippelsdorf dot de
@ 2012-09-10  9:48 ` rguenth at gcc dot gnu.org
  2012-09-10  9:50 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-10  9:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-10 09:48:32 UTC ---
Author: rguenth
Date: Mon Sep 10 09:48:28 2012
New Revision: 191130

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191130
Log:
2012-09-07  Markus Trippelsdorf  <markus@trippelsdorf.de>

    PR middle-end/54515
    * tree-sra.c (disqualify_base_of_expr): Check for possible
    NULL_TREE returned by get_base_address()

    * g++.dg/tree-ssa/pr54515.C: new testcase

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/tree-ssa/pr54515.C
Modified:
    branches/gcc-4_7-branch/gcc/ChangeLog
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_7-branch/gcc/tree-sra.c


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (6 preceding siblings ...)
  2012-09-10  9:48 ` rguenth at gcc dot gnu.org
@ 2012-09-10  9:50 ` rguenth at gcc dot gnu.org
  2012-09-10 11:33 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-10  9:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-10 09:50:07 UTC ---
Author: rguenth
Date: Mon Sep 10 09:50:02 2012
New Revision: 191131

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191131
Log:
2012-09-10  Markus Trippelsdorf  <markus@trippelsdorf.de>

    PR middle-end/54515
    * tree-sra.c (disqualify_base_of_expr): Check for possible
    NULL_TREE returned by get_base_address()

    * g++.dg/tree-ssa/pr54515.C: new testcase

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/tree-ssa/pr54515.C
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_6-branch/gcc/tree-sra.c


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (7 preceding siblings ...)
  2012-09-10  9:50 ` rguenth at gcc dot gnu.org
@ 2012-09-10 11:33 ` rguenth at gcc dot gnu.org
  2012-09-11  8:33 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-10 11:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #9 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-10 11:33:03 UTC ---
Testing sth different for trunk.


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (8 preceding siblings ...)
  2012-09-10 11:33 ` rguenth at gcc dot gnu.org
@ 2012-09-11  8:33 ` rguenth at gcc dot gnu.org
  2012-09-11  8:33 ` rguenth at gcc dot gnu.org
  2012-09-11  8:33 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-11  8:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-11 08:32:43 UTC ---
Author: rguenth
Date: Tue Sep 11 08:32:29 2012
New Revision: 191174

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191174
Log:
2012-09-11  Richard Guenther  <rguenther@suse.de>

    PR middle-end/54515
    * gimple.c (get_base_address): Do not return NULL_TREE apart
    from for WITH_SIZE_EXPR.
    * gimple-fold.c (canonicalize_constructor_val): Do not call
    get_base_address when not necessary.

    * g++.dg/tree-ssa/pr54515.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr54515.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/gimple.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (9 preceding siblings ...)
  2012-09-11  8:33 ` rguenth at gcc dot gnu.org
@ 2012-09-11  8:33 ` rguenth at gcc dot gnu.org
  2012-09-11  8:33 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-11  8:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.6.4, 4.7.2, 4.8.0
         Resolution|                            |FIXED
      Known to fail|                            |4.6.3, 4.7.1

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-11 08:33:36 UTC ---
Fixed.


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

* [Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
  2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
                   ` (10 preceding siblings ...)
  2012-09-11  8:33 ` rguenth at gcc dot gnu.org
@ 2012-09-11  8:33 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-09-11  8:33 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.6.4, 4.7.2, 4.8.0
         Resolution|                            |FIXED
      Known to fail|                            |4.6.3, 4.7.1

--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-11 08:32:43 UTC ---
Author: rguenth
Date: Tue Sep 11 08:32:29 2012
New Revision: 191174

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191174
Log:
2012-09-11  Richard Guenther  <rguenther@suse.de>

    PR middle-end/54515
    * gimple.c (get_base_address): Do not return NULL_TREE apart
    from for WITH_SIZE_EXPR.
    * gimple-fold.c (canonicalize_constructor_val): Do not call
    get_base_address when not necessary.

    * g++.dg/tree-ssa/pr54515.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/tree-ssa/pr54515.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/gimple-fold.c
    trunk/gcc/gimple.c
    trunk/gcc/testsuite/ChangeLog

--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-09-11 08:33:36 UTC ---
Fixed.


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

end of thread, other threads:[~2012-09-11  8:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 10:02 [Bug c++/54515] New: cc1plus sigsegv -O2 anonymous namespace werner.henze at alumni dot tu-berlin.de
2012-09-07 10:25 ` [Bug middle-end/54515] " rguenth at gcc dot gnu.org
2012-09-07 10:53 ` werner.henze at alumni dot tu-berlin.de
2012-09-07 11:49 ` werner.henze at alumni dot tu-berlin.de
2012-09-07 11:56 ` markus at trippelsdorf dot de
2012-09-07 11:59 ` markus at trippelsdorf dot de
2012-09-07 15:23 ` markus at trippelsdorf dot de
2012-09-10  9:48 ` rguenth at gcc dot gnu.org
2012-09-10  9:50 ` rguenth at gcc dot gnu.org
2012-09-10 11:33 ` rguenth at gcc dot gnu.org
2012-09-11  8:33 ` rguenth at gcc dot gnu.org
2012-09-11  8:33 ` rguenth at gcc dot gnu.org
2012-09-11  8:33 ` rguenth 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).